Files
tycho-execution/foundry/test/executors/UniswapV4Utils.sol
Diana Carvalho be7883affc feat(univ4): Refactor input and handle single swap case
Construct the uniswap v4 specific objects inside the executor
The swap test in the executor alone doesn't work anymore because of the callback data prepended to the rest of he calldata

--- don't change below this line ---
ENG-4222 Took 4 hours 0 minutes


Took 40 seconds
2025-02-14 12:02:07 +00:00

38 lines
993 B
Solidity

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
import "@src/executors/UniswapV4Executor.sol";
library UniswapV4Utils {
function encodeExactInputSingle(
address tokenIn,
address tokenOut,
uint256 amountOutMin,
bool zeroForOne,
address callbackExecutor,
bytes4 callbackSelector,
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,
amountOutMin,
zeroForOne,
callbackExecutor,
bytes4(callbackSelector),
encodedPools
);
}
}