diff --git a/foundry/test/TychoRouterProtocolIntegration.t.sol b/foundry/test/TychoRouterProtocolIntegration.t.sol index baf8c9d..441c133 100644 --- a/foundry/test/TychoRouterProtocolIntegration.t.sol +++ b/foundry/test/TychoRouterProtocolIntegration.t.sol @@ -192,7 +192,6 @@ contract TychoRouterTestProtocolIntegration is TychoRouterTestSetup { deal(GHO_ADDR, ALICE, 1 ether); uint256 balanceBefore = IERC20(USDC_ADDR).balanceOf(ALICE); - // Approve permit2 vm.startPrank(ALICE); IERC20(GHO_ADDR).approve(tychoRouterAddr, type(uint256).max); diff --git a/foundry/test/assets/calldata.txt b/foundry/test/assets/calldata.txt index 320a1fd..2ebfdc5 100644 --- a/foundry/test/assets/calldata.txt +++ b/foundry/test/assets/calldata.txt @@ -25,3 +25,4 @@ test_ekubo_encode_swap_multi:00ca4f73fe97d0b987a0d12b39bbd562c779bab6f6000000000 test_encode_uniswap_v4_sequential_swap:4c9edd5852cd905f086c759e8383e09bff1e68b32260fac5e5542a773aa44fbcfedf7c193bc2c5990100cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2dac17f958d2ee523a2206206994597c13d831ec70000640000012260fac5e5542a773aa44fbcfedf7c193bc2c599000bb800003c test_encode_uniswap_v4_simple_swap:4c9edd5852cd905f086c759e8383e09bff1e68b3dac17f958d2ee523a2206206994597c13d831ec70100cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2dac17f958d2ee523a2206206994597c13d831ec7000064000001 test_single_encoding_strategy_maverick:20144a070000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000040d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc200000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000051a4ad4f68d0b91cfd19687c881e50f3a00242828c40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f14cf6d2fe3e1b326114b07d22a6f6bb59e346c67cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc201000000000000000000000000000000 +test_encode_maverick_v2:40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f14cf6d2fe3e1b326114b07d22a6f6bb59e346c671d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e00 diff --git a/foundry/test/executors/MaverickV2Executor.t.sol b/foundry/test/executors/MaverickV2Executor.t.sol index ba08663..755570d 100644 --- a/foundry/test/executors/MaverickV2Executor.t.sol +++ b/foundry/test/executors/MaverickV2Executor.t.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.26; import "@src/executors/MaverickV2Executor.sol"; -import {Test} from "../../lib/forge-std/src/Test.sol"; import {Constants} from "../Constants.sol"; +import "../TestUtils.sol"; contract MaverickV2ExecutorExposed is MaverickV2Executor { constructor(address _factory, address _permit2) @@ -24,7 +24,7 @@ contract MaverickV2ExecutorExposed is MaverickV2Executor { } } -contract MaverickV2ExecutorTest is Test, Constants { +contract MaverickV2ExecutorTest is TestUtils, Constants { using SafeERC20 for IERC20; MaverickV2ExecutorExposed maverickV2Exposed; @@ -92,7 +92,7 @@ contract MaverickV2ExecutorTest is Test, Constants { function testDecodeIntegration() public view { // Generated by the SwapEncoder - test_encode_maverick_v2 bytes memory protocolData = - hex"40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f14cf6d2fe3e1b326114b07d22a6f6bb59e346c671d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e00"; + loadCallDataFromFile("test_encode_maverick_v2"); ( IERC20 tokenIn, @@ -113,7 +113,7 @@ contract MaverickV2ExecutorTest is Test, Constants { function testSwapIntegration() public { // Generated by the SwapEncoder - test_encode_maverick_v2 bytes memory protocolData = - hex"40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f14cf6d2fe3e1b326114b07d22a6f6bb59e346c671d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e00"; + loadCallDataFromFile("test_encode_maverick_v2"); uint256 amountIn = 10 ** 18; deal(GHO_ADDR, address(maverickV2Exposed), amountIn); diff --git a/src/encoding/evm/swap_encoder/swap_encoders.rs b/src/encoding/evm/swap_encoder/swap_encoders.rs index b419809..5fb82fe 100644 --- a/src/encoding/evm/swap_encoder/swap_encoders.rs +++ b/src/encoding/evm/swap_encoder/swap_encoders.rs @@ -643,6 +643,7 @@ mod tests { models::{protocol::ProtocolComponent, Chain as TychoCoreChain}, Bytes, }; + use crate::encoding::evm::utils::write_calldata_to_file; use super::*; use crate::encoding::models::TransferType; @@ -1595,5 +1596,7 @@ mod tests { )) .to_lowercase() ); + + write_calldata_to_file("test_encode_maverick_v2", hex_swap.as_str()); } }