feat: Support Ekubo callback in TychoRouter

- add integration test
- cannot directly call _handleCallback from the locked method of the tycho router because of bytes memory to bytes callback conversion
- Rename to EkuboPoolKey because of conflict with USV4 pool key

- Bonus: fix bug where input token to swap method must be ERC20 (we should also support ETH)
This commit is contained in:
TAMARA LIPOWSKI
2025-03-27 23:38:32 +01:00
parent 393f1f9472
commit b3078f9c7b
9 changed files with 120 additions and 10 deletions

View File

@@ -10,6 +10,7 @@ import "@src/TychoRouter.sol";
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
import {WETH} from "../lib/permit2/lib/solmate/src/tokens/WETH.sol";
import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol";
import "../src/executors/EkuboExecutor.sol";
contract TychoRouterExposed is TychoRouter {
constructor(address _permit2, address weth) TychoRouter(_permit2, weth) {}
@@ -38,6 +39,7 @@ contract TychoRouterTestSetup is Test, Constants {
UniswapV3Executor public usv3Executor;
UniswapV3Executor public pancakev3Executor;
UniswapV4Executor public usv4Executor;
EkuboExecutor public ekuboExecutor;
MockERC20[] tokens;
function setUp() public {
@@ -52,6 +54,8 @@ contract TychoRouterTestSetup is Test, Constants {
bytes32 initCodeV3 = USV3_POOL_CODE_INIT_HASH;
bytes32 initCodePancakeV3 = PANCAKEV3_POOL_CODE_INIT_HASH;
address poolManagerAddress = 0x000000000004444c5dc75cB358380D2e3dE08A90;
ICore ekuboCore = ICore(0xe0e0e08A6A4b9Dc7bD67BCB7aadE5cF48157d444);
IPoolManager poolManager = IPoolManager(poolManagerAddress);
tychoRouter = new TychoRouterExposed(PERMIT2_ADDRESS, WETH_ADDR);
tychoRouterAddr = address(tychoRouter);
@@ -70,12 +74,14 @@ contract TychoRouterTestSetup is Test, Constants {
usv4Executor = new UniswapV4Executor(poolManager);
pancakev3Executor =
new UniswapV3Executor(factoryPancakeV3, initCodePancakeV3);
ekuboExecutor = new EkuboExecutor(ekuboCore);
vm.startPrank(EXECUTOR_SETTER);
address[] memory executors = new address[](4);
address[] memory executors = new address[](5);
executors[0] = address(usv2Executor);
executors[1] = address(usv3Executor);
executors[2] = address(pancakev3Executor);
executors[3] = address(usv4Executor);
executors[3] = address(ekuboExecutor);
tychoRouter.setExecutors(executors);
vm.stopPrank();