diff --git a/config/executor_addresses.json b/config/executor_addresses.json index 1aed562..02e98e6 100644 --- a/config/executor_addresses.json +++ b/config/executor_addresses.json @@ -1,7 +1,7 @@ { "ethereum": { - "uniswap_v2": "0x5615deb798bb3e4dfa0139dfa1b3d433cc23b72f", - "uniswap_v3": "0x2e234DAe75C793f67A35089C9d99245E1C58470b", + "uniswap_v2": "0xf6c5be66FFf9DC69962d73da0A617a827c382329", + "uniswap_v3": "0xdD8559c917393FC8DD2b4dD289c52Ff445fDE1B0", "uniswap_v4": "0x042C0ebBEAb9d9987c2f64Ee05f2B3aeB86eAf70", "vm:balancer_v2": "0x00BE8EfAE40219Ff76287b0F9b9e497942f5BC91" }, diff --git a/foundry/test/TychoRouter.t.sol b/foundry/test/TychoRouter.t.sol index 9e435d4..239cda8 100644 --- a/foundry/test/TychoRouter.t.sol +++ b/foundry/test/TychoRouter.t.sol @@ -1192,7 +1192,7 @@ contract TychoRouterTest is TychoRouterTestSetup { assertEq(IERC20(WBTC_ADDR).balanceOf(tychoRouterAddr), 102718); } - function testCyclicSequentialSwap1() public { + function testCyclicSequentialSwap() public { // This test has start and end tokens that are the same // The flow is: // USDC -> WETH -> USDC using two pools @@ -1358,9 +1358,9 @@ contract TychoRouterTest is TychoRouterTestSetup { vm.startPrank(ALICE); IERC20(USDC_ADDR).approve(PERMIT2_ADDRESS, type(uint256).max); // Encoded solution generated using `test_cyclic_split_swap` - // but manually replacing the executor address - // `dD8559c917393FC8DD2b4dD289c52Ff445fDE1B0` with the one in this test - // `2e234DAe75C793f67A35089C9d99245E1C58470b` + // but manually replacing the executor addresses with the ones in this test + // `dD8559c917393FC8DD2b4dD289c52Ff445fDE1B0` to `2e234DAe75C793f67A35089C9d99245E1C58470b` + // `f6c5be66FFf9DC69962d73da0A617a827c382329` to `5615deb798bb3e4dfa0139dfa1b3d433cc23b72f` (bool success,) = tychoRouterAddr.call( hex"d499aa880000000000000000000000000000000000000000000000000000000005f5e100000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005ef619b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000000000000000000000000067f6c08700000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ede3eca2a72b3aecc820e955b36f38437d013950000000000000000000000000000000000000000000000000000000067cf3a8f000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000041f248bfa39e6801b4173cd4d61e5e5d0c31942eb3c194785f964a82b2c3e05b4b302bccc0924fa4c4ef90854e42865db11f458d3b6a62afddee833f3eb069cd521b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000136006d00019999992e234dae75c793f67a35089c9d99245e1c58470ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20001f43ede3eca2a72b3aecc820e955b36f38437d0139588e6a0c2ddd26feeb64f039a2c41296fcb3f564001006d00010000002e234dae75c793f67a35089c9d99245e1c58470ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000bb83ede3eca2a72b3aecc820e955b36f38437d013958ad599c3a0ff1de082011efddc58f1908eb6e6d801005601000000005615deb798bb3e4dfa0139dfa1b3d433cc23b72fc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2b4e16d0168e52d35cacd2c6185b44281ec28c9dc3ede3eca2a72b3aecc820e955b36f38437d013950000000000000000000000" ); @@ -1377,9 +1377,9 @@ contract TychoRouterTest is TychoRouterTestSetup { vm.startPrank(ALICE); IERC20(USDC_ADDR).approve(PERMIT2_ADDRESS, type(uint256).max); // Encoded solution generated using `test_cyclic_split_swap` - // but manually replacing the executor address - // `dD8559c917393FC8DD2b4dD289c52Ff445fDE1B0` with the one in this test - // `2e234DAe75C793f67A35089C9d99245E1C58470b` + // but manually replacing the executor addresses with the ones in this test + // `dD8559c917393FC8DD2b4dD289c52Ff445fDE1B0` to `2e234DAe75C793f67A35089C9d99245E1C58470b` + // `f6c5be66FFf9DC69962d73da0A617a827c382329` to `5615deb798bb3e4dfa0139dfa1b3d433cc23b72f` (bool success,) = tychoRouterAddr.call( hex"d499aa880000000000000000000000000000000000000000000000000000000005f5e100000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005eea514000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000000000000000000000000067f6be9400000000000000000000000000000000000000000000000000000000000000000000000000000000000000003ede3eca2a72b3aecc820e955b36f38437d013950000000000000000000000000000000000000000000000000000000067cf389c000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000041c02ad8eceede50085f35ce8e8313ebbac9b379396c6e72a35bb4df0970cbdaaa1a91e6f787641af55b13b926199c844df42fdd2ae7bb287db7e5cc2a8bc1d7f51b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000136005600010000005615deb798bb3e4dfa0139dfa1b3d433cc23b72fa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48b4e16d0168e52d35cacd2c6185b44281ec28c9dc3ede3eca2a72b3aecc820e955b36f38437d0139501006d01009999992e234dae75c793f67a35089c9d99245e1c58470bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f43ede3eca2a72b3aecc820e955b36f38437d0139588e6a0c2ddd26feeb64f039a2c41296fcb3f564000006d01000000002e234dae75c793f67a35089c9d99245e1c58470bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000bb83ede3eca2a72b3aecc820e955b36f38437d013958ad599c3a0ff1de082011efddc58f1908eb6e6d80000000000000000000000" ); diff --git a/src/encoding/evm/strategy_encoder/strategy_encoders.rs b/src/encoding/evm/strategy_encoder/strategy_encoders.rs index 22d078f..91db180 100644 --- a/src/encoding/evm/strategy_encoder/strategy_encoders.rs +++ b/src/encoding/evm/strategy_encoder/strategy_encoders.rs @@ -206,7 +206,7 @@ impl StrategyEncoder for SplitSwapStrategyEncoder { } let encoded_swaps = self.ple_encode(swaps); - let tokens_len = if &solution.given_token == &solution.checked_token { + let tokens_len = if solution.given_token == solution.checked_token { tokens.len() - 1 } else { tokens.len() @@ -1306,11 +1306,11 @@ mod tests { fn test_split_input_cyclic_swap() { // This test has start and end tokens that are the same // The flow is: - // ┌─── WETH (USV3 Pool 1) ───┐ - // │ │ - // USDC (60% split) ─┤ ├─> USDC - // │ │ - // └─── WETH (USV3 Pool 2) ───┘ + // ┌─ (USV3, 60% split) ──> WETH ─┐ + // │ │ + // USDC ──────┤ ├──(USV2)──> USDC + // │ │ + // └─ (USV3, 40% split) ──> WETH ─┘ // Set up a mock private key for signing (Alice's pk in our router tests) let private_key = diff --git a/src/encoding/evm/strategy_encoder/strategy_validators.rs b/src/encoding/evm/strategy_encoder/strategy_validators.rs index 8ac5628..d4bf22f 100644 --- a/src/encoding/evm/strategy_encoder/strategy_validators.rs +++ b/src/encoding/evm/strategy_encoder/strategy_validators.rs @@ -143,16 +143,12 @@ impl SplitSwapValidator { // Build directed graph of token flows let mut graph: HashMap<&Bytes, HashSet<&Bytes>> = HashMap::new(); + let mut all_tokens = HashSet::new(); for swap in swaps { graph .entry(&swap.token_in) .or_default() .insert(&swap.token_out); - } - - // Collect all unique tokens from the swaps - let mut all_tokens = HashSet::new(); - for swap in swaps { all_tokens.insert(&swap.token_in); all_tokens.insert(&swap.token_out); } @@ -321,7 +317,7 @@ mod tests { }, token_in: usdc.clone(), token_out: weth.clone(), - split: 0.5, + split: 0f64, }, Swap { component: ProtocolComponent { @@ -331,7 +327,7 @@ mod tests { }, token_in: weth.clone(), token_out: usdc.clone(), - split: 0.5, + split: 0f64, }, ];