From f4d3fe75e8325d9af2c72c9a5f01198bedc02fa3 Mon Sep 17 00:00:00 2001 From: adrian Date: Thu, 21 Aug 2025 11:20:06 +0200 Subject: [PATCH] test: fix executor tests after removing the effectiveTrader field --- foundry/test/assets/calldata.txt | 1 + foundry/test/protocols/Hashflow.t.sol | 72 +++++------ .../optimized_transfers_integration_tests.rs | 104 ---------------- tests/protocol_integration_tests.rs | 113 +++++++++++++++++- 4 files changed, 147 insertions(+), 143 deletions(-) diff --git a/foundry/test/assets/calldata.txt b/foundry/test/assets/calldata.txt index ada2ac5..41520f7 100644 --- a/foundry/test/assets/calldata.txt +++ b/foundry/test/assets/calldata.txt @@ -40,3 +40,4 @@ test_sequential_swap_strategy_encoder_unwrap:51bcc7b6000000000000000000000000000 test_sequential_swap_usx:0101e21dd0d300000000000000000000000000000000000000000000006c6b935b8bbd4000000000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000769cfd80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006d9da78b6a5bedca287aa5d49613ba36b90c15c40000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000d600692e234dae75c793f67a35089c9d99245e1c58470b6b175474e89094c44da98b954eedeac495271d0fa0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000643ede3eca2a72b3aecc820e955b36f38437d013955777d92f208679db4b9778590fa3cab3ac9e2168010000692e234dae75c793f67a35089c9d99245e1c58470ba0b86991c6218b36c1d19d4a2e9eb0ce3606eb48dac17f958d2ee523a2206206994597c13d831ec70000646d9da78b6a5bedca287aa5d49613ba36b90c15c43416cf6c708da44db2624d63ea0aaef7113527c6010100000000000000000000 test_uniswap_v3_hashflow:e21dd0d30000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000000000000000000000000000000000000038aebf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc20000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001c800692e234dae75c793f67a35089c9d99245e1c58470bc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480001f43ede3eca2a72b3aecc820e955b36f38437d0139588e6a0c2ddd26feeb64f039a2c41296fcb3f56400000015b15cf58144ef33af1e14b5208015d11f9143e27b90201478eca1b93865dca0b9f325935eb123c8a4af011bee3211ab312a8d065c4fef0247448e17a8da000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2a0b86991c6218b36c1d19d4a2e9eb0ce3606eb482260fac5e5542a773aa44fbcfedf7c193bc2c5990000000000000000000000000000000000000000000000000000000100c84f11000000000000000000000000000000000000000000000000000000000038aebf0000000000000000000000000000000000000000000000000000000068a47cd800000000000000000000000000000000000000000000000000000198c286fecb125000064000640000001747eb8c38ffffffffffffff0029642016edb36d00006ddb3b21fe8509e274ddf46c55209cdbf30360944abbca6569ed6b26740d052f419964dcb5a3bdb98b4ed1fb3642a2760b8312118599a962251f7a8f73fe4fbe1c000000000000000000000000000000000000000000000000 test_hashflow:5c4b639c0000000000000000000000000000000000000000000000000000000100c84f11000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000000000000000000000000000000000000038aebf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000015b15cf58144ef33af1e14b5208015d11f9143e27b90001478eca1b93865dca0b9f325935eb123c8a4af011bee3211ab312a8d065c4fef0247448e17a8da000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2a0b86991c6218b36c1d19d4a2e9eb0ce3606eb482260fac5e5542a773aa44fbcfedf7c193bc2c5990000000000000000000000000000000000000000000000000000000100c84f11000000000000000000000000000000000000000000000000000000000038aebf0000000000000000000000000000000000000000000000000000000068a47cd800000000000000000000000000000000000000000000000000000198c286fecb125000064000640000001747eb8c38ffffffffffffff0029642016edb36d00006ddb3b21fe8509e274ddf46c55209cdbf30360944abbca6569ed6b26740d052f419964dcb5a3bdb98b4ed1fb3642a2760b8312118599a962251f7a8f73fe4fbe1c0000000000 +test_single_encoding_strategy_hashflow:5c4b639c0000000000000000000000000000000000000000000000000000000100c84f11000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599000000000000000000000000000000000000000000000000000000000038aebf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000015b15cf58144ef33af1e14b5208015d11f9143e27b90001478eca1b93865dca0b9f325935eb123c8a4af011bee3211ab312a8d065c4fef0247448e17a8da000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2a0b86991c6218b36c1d19d4a2e9eb0ce3606eb482260fac5e5542a773aa44fbcfedf7c193bc2c5990000000000000000000000000000000000000000000000000000000100c84f11000000000000000000000000000000000000000000000000000000000038aebf0000000000000000000000000000000000000000000000000000000068a47cd800000000000000000000000000000000000000000000000000000198c286fecb125000064000640000001747eb8c38ffffffffffffff0029642016edb36d00006ddb3b21fe8509e274ddf46c55209cdbf30360944abbca6569ed6b26740d052f419964dcb5a3bdb98b4ed1fb3642a2760b8312118599a962251f7a8f73fe4fbe1c0000000000 diff --git a/foundry/test/protocols/Hashflow.t.sol b/foundry/test/protocols/Hashflow.t.sol index d0dc905..dee68d8 100644 --- a/foundry/test/protocols/Hashflow.t.sol +++ b/foundry/test/protocols/Hashflow.t.sol @@ -20,7 +20,6 @@ contract HashflowUtils is Test { quote.pool, // pool (20 bytes) quote.externalAccount, // externalAccount (20 bytes) quote.trader, // trader (20 bytes) - quote.effectiveTrader, // effectiveTrader (20 bytes) quote.baseToken, // baseToken (20 bytes) quote.quoteToken, // quoteToken (20 bytes) quote.baseTokenAmount, // baseTokenAmount (32 bytes) @@ -52,7 +51,7 @@ contract HashflowExecutorECR20Test is Constants, HashflowUtils { IERC20 USDC = IERC20(USDC_ADDR); function setUp() public { - forkBlock = 23124977; // Using expiry date: 1755001853, ECR20 + forkBlock = 23188416; // Using expiry date: 1755766775, ECR20 vm.createSelectFork("mainnet", forkBlock); executor = new HashflowExecutorExposed(HASHFLOW_ROUTER, PERMIT2_ADDRESS); } @@ -124,54 +123,54 @@ contract HashflowExecutorECR20Test is Constants, HashflowUtils { } function testSwapNoSlippage() public { - address trader = address(executor); + address trader = address(ALICE); IHashflowRouter.RFQTQuote memory quote = rfqtQuote(); uint256 amountIn = quote.baseTokenAmount; bytes memory encodedQuote = encodeRfqtQuoteWithDefaults(quote); - deal(USDC_ADDR, address(executor), amountIn); - uint256 balanceBefore = WETH.balanceOf(trader); + deal(WETH_ADDR, address(executor), amountIn); + uint256 balanceBefore = USDC.balanceOf(trader); vm.prank(trader); uint256 amountOut = executor.swap(amountIn, encodedQuote); - uint256 balanceAfter = WETH.balanceOf(trader); + uint256 balanceAfter = USDC.balanceOf(trader); assertGt(balanceAfter, balanceBefore); assertEq(balanceAfter - balanceBefore, amountOut); assertEq(amountOut, quote.quoteTokenAmount); } function testSwapRouterAmountUnderQuoteAmount() public { - address trader = address(executor); + address trader = address(ALICE); IHashflowRouter.RFQTQuote memory quote = rfqtQuote(); uint256 amountIn = quote.baseTokenAmount - 1; bytes memory encodedQuote = encodeRfqtQuoteWithDefaults(quote); - deal(USDC_ADDR, address(executor), amountIn); - uint256 balanceBefore = WETH.balanceOf(trader); + deal(WETH_ADDR, address(executor), amountIn); + uint256 balanceBefore = USDC.balanceOf(trader); vm.prank(trader); uint256 amountOut = executor.swap(amountIn, encodedQuote); - uint256 balanceAfter = WETH.balanceOf(trader); + uint256 balanceAfter = USDC.balanceOf(trader); assertGt(balanceAfter, balanceBefore); assertEq(balanceAfter - balanceBefore, amountOut); assertLt(amountOut, quote.quoteTokenAmount); } function testSwapRouterAmountOverQuoteAmount() public { - address trader = address(executor); + address trader = address(ALICE); IHashflowRouter.RFQTQuote memory quote = rfqtQuote(); uint256 amountIn = quote.baseTokenAmount + 1; bytes memory encodedQuote = encodeRfqtQuoteWithDefaults(quote); - deal(USDC_ADDR, address(executor), amountIn); - uint256 balanceBefore = WETH.balanceOf(trader); + deal(WETH_ADDR, address(executor), amountIn); + uint256 balanceBefore = USDC.balanceOf(trader); vm.prank(trader); uint256 amountOut = executor.swap(amountIn, encodedQuote); - uint256 balanceAfter = WETH.balanceOf(trader); + uint256 balanceAfter = USDC.balanceOf(trader); assertGt(balanceAfter, balanceBefore); assertEq(balanceAfter - balanceBefore, amountOut); assertEq(amountOut, quote.quoteTokenAmount); @@ -183,23 +182,23 @@ contract HashflowExecutorECR20Test is Constants, HashflowUtils { returns (IHashflowRouter.RFQTQuote memory) { return IHashflowRouter.RFQTQuote({ - pool: address(0x4cE18FD7b44F40Aebd6911362d3AC25F14D5007f), - externalAccount: address(0x50C03775C8E5b6227F1E00C4b3e479b4A7C57983), - trader: address(executor), + pool: address(0x5d8853028fbF6a2da43c7A828cc5f691E9456B44), + externalAccount: address(0x9bA0CF1588E1DFA905eC948F7FE5104dD40EDa31), + trader: address(ALICE), effectiveTrader: address(ALICE), - baseToken: USDC_ADDR, - quoteToken: WETH_ADDR, + baseToken: WETH_ADDR, + quoteToken: USDC_ADDR, effectiveBaseTokenAmount: 0, - baseTokenAmount: 100, - quoteTokenAmount: 23224549208, - quoteExpiry: 1755001853, - nonce: 1755001793084, + baseTokenAmount: 1000000000000000000, + quoteTokenAmount: 4286117034, + quoteExpiry: 1755766775, + nonce: 1755766744988, txid: bytes32( uint256( - 0x12500006400064000000174813b960ffffffffffffff00293fdb4569fe760000 + 0x12500006400064000186078c183380ffffffffffffff00296d737ff6ae950000 ) ), - signature: hex"5b26977fecaf794c3d6900b9523b9632b5c62623f92732347dc9f24d8b5c4d611f5d733bbe82b594b6b47ab8aa1923c9f6b8aa66ef822ce412a767200f1520e11b" + signature: hex"649d31cd74f1b11b4a3b32bd38c2525d78ce8f23bc2eaf7700899c3a396d3a137c861737dc780fa154699eafb3108a34cbb2d4e31a6f0623c169cc19e0fa296a1c" }); } } @@ -214,13 +213,13 @@ contract HashflowExecutorNativeTest is Constants, HashflowUtils { IERC20 USDC = IERC20(USDC_ADDR); function setUp() public { - forkBlock = 23125321; // Using expiry date: 1755006017, Native + forkBlock = 23188504; // Using expiry date: 1755767859, Native vm.createSelectFork("mainnet", forkBlock); executor = new HashflowExecutorExposed(HASHFLOW_ROUTER, PERMIT2_ADDRESS); } function testSwapNoSlippage() public { - address trader = address(executor); + address trader = address(ALICE); IHashflowRouter.RFQTQuote memory quote = rfqtQuote(); uint256 amountIn = quote.baseTokenAmount; bytes memory encodedQuote = encodeRfqtQuoteWithDefaults(quote); @@ -243,23 +242,23 @@ contract HashflowExecutorNativeTest is Constants, HashflowUtils { returns (IHashflowRouter.RFQTQuote memory) { return IHashflowRouter.RFQTQuote({ - pool: address(0x51199bE500A8c59262478b621B1096F17638dc6F), - externalAccount: address(0xCe79b081c0c924cb67848723ed3057234d10FC6b), - trader: address(executor), + pool: address(0x713DC4Df480235dBe2fB766E7120Cbd4041Dcb58), + externalAccount: address(0x111BB8c3542F2B92fb41B8d913c01D3788431111), + trader: address(ALICE), effectiveTrader: address(ALICE), baseToken: address(0x0000000000000000000000000000000000000000), quoteToken: USDC_ADDR, effectiveBaseTokenAmount: 0, baseTokenAmount: 10000000000000000, - quoteTokenAmount: 43930745, - quoteExpiry: 1755006017, - nonce: 1755005977455, + quoteTokenAmount: 42586008, + quoteExpiry: 1755767859, + nonce: 1755767819299, txid: bytes32( uint256( - 0x1250000640006400019071ef777818ffffffffffffff0029401b1bc51da00000 + 0x1250000640006400018380fd594810ffffffffffffff00296d83e467cddd0000 ) ), - signature: hex"4c3554c928e4b15cd53d1047aee69a66103effa5107047b84949e48460b6978f25da9ad5b9ed31aa9ab2130e597fabea872f14b8c1b166ea079413cbaf2f4b4c1c" + signature: hex"63c1c9c7d6902d1d4d2ae82777015433ef08366dde1c579a8c4cbc01059166064246f61f15b2cb130be8f2b28ea40d2c3586ef0133647fefa30003e70ffbd6131b" }); } } @@ -302,7 +301,8 @@ contract TychoRouterSingleSwapTestForHashflow is TychoRouterTestSetup { vm.startPrank(ALICE); IERC20(USDC_ADDR).approve(tychoRouterAddr, type(uint256).max); - bytes memory callData = loadCallDataFromFile("test_hashflow"); + bytes memory callData = + loadCallDataFromFile("test_single_encoding_strategy_hashflow"); (bool success,) = tychoRouterAddr.call(callData); vm.stopPrank(); diff --git a/tests/optimized_transfers_integration_tests.rs b/tests/optimized_transfers_integration_tests.rs index b3a157e..61c3709 100644 --- a/tests/optimized_transfers_integration_tests.rs +++ b/tests/optimized_transfers_integration_tests.rs @@ -711,110 +711,6 @@ fn test_uniswap_v3_bebop() { write_calldata_to_file("test_uniswap_v3_bebop", hex_calldata.as_str()); } -#[test] -fn test_hashflow() { - // Note: This test does not assert anything. It is only used to obtain - // integration test data for our router solidity test. - // - // Performs a swap from USDC to WBTC using Hashflow RFQ - // - // USDC ───(Hashflow RFQ)──> WBTC - - let usdc = usdc(); - let wbtc = wbtc(); - - // USDC -> WBTC via Hashflow RFQ using real order data - let quote_amount_out = BigUint::from_str("3714751").unwrap(); - - let hashflow_state = MockRFQState { - quote_amount_out, - quote_data: HashMap::from([ - ( - "pool".to_string(), - Bytes::from_str("0x478eca1b93865dca0b9f325935eb123c8a4af011").unwrap(), - ), - ( - "external_account".to_string(), - Bytes::from_str("0xbee3211ab312a8d065c4fef0247448e17a8da000").unwrap(), - ), - ( - "trader".to_string(), - Bytes::from_str("0xcd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2").unwrap(), - ), - ( - "base_token".to_string(), - Bytes::from_str("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48").unwrap(), - ), - ( - "quote_token".to_string(), - Bytes::from_str("0x2260fac5e5542a773aa44fbcfedf7c193bc2c599").unwrap(), - ), - ( - "base_token_amount".to_string(), - Bytes::from(biguint_to_u256(&BigUint::from(4308094737_u64)).to_be_bytes::<32>().to_vec()), - ), - ( - "quote_token_amount".to_string(), - Bytes::from(biguint_to_u256(&BigUint::from(3714751_u64)).to_be_bytes::<32>().to_vec()), - ), - ("quote_expiry".to_string(), Bytes::from(biguint_to_u256(&BigUint::from(1755610328_u64)).to_be_bytes::<32>().to_vec())), - ("nonce".to_string(), Bytes::from(biguint_to_u256(&BigUint::from(1755610283723_u64)).to_be_bytes::<32>().to_vec())), - ( - "tx_id".to_string(), - Bytes::from_str( - "0x125000064000640000001747eb8c38ffffffffffffff0029642016edb36d0000", - ) - .unwrap(), - ), - ("signature".to_string(), Bytes::from_str("0x6ddb3b21fe8509e274ddf46c55209cdbf30360944abbca6569ed6b26740d052f419964dcb5a3bdb98b4ed1fb3642a2760b8312118599a962251f7a8f73fe4fbe1c").unwrap()), - ]), - }; - - let hashflow_component = ProtocolComponent { - id: String::from("hashflow-rfq"), - protocol_system: String::from("rfq:hashflow"), - ..Default::default() - }; - - let swap_usdc_wbtc = SwapBuilder::new(hashflow_component, usdc.clone(), wbtc.clone()) - .estimated_amount_in(BigUint::from_str("4308094737").unwrap()) - .protocol_state(&hashflow_state) - .build(); - - let encoder = get_tycho_router_encoder(UserTransferType::TransferFrom); - - let solution = Solution { - exact_out: false, - given_token: usdc, - given_amount: BigUint::from_str("4308094737").unwrap(), - checked_token: wbtc, - checked_amount: BigUint::from_str("3714751").unwrap(), - sender: alice_address(), - receiver: alice_address(), - swaps: vec![swap_usdc_wbtc], - ..Default::default() - }; - - let encoded_solution = encoder - .encode_solutions(vec![solution.clone()]) - .unwrap()[0] - .clone(); - - let calldata = encode_tycho_router_call( - eth_chain().id(), - encoded_solution, - &solution, - &UserTransferType::TransferFrom, - ð(), - None, - ) - .unwrap() - .data; - - let hex_calldata = encode(&calldata); - write_calldata_to_file("test_hashflow", hex_calldata.as_str()); -} - #[test] #[ignore] fn test_uniswap_v3_hashflow() { diff --git a/tests/protocol_integration_tests.rs b/tests/protocol_integration_tests.rs index b0b416c..fb13bc7 100644 --- a/tests/protocol_integration_tests.rs +++ b/tests/protocol_integration_tests.rs @@ -5,13 +5,16 @@ use alloy::{hex, hex::encode}; use num_bigint::{BigInt, BigUint}; use tycho_common::{models::protocol::ProtocolComponent, Bytes}; use tycho_execution::encoding::{ - evm::utils::{biguint_to_u256, write_calldata_to_file}, + evm::{ + testing_utils::MockRFQState, + utils::{biguint_to_u256, write_calldata_to_file}, + }, models::{Solution, Swap, SwapBuilder, UserTransferType}, }; use crate::common::{ - build_bebop_calldata, encoding::encode_tycho_router_call, eth, eth_chain, get_signer, - get_tycho_router_encoder, ondo, pepe, usdc, weth, + alice_address, build_bebop_calldata, encoding::encode_tycho_router_call, eth, eth_chain, + get_signer, get_tycho_router_encoder, ondo, pepe, usdc, wbtc, weth, }; #[test] @@ -714,3 +717,107 @@ fn test_single_encoding_strategy_bebop_aggregate() { write_calldata_to_file("test_single_encoding_strategy_bebop_aggregate", hex_calldata.as_str()); } + +#[test] +fn test_single_encoding_strategy_hashflow() { + // Note: This test does not assert anything. It is only used to obtain + // integration test data for our router solidity test. + // + // Performs a swap from USDC to WBTC using Hashflow RFQ + // + // USDC ───(Hashflow RFQ)──> WBTC + + let usdc = usdc(); + let wbtc = wbtc(); + + // USDC -> WBTC via Hashflow RFQ using real order data + let quote_amount_out = BigUint::from_str("3714751").unwrap(); + + let hashflow_state = MockRFQState { + quote_amount_out, + quote_data: HashMap::from([ + ( + "pool".to_string(), + Bytes::from_str("0x478eca1b93865dca0b9f325935eb123c8a4af011").unwrap(), + ), + ( + "external_account".to_string(), + Bytes::from_str("0xbee3211ab312a8d065c4fef0247448e17a8da000").unwrap(), + ), + ( + "trader".to_string(), + Bytes::from_str("0xcd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2").unwrap(), + ), + ( + "base_token".to_string(), + Bytes::from_str("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48").unwrap(), + ), + ( + "quote_token".to_string(), + Bytes::from_str("0x2260fac5e5542a773aa44fbcfedf7c193bc2c599").unwrap(), + ), + ( + "base_token_amount".to_string(), + Bytes::from(biguint_to_u256(&BigUint::from(4308094737_u64)).to_be_bytes::<32>().to_vec()), + ), + ( + "quote_token_amount".to_string(), + Bytes::from(biguint_to_u256(&BigUint::from(3714751_u64)).to_be_bytes::<32>().to_vec()), + ), + ("quote_expiry".to_string(), Bytes::from(biguint_to_u256(&BigUint::from(1755610328_u64)).to_be_bytes::<32>().to_vec())), + ("nonce".to_string(), Bytes::from(biguint_to_u256(&BigUint::from(1755610283723_u64)).to_be_bytes::<32>().to_vec())), + ( + "tx_id".to_string(), + Bytes::from_str( + "0x125000064000640000001747eb8c38ffffffffffffff0029642016edb36d0000", + ) + .unwrap(), + ), + ("signature".to_string(), Bytes::from_str("0x6ddb3b21fe8509e274ddf46c55209cdbf30360944abbca6569ed6b26740d052f419964dcb5a3bdb98b4ed1fb3642a2760b8312118599a962251f7a8f73fe4fbe1c").unwrap()), + ]), + }; + + let hashflow_component = ProtocolComponent { + id: String::from("hashflow-rfq"), + protocol_system: String::from("rfq:hashflow"), + ..Default::default() + }; + + let swap_usdc_wbtc = SwapBuilder::new(hashflow_component, usdc.clone(), wbtc.clone()) + .estimated_amount_in(BigUint::from_str("4308094737").unwrap()) + .protocol_state(&hashflow_state) + .build(); + + let encoder = get_tycho_router_encoder(UserTransferType::TransferFrom); + + let solution = Solution { + exact_out: false, + given_token: usdc, + given_amount: BigUint::from_str("4308094737").unwrap(), + checked_token: wbtc, + checked_amount: BigUint::from_str("3714751").unwrap(), + sender: alice_address(), + receiver: alice_address(), + swaps: vec![swap_usdc_wbtc], + ..Default::default() + }; + + let encoded_solution = encoder + .encode_solutions(vec![solution.clone()]) + .unwrap()[0] + .clone(); + + let calldata = encode_tycho_router_call( + eth_chain().id(), + encoded_solution, + &solution, + &UserTransferType::TransferFrom, + ð(), + None, + ) + .unwrap() + .data; + + let hex_calldata = encode(&calldata); + write_calldata_to_file("test_single_encoding_strategy_hashflow", hex_calldata.as_str()); +}