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
This commit is contained in:
Diana Carvalho
2025-02-13 18:40:10 +00:00
parent bb7c6c25a5
commit be7883affc
5 changed files with 182 additions and 140 deletions

View File

@@ -857,15 +857,22 @@ contract TychoRouterTest is TychoRouterTestSetup {
uint256 amountIn = 100 ether;
deal(USDE_ADDR, tychoRouterAddr, amountIn);
bytes memory protocolData = UniswapV4Utils.encodeExactInputSingle(
USDE_ADDR, USDT_ADDR, 100, true, 1, uint128(amountIn)
);
UniswapV4Executor.UniswapV4Pool[] memory pools =
new UniswapV4Executor.UniswapV4Pool[](1);
pools[0] = UniswapV4Executor.UniswapV4Pool({
intermediaryToken: USDT_ADDR,
fee: uint24(100),
tickSpacing: int24(1)
});
// add executor and selector for callback
bytes memory protocolDataWithCallBack = abi.encodePacked(
protocolData,
bytes memory protocolData = UniswapV4Utils.encodeExactInputSingle(
USDE_ADDR,
USDT_ADDR,
uint256(1),
true,
address(usv4Executor),
SafeCallback.unlockCallback.selector,
address(usv4Executor)
pools
);
bytes memory swap = encodeSwap(
@@ -874,7 +881,7 @@ contract TychoRouterTest is TychoRouterTestSetup {
uint24(0),
address(usv4Executor),
bytes4(0),
protocolDataWithCallBack
protocolData
);
bytes[] memory swaps = new bytes[](1);