Skip to content

Commit 8ab4400

Browse files
Support Lens (cowprotocol#3469)
# Description This PR contains changes that are required to run the protocol on the Lens chain. # Changes - All the SCs available on this chain from the existing list. - Since balancer vault is not available on Lens, I dropped it and some others from the baseline config since they were unused anyway. - Migrate to UniswapV3SwapRouterV2. ## How to test Run locally with the baseline solver: - [x] Sell order quoting works - [x] Buy order quoting works - [x] Placing sell order works - [x] Placing buy order works --------- Co-authored-by: MartinquaXD <martin.beckmann@protonmail.com>
1 parent 6f5d2e6 commit 8ab4400

File tree

14 files changed

+101
-109
lines changed

14 files changed

+101
-109
lines changed

crates/chain/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ pub enum Chain {
2323
Avalanche = 43114,
2424
Optimism = 10,
2525
Polygon = 137,
26+
Lens = 232,
2627
}
2728

2829
impl Chain {
@@ -47,6 +48,7 @@ impl Chain {
4748
Self::Avalanche => "Avalanche",
4849
Self::Optimism => "Optimism",
4950
Self::Polygon => "Polygon",
51+
Self::Lens => "Lens",
5052
}
5153
}
5254

@@ -60,7 +62,7 @@ impl Chain {
6062
| Self::Base
6163
| Self::Bnb
6264
| Self::Optimism => 10u128.pow(17).into(),
63-
Self::Gnosis | Self::Avalanche => 10u128.pow(18).into(),
65+
Self::Gnosis | Self::Avalanche | Self::Lens => 10u128.pow(18).into(),
6466
Self::Polygon => 10u128.pow(20).into(),
6567
Self::Hardhat => {
6668
panic!("unsupported chain for default amount to estimate native prices with")
@@ -82,6 +84,7 @@ impl Chain {
8284
Self::Avalanche => Duration::from_millis(2_000),
8385
Self::Optimism => Duration::from_millis(2_000),
8486
Self::Polygon => Duration::from_millis(2_000),
87+
Self::Lens => Duration::from_millis(2_000),
8588
}
8689
}
8790

@@ -110,6 +113,7 @@ impl TryFrom<u64> for Chain {
110113
x if x == Self::Avalanche as u64 => Self::Avalanche,
111114
x if x == Self::Optimism as u64 => Self::Optimism,
112115
x if x == Self::Polygon as u64 => Self::Polygon,
116+
x if x == Self::Lens as u64 => Self::Lens,
113117
_ => Err(ChainIdNotSupported)?,
114118
};
115119
Ok(network)

crates/contracts/artifacts/UniswapV3SwapRouter.json

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"abi":[{"inputs":[{"components":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"},{"internalType":"uint160","name":"sqrtPriceLimitX96","type":"uint160"}],"internalType":"struct IV3SwapRouter.ExactOutputSingleParams","name":"params","type":"tuple"}],"name":"exactOutputSingle","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"}]}

0 commit comments

Comments
 (0)