fix: revert hooks rename
- Instead, add a new attribute to the builder, constants, and executor addresses json - This was a miscommunication. Regular pools will still have the same name - only those with hooks will have hook appended to it
This commit is contained in:
@@ -12,6 +12,7 @@ pub const PROTOCOL_SPECIFIC_CONFIG: &str =
|
||||
/// transfers.
|
||||
pub static GROUPABLE_PROTOCOLS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
|
||||
let mut set = HashSet::new();
|
||||
set.insert("uniswap_v4");
|
||||
set.insert("uniswap_v4_hooks");
|
||||
set.insert("vm:balancer_v3");
|
||||
set.insert("ekubo_v2");
|
||||
@@ -28,6 +29,7 @@ pub static IN_TRANSFER_REQUIRED_PROTOCOLS: LazyLock<HashSet<&'static str>> = Laz
|
||||
set.insert("pancakeswap_v2");
|
||||
set.insert("uniswap_v3");
|
||||
set.insert("pancakeswap_v3");
|
||||
set.insert("uniswap_v4");
|
||||
set.insert("uniswap_v4_hooks");
|
||||
set.insert("ekubo_v2");
|
||||
set.insert("vm:maverick_v2");
|
||||
@@ -45,7 +47,7 @@ pub static CALLBACK_CONSTRAINED_PROTOCOLS: LazyLock<HashSet<&'static str>> = Laz
|
||||
let mut set = HashSet::new();
|
||||
set.insert("uniswap_v3");
|
||||
set.insert("pancakeswap_v3");
|
||||
set.insert("uniswap_v4_hooks");
|
||||
set.insert("uniswap_v4");
|
||||
set.insert("ekubo_v2");
|
||||
set.insert("vm:balancer_v3");
|
||||
set
|
||||
|
||||
@@ -106,14 +106,20 @@ mod tests {
|
||||
let dai = Bytes::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap();
|
||||
|
||||
let swap_weth_wbtc = SwapBuilder::new(
|
||||
ProtocolComponent { protocol_system: "uniswap_v4_hooks".to_string(), ..Default::default() },
|
||||
ProtocolComponent {
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
weth.clone(),
|
||||
wbtc.clone(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let swap_wbtc_usdc = SwapBuilder::new(
|
||||
ProtocolComponent { protocol_system: "uniswap_v4_hooks".to_string(), ..Default::default() },
|
||||
ProtocolComponent {
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
wbtc.clone(),
|
||||
usdc.clone(),
|
||||
)
|
||||
@@ -135,7 +141,7 @@ mod tests {
|
||||
swaps: vec![swap_weth_wbtc, swap_wbtc_usdc],
|
||||
token_in: weth,
|
||||
token_out: usdc.clone(),
|
||||
protocol_system: "uniswap_v4_hooks".to_string(),
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
split: 0f64,
|
||||
},
|
||||
SwapGroup {
|
||||
@@ -165,20 +171,29 @@ mod tests {
|
||||
let dai = Bytes::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap();
|
||||
|
||||
let swap_wbtc_weth = SwapBuilder::new(
|
||||
ProtocolComponent { protocol_system: "uniswap_v4_hooks".to_string(), ..Default::default() },
|
||||
ProtocolComponent {
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
wbtc.clone(),
|
||||
weth.clone(),
|
||||
)
|
||||
.build();
|
||||
let swap_weth_usdc = SwapBuilder::new(
|
||||
ProtocolComponent { protocol_system: "uniswap_v4_hooks".to_string(), ..Default::default() },
|
||||
ProtocolComponent {
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
weth.clone(),
|
||||
usdc.clone(),
|
||||
)
|
||||
.split(0.5f64)
|
||||
.build();
|
||||
let swap_weth_dai = SwapBuilder::new(
|
||||
ProtocolComponent { protocol_system: "uniswap_v4_hooks".to_string(), ..Default::default() },
|
||||
ProtocolComponent {
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
weth.clone(),
|
||||
dai.clone(),
|
||||
)
|
||||
@@ -187,7 +202,10 @@ mod tests {
|
||||
// 0 to signify "the remainder of the WETH value". It should still be very close to 50%
|
||||
|
||||
let swap_dai_usdc = SwapBuilder::new(
|
||||
ProtocolComponent { protocol_system: "uniswap_v4_hooks".to_string(), ..Default::default() },
|
||||
ProtocolComponent {
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
dai.clone(),
|
||||
usdc.clone(),
|
||||
)
|
||||
@@ -207,21 +225,21 @@ mod tests {
|
||||
swaps: vec![swap_wbtc_weth],
|
||||
token_in: wbtc.clone(),
|
||||
token_out: weth.clone(),
|
||||
protocol_system: "uniswap_v4_hooks".to_string(),
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
split: 0f64,
|
||||
},
|
||||
SwapGroup {
|
||||
swaps: vec![swap_weth_usdc],
|
||||
token_in: weth.clone(),
|
||||
token_out: usdc.clone(),
|
||||
protocol_system: "uniswap_v4_hooks".to_string(),
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
split: 0.5f64,
|
||||
},
|
||||
SwapGroup {
|
||||
swaps: vec![swap_weth_dai, swap_dai_usdc],
|
||||
token_in: weth,
|
||||
token_out: usdc,
|
||||
protocol_system: "uniswap_v4_hooks".to_string(),
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
split: 0f64,
|
||||
}
|
||||
]
|
||||
@@ -263,13 +281,19 @@ mod tests {
|
||||
)
|
||||
.build();
|
||||
let swap_weth_dai = SwapBuilder::new(
|
||||
ProtocolComponent { protocol_system: "uniswap_v4_hooks".to_string(), ..Default::default() },
|
||||
ProtocolComponent {
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
weth.clone(),
|
||||
dai.clone(),
|
||||
)
|
||||
.build();
|
||||
let swap_dai_usdc = SwapBuilder::new(
|
||||
ProtocolComponent { protocol_system: "uniswap_v4_hooks".to_string(), ..Default::default() },
|
||||
ProtocolComponent {
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
..Default::default()
|
||||
},
|
||||
dai.clone(),
|
||||
usdc.clone(),
|
||||
)
|
||||
@@ -297,7 +321,7 @@ mod tests {
|
||||
swaps: vec![swap_weth_dai, swap_dai_usdc],
|
||||
token_in: weth,
|
||||
token_out: usdc,
|
||||
protocol_system: "uniswap_v4_hooks".to_string(),
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
split: 0f64,
|
||||
}
|
||||
]
|
||||
|
||||
@@ -67,6 +67,11 @@ impl SwapEncoderBuilder {
|
||||
self.chain,
|
||||
self.config,
|
||||
)?)),
|
||||
"uniswap_v4" => Ok(Box::new(UniswapV4SwapEncoder::new(
|
||||
self.executor_address,
|
||||
self.chain,
|
||||
self.config,
|
||||
)?)),
|
||||
"uniswap_v4_hooks" => Ok(Box::new(UniswapV4SwapEncoder::new(
|
||||
self.executor_address,
|
||||
self.chain,
|
||||
|
||||
@@ -445,7 +445,7 @@ mod tests {
|
||||
ProtocolComponent {
|
||||
id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d"
|
||||
.to_string(),
|
||||
protocol_system: "uniswap_v4_hooks".to_string(),
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
static_attributes: static_attributes_usdc_eth,
|
||||
..Default::default()
|
||||
},
|
||||
@@ -465,7 +465,7 @@ mod tests {
|
||||
ProtocolComponent {
|
||||
id: "0xecd73ecbf77219f21f129c8836d5d686bbc27d264742ddad620500e3e548e2c9"
|
||||
.to_string(),
|
||||
protocol_system: "uniswap_v4_hooks".to_string(),
|
||||
protocol_system: "uniswap_v4".to_string(),
|
||||
static_attributes: static_attributes_eth_pepe,
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user