feat: Support uniswap v4 callback in TychoRouter

Make TychoRouter inherit from SafeCallback and then delegatecall to the UniswapV4 executor
Add a test for this. I had to update the block of our forked network in the tests. Because of this I had to update all the asserts in previous tests

Had to change the optimizer_runs in foundry.toml because of weird Yul errors when compiling

--- don't change below this line ---
ENG-4223 Took 1 hour 21 minutes

Took 7 seconds


Took 35 seconds
This commit is contained in:
Diana Carvalho
2025-02-12 19:30:21 +00:00
parent 29eb50d0a1
commit 591d73ba71
7 changed files with 101 additions and 30 deletions

View File

@@ -83,7 +83,7 @@ contract BalancerV2ExecutorTest is
assertEq(balanceAfter - balanceBefore, amountOut);
}
function testDecodeIntegration() public {
function testDecodeIntegration() public view {
// Generated by the SwapEncoder - test_encode_balancer_v2
bytes memory protocolData =
hex"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2ba100000625a3754423978a60c9317c58a424e3d5c6ee304399dbdb9c8ef030ab642b10820db8f560002000000000000000000141d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e01";

View File

@@ -94,7 +94,7 @@ contract UniswapV2ExecutorTest is UniswapV2ExecutorExposed, Test, Constants {
assertGe(finalBalance, amountOut);
}
function testDecodeIntegration() public {
function testDecodeIntegration() public view {
// Generated by the ExecutorStrategyEncoder - test_executor_strategy_encode
bytes memory protocolData =
hex"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc288e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000000000000000000100";

View File

@@ -8,7 +8,6 @@ library UniswapV4Utils {
address tokenIn,
address tokenOut,
uint24 fee,
address receiver,
bool zeroForOne,
uint24 tickSpacing,
uint128 amountIn
@@ -24,7 +23,7 @@ library UniswapV4Utils {
bytes memory actions = abi.encodePacked(
uint8(Actions.SWAP_EXACT_IN_SINGLE),
uint8(Actions.SETTLE_ALL),
uint8(Actions.TAKE)
uint8(Actions.TAKE_ALL)
);
bytes[] memory params = new bytes[](3);
@@ -40,7 +39,7 @@ library UniswapV4Utils {
);
params[1] = abi.encode(key.currency0, amountIn);
params[2] = abi.encode(key.currency1, receiver, 0);
params[2] = abi.encode(key.currency1, 0);
return abi.encode(actions, params);
}