test: Add integration test for it

--- don't change below this line ---
ENG-4446 Took 12 minutes
This commit is contained in:
Diana Carvalho
2025-04-22 14:15:39 +01:00
parent df92be8875
commit cebacc68fe
2 changed files with 97 additions and 0 deletions

View File

@@ -367,4 +367,22 @@ contract TychoRouterSingleSwapTest is TychoRouterTestSetup {
assertTrue(success, "Call Failed");
assertEq(balanceAfter - balanceBefore, 1120007305574805922);
}
function testSingleSwapIntegrationNoTransferIn() public {
// Tests swapping WETH -> DAI on a USV2 pool assuming that the tokens are already inside the router
deal(WETH_ADDR, tychoRouterAddr, 1 ether);
uint256 balanceBefore = IERC20(DAI_ADDR).balanceOf(ALICE);
vm.startPrank(ALICE);
// Encoded solution generated using `test_single_swap_strategy_encoder_no_transfer_in`
(bool success,) = tychoRouterAddr.call(
hex"20144a070000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f00000000000000000000000000000000000000000000008f1d5c1cae3740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc2000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000525615deb798bb3e4dfa0139dfa1b3d433cc23b72fc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2a478c2975ab1ea89e8196811f51a7b7ade33eb11cd09f75e2bf2a4d11f3ab23f1389fcc1621c0cc200000000000000000000000000000000"
);
vm.stopPrank();
uint256 balanceAfter = IERC20(DAI_ADDR).balanceOf(ALICE);
assertTrue(success, "Call Failed");
assertEq(balanceAfter - balanceBefore, 2659881924818443699787);
}
}