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:
TAMARA LIPOWSKI
2025-08-21 17:40:28 -04:00
parent 03414532c6
commit ea9a1a88ca
9 changed files with 69 additions and 37 deletions

View File

@@ -5,7 +5,7 @@
"pancakeswap_v2": "0xC9db3FEB380E4fd9af239e2595ECdEcE3b5c34A4", "pancakeswap_v2": "0xC9db3FEB380E4fd9af239e2595ECdEcE3b5c34A4",
"uniswap_v3": "0xbab7124C9662B15C6b9AF0b1f329907dD55a24FC", "uniswap_v3": "0xbab7124C9662B15C6b9AF0b1f329907dD55a24FC",
"pancakeswap_v3": "0x9D32e9F569B22Ae8d8C6f788037C1CD53632A059", "pancakeswap_v3": "0x9D32e9F569B22Ae8d8C6f788037C1CD53632A059",
"uniswap_v4_hooks": "0x2C2EaB81Cf983602153E67b1890164BC4CABC6ed", "uniswap_v4": "0x2C2EaB81Cf983602153E67b1890164BC4CABC6ed",
"vm:balancer_v2": "0xB5b8dc3F0a1Be99685a0DEd015Af93bFBB55C411", "vm:balancer_v2": "0xB5b8dc3F0a1Be99685a0DEd015Af93bFBB55C411",
"ekubo_v2": "0x263DD7AD20983b5E0392bf1F09C4493500EDb333", "ekubo_v2": "0x263DD7AD20983b5E0392bf1F09C4493500EDb333",
"vm:curve": "0x879F3008D96EBea0fc584aD684c7Df31777F3165", "vm:curve": "0x879F3008D96EBea0fc584aD684c7Df31777F3165",
@@ -17,12 +17,12 @@
"base": { "base": {
"uniswap_v2": "0xF744EBfaA580cF3fFc25aD046E92BD8B770a0700", "uniswap_v2": "0xF744EBfaA580cF3fFc25aD046E92BD8B770a0700",
"uniswap_v3": "0x647bffbf8bd72bf6341ecba8b0279e090313a40d", "uniswap_v3": "0x647bffbf8bd72bf6341ecba8b0279e090313a40d",
"uniswap_v4_hooks": "0x7Dfa502736C7bd84DA1402F7524214215BC9534d", "uniswap_v4": "0x7Dfa502736C7bd84DA1402F7524214215BC9534d",
"rfq:bebop": "0x489A3f531dA3873D6585BF3f8E0dEE48CAC6F7BC" "rfq:bebop": "0x489A3f531dA3873D6585BF3f8E0dEE48CAC6F7BC"
}, },
"unichain": { "unichain": {
"uniswap_v2": "0x00C1b81e3C8f6347E69e2DDb90454798A6Be975E", "uniswap_v2": "0x00C1b81e3C8f6347E69e2DDb90454798A6Be975E",
"uniswap_v3": "0xD26A838A41af3d4815DfD745a080B2062c4124d1", "uniswap_v3": "0xD26A838A41af3d4815DfD745a080B2062c4124d1",
"uniswap_v4_hooks": "0x647bfFbF8Bd72bF6341ECBa8B0279e090313A40D" "uniswap_v4": "0x647bfFbF8Bd72bF6341ECBa8B0279e090313A40D"
} }
} }

View File

@@ -5,6 +5,7 @@
"pancakeswap_v2": "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f", "pancakeswap_v2": "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f",
"uniswap_v3": "0x2e234DAe75C793f67A35089C9d99245E1C58470b", "uniswap_v3": "0x2e234DAe75C793f67A35089C9d99245E1C58470b",
"pancakeswap_v3": "0x5991A2dF15A8F6A256D3Ec51E99254Cd3fb576A9", "pancakeswap_v3": "0x5991A2dF15A8F6A256D3Ec51E99254Cd3fb576A9",
"uniswap_v4": "0xF62849F9A0B5Bf2913b396098F7c7019b51A820a",
"uniswap_v4_hooks": "0xF62849F9A0B5Bf2913b396098F7c7019b51A820a", "uniswap_v4_hooks": "0xF62849F9A0B5Bf2913b396098F7c7019b51A820a",
"vm:balancer_v2": "0xc7183455a4C133Ae270771860664b6B7ec320bB1", "vm:balancer_v2": "0xc7183455a4C133Ae270771860664b6B7ec320bB1",
"ekubo_v2": "0xa0Cb889707d426A7A386870A03bc70d1b0697598", "ekubo_v2": "0xa0Cb889707d426A7A386870A03bc70d1b0697598",

