fix: the key for univ4 fee is key_lp_fee

Update tests with new executor addresses as well

--- don't change below this line ---
ENG-4260 Took 6 minutes
This commit is contained in:
Diana Carvalho
2025-02-27 11:49:03 +00:00
parent 6a6f2d3221
commit 9eb4299ffe
3 changed files with 16 additions and 16 deletions

View File

@@ -51,7 +51,7 @@ async function main() {
// Set executors // Set executors
const executorAddresses = executorsToSet.map(executor => executor.executor); const executorAddresses = executorsToSet.map(executor => executor.executor);
const tx = await router.setExecutors(executorAddresses, { const tx = await router.setExecutors(executorAddresses, {
gasLimit: 100000 gasLimit: 200000 // should be around 50k per executor
}); });
await tx.wait(); // Wait for the transaction to be mined await tx.wait(); // Wait for the transaction to be mined
console.log(`Executors set at transaction: ${tx.hash}`); console.log(`Executors set at transaction: ${tx.hash}`);

View File

@@ -469,13 +469,13 @@ mod tests {
let pool_fee_usdc_eth = Bytes::from(BigInt::from(3000).to_signed_bytes_be()); let pool_fee_usdc_eth = Bytes::from(BigInt::from(3000).to_signed_bytes_be());
let tick_spacing_usdc_eth = Bytes::from(BigInt::from(60).to_signed_bytes_be()); let tick_spacing_usdc_eth = Bytes::from(BigInt::from(60).to_signed_bytes_be());
let mut static_attributes_usdc_eth: HashMap<String, Bytes> = HashMap::new(); let mut static_attributes_usdc_eth: HashMap<String, Bytes> = HashMap::new();
static_attributes_usdc_eth.insert("fee".into(), pool_fee_usdc_eth); static_attributes_usdc_eth.insert("key_lp_fee".into(), pool_fee_usdc_eth);
static_attributes_usdc_eth.insert("tick_spacing".into(), tick_spacing_usdc_eth); static_attributes_usdc_eth.insert("tick_spacing".into(), tick_spacing_usdc_eth);
let pool_fee_eth_pepe = Bytes::from(BigInt::from(25000).to_signed_bytes_be()); let pool_fee_eth_pepe = Bytes::from(BigInt::from(25000).to_signed_bytes_be());
let tick_spacing_eth_pepe = Bytes::from(BigInt::from(500).to_signed_bytes_be()); let tick_spacing_eth_pepe = Bytes::from(BigInt::from(500).to_signed_bytes_be());
let mut static_attributes_eth_pepe: HashMap<String, Bytes> = HashMap::new(); let mut static_attributes_eth_pepe: HashMap<String, Bytes> = HashMap::new();
static_attributes_eth_pepe.insert("fee".into(), pool_fee_eth_pepe); static_attributes_eth_pepe.insert("key_lp_fee".into(), pool_fee_eth_pepe);
static_attributes_eth_pepe.insert("tick_spacing".into(), tick_spacing_eth_pepe); static_attributes_eth_pepe.insert("tick_spacing".into(), tick_spacing_eth_pepe);
let swap_usdc_eth = Swap { let swap_usdc_eth = Swap {
@@ -525,7 +525,7 @@ mod tests {
let hex_protocol_data = encode(&protocol_data); let hex_protocol_data = encode(&protocol_data);
assert_eq!( assert_eq!(
executor_address, executor_address,
Bytes::from_str("0xF62849F9A0B5Bf2913b396098F7c7019b51A820a").unwrap() Bytes::from_str("0x90BE4620436354c9DfA58614B3Bdd5a80FBfAF31").unwrap()
); );
assert_eq!( assert_eq!(
hex_protocol_data, hex_protocol_data,
@@ -537,7 +537,7 @@ mod tests {
// zero for one // zero for one
"00", "00",
// executor address // executor address
"f62849f9a0b5bf2913b396098f7c7019b51a820a", "90be4620436354c9dfa58614b3bdd5a80fbfaf31",
// first pool intermediary token (ETH) // first pool intermediary token (ETH)
"0000000000000000000000000000000000000000", "0000000000000000000000000000000000000000",
// fee // fee
@@ -891,13 +891,13 @@ mod tests {
let pool_fee_usdc_eth = Bytes::from(BigInt::from(3000).to_signed_bytes_be()); let pool_fee_usdc_eth = Bytes::from(BigInt::from(3000).to_signed_bytes_be());
let tick_spacing_usdc_eth = Bytes::from(BigInt::from(60).to_signed_bytes_be()); let tick_spacing_usdc_eth = Bytes::from(BigInt::from(60).to_signed_bytes_be());
let mut static_attributes_usdc_eth: HashMap<String, Bytes> = HashMap::new(); let mut static_attributes_usdc_eth: HashMap<String, Bytes> = HashMap::new();
static_attributes_usdc_eth.insert("fee".into(), pool_fee_usdc_eth); static_attributes_usdc_eth.insert("key_lp_fee".into(), pool_fee_usdc_eth);
static_attributes_usdc_eth.insert("tick_spacing".into(), tick_spacing_usdc_eth); static_attributes_usdc_eth.insert("tick_spacing".into(), tick_spacing_usdc_eth);
let pool_fee_eth_pepe = Bytes::from(BigInt::from(25000).to_signed_bytes_be()); let pool_fee_eth_pepe = Bytes::from(BigInt::from(25000).to_signed_bytes_be());
let tick_spacing_eth_pepe = Bytes::from(BigInt::from(500).to_signed_bytes_be()); let tick_spacing_eth_pepe = Bytes::from(BigInt::from(500).to_signed_bytes_be());
let mut static_attributes_eth_pepe: HashMap<String, Bytes> = HashMap::new(); let mut static_attributes_eth_pepe: HashMap<String, Bytes> = HashMap::new();
static_attributes_eth_pepe.insert("fee".into(), pool_fee_eth_pepe); static_attributes_eth_pepe.insert("key_lp_fee".into(), pool_fee_eth_pepe);
static_attributes_eth_pepe.insert("tick_spacing".into(), tick_spacing_eth_pepe); static_attributes_eth_pepe.insert("tick_spacing".into(), tick_spacing_eth_pepe);
let swap_usdc_eth = Swap { let swap_usdc_eth = Swap {
@@ -990,12 +990,12 @@ mod tests {
"01", // token out index "01", // token out index
"000000", // split "000000", // split
// Swap data header // Swap data header
"f62849f9a0b5bf2913b396098f7c7019b51a820a", // executor address "90be4620436354c9dfa58614b3bdd5a80fbfaf31", // executor address
// Protocol data // Protocol data
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // group token in "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // group token in
"6982508145454ce325ddbe47a25d4ec3d2311933", // group token in "6982508145454ce325ddbe47a25d4ec3d2311933", // group token in
"00", // zero2one "00", // zero2one
"f62849f9a0b5bf2913b396098f7c7019b51a820a", // executor address "90be4620436354c9dfa58614b3bdd5a80fbfaf31", // executor address
// First pool params // First pool params
"0000000000000000000000000000000000000000", // intermediary token (ETH) "0000000000000000000000000000000000000000", // intermediary token (ETH)
"000bb8", // fee "000bb8", // fee
@@ -1110,7 +1110,7 @@ mod tests {
let pool_fee_eth_pepe = Bytes::from(BigInt::from(25000).to_signed_bytes_be()); let pool_fee_eth_pepe = Bytes::from(BigInt::from(25000).to_signed_bytes_be());
let tick_spacing_eth_pepe = Bytes::from(BigInt::from(500).to_signed_bytes_be()); let tick_spacing_eth_pepe = Bytes::from(BigInt::from(500).to_signed_bytes_be());
let mut static_attributes_eth_pepe: HashMap<String, Bytes> = HashMap::new(); let mut static_attributes_eth_pepe: HashMap<String, Bytes> = HashMap::new();
static_attributes_eth_pepe.insert("fee".into(), pool_fee_eth_pepe); static_attributes_eth_pepe.insert("key_lp_fee".into(), pool_fee_eth_pepe);
static_attributes_eth_pepe.insert("tick_spacing".into(), tick_spacing_eth_pepe); static_attributes_eth_pepe.insert("tick_spacing".into(), tick_spacing_eth_pepe);
let swap_eth_pepe = Swap { let swap_eth_pepe = Swap {
@@ -1173,7 +1173,7 @@ mod tests {
let pool_fee_usdc_eth = Bytes::from(BigInt::from(3000).to_signed_bytes_be()); let pool_fee_usdc_eth = Bytes::from(BigInt::from(3000).to_signed_bytes_be());
let tick_spacing_usdc_eth = Bytes::from(BigInt::from(60).to_signed_bytes_be()); let tick_spacing_usdc_eth = Bytes::from(BigInt::from(60).to_signed_bytes_be());
let mut static_attributes_usdc_eth: HashMap<String, Bytes> = HashMap::new(); let mut static_attributes_usdc_eth: HashMap<String, Bytes> = HashMap::new();
static_attributes_usdc_eth.insert("fee".into(), pool_fee_usdc_eth); static_attributes_usdc_eth.insert("key_lp_fee".into(), pool_fee_usdc_eth);
static_attributes_usdc_eth.insert("tick_spacing".into(), tick_spacing_usdc_eth); static_attributes_usdc_eth.insert("tick_spacing".into(), tick_spacing_usdc_eth);
let swap_usdc_eth = Swap { let swap_usdc_eth = Swap {

View File

@@ -152,7 +152,7 @@ impl SwapEncoder for UniswapV4SwapEncoder {
swap: Swap, swap: Swap,
encoding_context: EncodingContext, encoding_context: EncodingContext,
) -> Result<Vec<u8>, EncodingError> { ) -> Result<Vec<u8>, EncodingError> {
let fee = get_static_attribute(&swap, "fee")?; let fee = get_static_attribute(&swap, "key_lp_fee")?;
let pool_fee_u24 = pad_to_fixed_size::<3>(&fee) let pool_fee_u24 = pad_to_fixed_size::<3>(&fee)
.map_err(|_| EncodingError::FatalError("Failed to pad fee bytes".to_string()))?; .map_err(|_| EncodingError::FatalError("Failed to pad fee bytes".to_string()))?;
@@ -417,7 +417,7 @@ mod tests {
let token_out = Bytes::from("0xdAC17F958D2ee523a2206206994597C13D831ec7"); // USDT let token_out = Bytes::from("0xdAC17F958D2ee523a2206206994597C13D831ec7"); // USDT
let mut static_attributes: HashMap<String, Bytes> = HashMap::new(); let mut static_attributes: HashMap<String, Bytes> = HashMap::new();
static_attributes.insert("fee".into(), Bytes::from(fee.to_signed_bytes_be())); static_attributes.insert("key_lp_fee".into(), Bytes::from(fee.to_signed_bytes_be()));
static_attributes static_attributes
.insert("tick_spacing".into(), Bytes::from(tick_spacing.to_signed_bytes_be())); .insert("tick_spacing".into(), Bytes::from(tick_spacing.to_signed_bytes_be()));
@@ -483,7 +483,7 @@ mod tests {
let token_out = Bytes::from("0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"); // WBTC let token_out = Bytes::from("0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"); // WBTC
let mut static_attributes: HashMap<String, Bytes> = HashMap::new(); let mut static_attributes: HashMap<String, Bytes> = HashMap::new();
static_attributes.insert("fee".into(), Bytes::from(fee.to_signed_bytes_be())); static_attributes.insert("key_lp_fee".into(), Bytes::from(fee.to_signed_bytes_be()));
static_attributes static_attributes
.insert("tick_spacing".into(), Bytes::from(tick_spacing.to_signed_bytes_be())); .insert("tick_spacing".into(), Bytes::from(tick_spacing.to_signed_bytes_be()));
@@ -553,7 +553,7 @@ mod tests {
let mut usde_usdt_static_attributes: HashMap<String, Bytes> = HashMap::new(); let mut usde_usdt_static_attributes: HashMap<String, Bytes> = HashMap::new();
usde_usdt_static_attributes usde_usdt_static_attributes
.insert("fee".into(), Bytes::from(usde_usdt_fee.to_signed_bytes_be())); .insert("key_lp_fee".into(), Bytes::from(usde_usdt_fee.to_signed_bytes_be()));
usde_usdt_static_attributes.insert( usde_usdt_static_attributes.insert(
"tick_spacing".into(), "tick_spacing".into(),
Bytes::from(usde_usdt_tick_spacing.to_signed_bytes_be()), Bytes::from(usde_usdt_tick_spacing.to_signed_bytes_be()),
@@ -571,7 +571,7 @@ mod tests {
let mut usdt_wbtc_static_attributes: HashMap<String, Bytes> = HashMap::new(); let mut usdt_wbtc_static_attributes: HashMap<String, Bytes> = HashMap::new();
usdt_wbtc_static_attributes usdt_wbtc_static_attributes
.insert("fee".into(), Bytes::from(usdt_wbtc_fee.to_signed_bytes_be())); .insert("key_lp_fee".into(), Bytes::from(usdt_wbtc_fee.to_signed_bytes_be()));
usdt_wbtc_static_attributes.insert( usdt_wbtc_static_attributes.insert(
"tick_spacing".into(), "tick_spacing".into(),
Bytes::from(usdt_wbtc_tick_spacing.to_signed_bytes_be()), Bytes::from(usdt_wbtc_tick_spacing.to_signed_bytes_be()),