From 75516122e1a084f86c34e6eaaf43fe5f53a30d96 Mon Sep 17 00:00:00 2001 From: TAMARA LIPOWSKI Date: Mon, 31 Mar 2025 21:01:36 +0200 Subject: [PATCH] fix: support payCallback method for Ekubo - depending on the pool, either lock or payCallback may be called. --- foundry/src/TychoRouter.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/foundry/src/TychoRouter.sol b/foundry/src/TychoRouter.sol index 66c0be6..21d51f9 100644 --- a/foundry/src/TychoRouter.sol +++ b/foundry/src/TychoRouter.sol @@ -571,4 +571,23 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard { ); } } + + function payCallback(uint256, address /*token*/ ) external { + address executor = address(0x5E40985A4d4E8DbAd1dc35fFCfacfCde3e3d1806); + + // slither-disable-next-line controlled-delegatecall,low-level-calls + (bool success, bytes memory result) = executor.delegatecall( + abi.encodeWithSelector(ICallback.handleCallback.selector, msg.data) + ); + + if (!success) { + revert( + string( + result.length > 0 + ? result + : abi.encodePacked("Callback failed") + ) + ); + } + } }