File diff suppressed because one or more lines are too long

View File

@@ -12,6 +12,7 @@ pub const PROTOCOL_SPECIFIC_CONFIG: &str =
/// transfers. /// transfers.
pub static GROUPABLE_PROTOCOLS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| { pub static GROUPABLE_PROTOCOLS: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
let mut set = HashSet::new(); let mut set = HashSet::new();
set.insert("uniswap_v4");
set.insert("uniswap_v4_hooks"); set.insert("uniswap_v4_hooks");
set.insert("vm:balancer_v3"); set.insert("vm:balancer_v3");
set.insert("ekubo_v2"); 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("pancakeswap_v2");
set.insert("uniswap_v3"); set.insert("uniswap_v3");
set.insert("pancakeswap_v3"); set.insert("pancakeswap_v3");
set.insert("uniswap_v4");
set.insert("uniswap_v4_hooks"); set.insert("uniswap_v4_hooks");
set.insert("ekubo_v2"); set.insert("ekubo_v2");
set.insert("vm:maverick_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(); let mut set = HashSet::new();
set.insert("uniswap_v3"); set.insert("uniswap_v3");
set.insert("pancakeswap_v3"); set.insert("pancakeswap_v3");
set.insert("uniswap_v4_hooks"); set.insert("uniswap_v4");
set.insert("ekubo_v2"); set.insert("ekubo_v2");
set.insert("vm:balancer_v3"); set.insert("vm:balancer_v3");
set set

View File

@@ -106,14 +106,20 @@ mod tests {
let dai = Bytes::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap(); let dai = Bytes::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap();
let swap_weth_wbtc = SwapBuilder::new( 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(), weth.clone(),
wbtc.clone(), wbtc.clone(),
) )
.build(); .build();
let swap_wbtc_usdc = SwapBuilder::new( 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(), wbtc.clone(),
usdc.clone(), usdc.clone(),
) )
@@ -135,7 +141,7 @@ mod tests {
swaps: vec![swap_weth_wbtc, swap_wbtc_usdc], swaps: vec![swap_weth_wbtc, swap_wbtc_usdc],
token_in: weth, token_in: weth,
token_out: usdc.clone(), token_out: usdc.clone(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
split: 0f64, split: 0f64,
}, },
SwapGroup { SwapGroup {
@@ -165,20 +171,29 @@ mod tests {
let dai = Bytes::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap(); let dai = Bytes::from_str("0x6b175474e89094c44da98b954eedeac495271d0f").unwrap();
let swap_wbtc_weth = SwapBuilder::new( 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(), wbtc.clone(),
weth.clone(), weth.clone(),
) )
.build(); .build();
let swap_weth_usdc = SwapBuilder::new( 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(), weth.clone(),
usdc.clone(), usdc.clone(),
) )
.split(0.5f64) .split(0.5f64)
.build(); .build();
let swap_weth_dai = SwapBuilder::new( 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(), weth.clone(),
dai.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% // 0 to signify "the remainder of the WETH value". It should still be very close to 50%
let swap_dai_usdc = SwapBuilder::new( 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(), dai.clone(),
usdc.clone(), usdc.clone(),
) )
@@ -207,21 +225,21 @@ mod tests {
swaps: vec![swap_wbtc_weth], swaps: vec![swap_wbtc_weth],
token_in: wbtc.clone(), token_in: wbtc.clone(),
token_out: weth.clone(), token_out: weth.clone(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
split: 0f64, split: 0f64,
}, },
SwapGroup { SwapGroup {
swaps: vec![swap_weth_usdc], swaps: vec![swap_weth_usdc],
token_in: weth.clone(), token_in: weth.clone(),
token_out: usdc.clone(), token_out: usdc.clone(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
split: 0.5f64, split: 0.5f64,
}, },
SwapGroup { SwapGroup {
swaps: vec![swap_weth_dai, swap_dai_usdc], swaps: vec![swap_weth_dai, swap_dai_usdc],
token_in: weth, token_in: weth,
token_out: usdc, token_out: usdc,
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
split: 0f64, split: 0f64,
} }
] ]
@@ -263,13 +281,19 @@ mod tests {
) )
.build(); .build();
let swap_weth_dai = SwapBuilder::new( 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(), weth.clone(),
dai.clone(), dai.clone(),
) )
.build(); .build();
let swap_dai_usdc = SwapBuilder::new( 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(), dai.clone(),
usdc.clone(), usdc.clone(),
) )
@@ -297,7 +321,7 @@ mod tests {
swaps: vec![swap_weth_dai, swap_dai_usdc], swaps: vec![swap_weth_dai, swap_dai_usdc],
token_in: weth, token_in: weth,
token_out: usdc, token_out: usdc,
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
split: 0f64, split: 0f64,
} }
] ]

