diff --git a/foundry/src/executors/Uniswapv2SwapExecutor.sol b/foundry/src/executors/Uniswapv2SwapExecutor.sol index c194c80..a6f8517 100644 --- a/foundry/src/executors/Uniswapv2SwapExecutor.sol +++ b/foundry/src/executors/Uniswapv2SwapExecutor.sol @@ -15,10 +15,9 @@ contract UniswapV2SwapExecutor is ISwapExecutor { address target; address receiver; bool zeroForOne; - bool exactOut; IERC20 tokenIn; - (tokenIn, target, receiver, zeroForOne, exactOut) = _decodeData(data); + (tokenIn, target, receiver, zeroForOne) = _decodeData(data); calculatedAmount = _getAmountOut(target, givenAmount, zeroForOne); tokenIn.safeTransfer(target, givenAmount); @@ -37,15 +36,13 @@ contract UniswapV2SwapExecutor is ISwapExecutor { IERC20 inToken, address target, address receiver, - bool zeroForOne, - bool exactOut + bool zeroForOne ) { inToken = IERC20(address(bytes20(data[0:20]))); target = address(bytes20(data[20:40])); receiver = address(bytes20(data[40:60])); zeroForOne = uint8(data[60]) > 0; - exactOut = uint8(data[61]) > 0; } function _getAmountOut(address target, uint256 amountIn, bool zeroForOne) diff --git a/foundry/test/executors/UniswapV2SwapExecutor.t.sol b/foundry/test/executors/UniswapV2SwapExecutor.t.sol index 4b9587a..88f99ea 100644 --- a/foundry/test/executors/UniswapV2SwapExecutor.t.sol +++ b/foundry/test/executors/UniswapV2SwapExecutor.t.sol @@ -13,8 +13,7 @@ contract UniswapV2SwapExecutorExposed is UniswapV2SwapExecutor { IERC20 inToken, address target, address receiver, - bool zeroForOne, - bool exactOut + bool zeroForOne ) { return _decodeData(data); @@ -49,21 +48,15 @@ contract UniswapV2SwapExecutorTest is function testDecodeParams() public view { bytes memory params = - abi.encodePacked(WETH_ADDR, address(2), address(3), false, true); + abi.encodePacked(WETH_ADDR, address(2), address(3), false); - ( - IERC20 tokenIn, - address target, - address receiver, - bool zeroForOne, - bool exactOut - ) = uniswapV2Exposed.decodeParams(params); + (IERC20 tokenIn, address target, address receiver, bool zeroForOne) = + uniswapV2Exposed.decodeParams(params); assertEq(address(tokenIn), WETH_ADDR); assertEq(target, address(2)); assertEq(receiver, address(3)); assertEq(zeroForOne, false); - assertEq(exactOut, true); } function testAmountOut() public view { @@ -88,10 +81,8 @@ contract UniswapV2SwapExecutorTest is uint256 amountIn = 10 ** 18; uint256 amountOut = 1847751195973566072891; bool zeroForOne = false; - bool exactOut = true; - bytes memory protocolData = abi.encodePacked( - WETH_ADDR, WETH_DAI_POOL, BOB, zeroForOne, exactOut - ); + bytes memory protocolData = + abi.encodePacked(WETH_ADDR, WETH_DAI_POOL, BOB, zeroForOne); vm.startPrank(ADMIN); deal(WETH_ADDR, address(uniswapV2Exposed), amountIn);