Files
tycho-execution/foundry/test/protocols/UniswapV4Utils.sol
Diana Carvalho a0581773cd feat: Support hooks (without special calldata)
Add hook address to encoded data and then use it in execution
Add execution test for Euler

Took 1 hour 19 minutes

Took 2 hours 40 minutes

Took 3 minutes


Took 2 minutes
2025-06-23 15:44:26 +01:00

38 lines
964 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,
RestrictTransferFrom.TransferType transferType,
address receiver,
address hook,
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,
hook,
encodedPools
);
}
}