View File

@@ -67,6 +67,11 @@ impl SwapEncoderBuilder {
self.chain, self.chain,
self.config, self.config,
)?)), )?)),
"uniswap_v4" => Ok(Box::new(UniswapV4SwapEncoder::new(
self.executor_address,
self.chain,
self.config,
)?)),
"uniswap_v4_hooks" => Ok(Box::new(UniswapV4SwapEncoder::new( "uniswap_v4_hooks" => Ok(Box::new(UniswapV4SwapEncoder::new(
self.executor_address, self.executor_address,
self.chain, self.chain,

View File

@@ -445,7 +445,7 @@ mod tests {
ProtocolComponent { ProtocolComponent {
id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d" id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d"
.to_string(), .to_string(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
static_attributes: static_attributes_usdc_eth, static_attributes: static_attributes_usdc_eth,
..Default::default() ..Default::default()
}, },
@@ -465,7 +465,7 @@ mod tests {
ProtocolComponent { ProtocolComponent {
id: "0xecd73ecbf77219f21f129c8836d5d686bbc27d264742ddad620500e3e548e2c9" id: "0xecd73ecbf77219f21f129c8836d5d686bbc27d264742ddad620500e3e548e2c9"
.to_string(), .to_string(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
static_attributes: static_attributes_eth_pepe, static_attributes: static_attributes_eth_pepe,
..Default::default() ..Default::default()
}, },

View File

@@ -481,7 +481,7 @@ fn test_multi_protocol() {
let usv4_swap_usdc_eth = Swap { let usv4_swap_usdc_eth = Swap {
component: ProtocolComponent { component: ProtocolComponent {
id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d".to_string(), id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d".to_string(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
static_attributes: static_attributes_usdc_eth, static_attributes: static_attributes_usdc_eth,
..Default::default() ..Default::default()
}, },

View File

@@ -156,7 +156,7 @@ fn test_single_encoding_strategy_usv4_eth_in() {
let swap_eth_pepe = Swap { let swap_eth_pepe = Swap {
component: ProtocolComponent { component: ProtocolComponent {
id: "0xecd73ecbf77219f21f129c8836d5d686bbc27d264742ddad620500e3e548e2c9".to_string(), id: "0xecd73ecbf77219f21f129c8836d5d686bbc27d264742ddad620500e3e548e2c9".to_string(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
static_attributes: static_attributes_eth_pepe, static_attributes: static_attributes_eth_pepe,
..Default::default() ..Default::default()
}, },
@@ -224,7 +224,7 @@ fn test_single_encoding_strategy_usv4_eth_out() {
let swap_usdc_eth = Swap { let swap_usdc_eth = Swap {
component: ProtocolComponent { component: ProtocolComponent {
id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d".to_string(), id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d".to_string(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
static_attributes: static_attributes_usdc_eth, static_attributes: static_attributes_usdc_eth,
..Default::default() ..Default::default()
}, },
@@ -300,7 +300,7 @@ fn test_single_encoding_strategy_usv4_grouped_swap() {
let swap_usdc_eth = Swap { let swap_usdc_eth = Swap {
component: ProtocolComponent { component: ProtocolComponent {
id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d".to_string(), id: "0xdce6394339af00981949f5f3baf27e3610c76326a700af57e4b3e3ae4977f78d".to_string(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
static_attributes: static_attributes_usdc_eth, static_attributes: static_attributes_usdc_eth,
..Default::default() ..Default::default()
}, },
@@ -315,7 +315,7 @@ fn test_single_encoding_strategy_usv4_grouped_swap() {
let swap_eth_pepe = Swap { let swap_eth_pepe = Swap {
component: ProtocolComponent { component: ProtocolComponent {
id: "0xecd73ecbf77219f21f129c8836d5d686bbc27d264742ddad620500e3e548e2c9".to_string(), id: "0xecd73ecbf77219f21f129c8836d5d686bbc27d264742ddad620500e3e548e2c9".to_string(),
protocol_system: "uniswap_v4_hooks".to_string(), protocol_system: "uniswap_v4".to_string(),
static_attributes: static_attributes_eth_pepe, static_attributes: static_attributes_eth_pepe,
..Default::default() ..Default::default()
}, },