Files
tycho-execution/foundry/test/executors/UniswapV4Utils.sol
Diana Carvalho ec87969aa6 feat: Add transfer out for Uniswap V4
Add transfer in Executor and pass receiver address in encoding
This is done by using the TAKE action instead of TAKE_ALL

--- don't change below this line ---
ENG-4315 Took 1 hour 36 minutes

Took 2 minutes
2025-04-23 12:31:41 +01:00

31 lines
861 B
Solidity

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.26;
import "@src/executors/UniswapV4Executor.sol";
library UniswapV4Utils {
function encodeExactInput(
address tokenIn,
address tokenOut,
bool zeroForOne,
UniswapV4Executor.TransferType transferType,
address receiver,
UniswapV4Executor.UniswapV4Pool[] memory pools
) public pure returns (bytes memory) {
bytes memory encodedPools;
for (uint256 i = 0; i < pools.length; i++) {
encodedPools = abi.encodePacked(
encodedPools,
pools[i].intermediaryToken,
bytes3(pools[i].fee),
pools[i].tickSpacing
);
}
return abi.encodePacked(
tokenIn, tokenOut, zeroForOne, transferType, receiver, encodedPools
);
}
}