From 783308642524cf917b9870188707318959407a10 Mon Sep 17 00:00:00 2001 From: royvardhan Date: Wed, 5 Mar 2025 22:20:16 +0530 Subject: [PATCH] fix: TychoRouter swap check test naming and docs --- foundry/test/TychoRouter.t.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/foundry/test/TychoRouter.t.sol b/foundry/test/TychoRouter.t.sol index 8af50ad..c1795c0 100644 --- a/foundry/test/TychoRouter.t.sol +++ b/foundry/test/TychoRouter.t.sol @@ -420,9 +420,9 @@ contract TychoRouterTest is TychoRouterTestSetup { // Checks amount out at the end uint256 amountIn = 1 ether; - // Approve the tokenIn to be transferred to the router deal(WETH_ADDR, ALICE, amountIn); vm.startPrank(ALICE); + // Approve the tokenIn to be transferred to the router IERC20(WETH_ADDR).approve(address(tychoRouterAddr), amountIn); bytes memory protocolData = encodeUniswapV2Swap( @@ -459,12 +459,12 @@ contract TychoRouterTest is TychoRouterTestSetup { function testSwapCheckedLessApprovalFailure() public { // Trade 1 WETH for DAI with 1 swap on Uniswap V2 - // Checks amount out at the end + // Fails while transferring the tokenIn to the router due to insufficient approval uint256 amountIn = 1 ether; - // Approve less than the amountIn deal(WETH_ADDR, ALICE, amountIn); vm.startPrank(ALICE); + // Approve less than the amountIn IERC20(WETH_ADDR).approve(address(tychoRouterAddr), amountIn - 1); bytes memory protocolData = encodeUniswapV2Swap( @@ -494,7 +494,7 @@ contract TychoRouterTest is TychoRouterTestSetup { vm.stopPrank(); } - function testSwapCheckedFailure() public { + function testSwapCheckedNegativeSlippageFailure() public { // Trade 1 WETH for DAI with 1 swap on Uniswap V2 // Does permit2 token approval and transfer // Checks amount out at the end and fails