feat: Remove special handling of the Univ4 callback

The problem was that the pool manager was expecting an ABI encoded result to be returned and we were not returning that (we were returning just a result)
Special thanks to Max for figuring this out

Took 31 minutes
This commit is contained in:
Diana Carvalho
2025-05-09 10:48:54 +01:00
parent fb1737c1f5
commit f14c8ee29b
3 changed files with 10 additions and 22 deletions

View File

@@ -657,13 +657,8 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
/**
* @dev We use the fallback function to allow flexibility on callback.
*/
fallback() external {
bytes memory result = _callHandleCallbackOnExecutor(msg.data);
// slither-disable-next-line assembly
assembly ("memory-safe") {
// Propagate the result
return(add(result, 32), mload(result))
}
fallback(bytes calldata data) external returns (bytes memory) {
return _callHandleCallbackOnExecutor(data);
}
/**
@@ -778,18 +773,6 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
require(msg.sender.code.length != 0);
}
/**
* @dev Called by UniswapV4 pool manager after achieving unlock state.
*/
function unlockCallback(bytes calldata data)
external
returns (bytes memory)
{
if (data.length < 24) revert TychoRouter__InvalidDataLength();
bytes memory result = _callHandleCallbackOnExecutor(data);
return result;
}
/**
* @dev Gets balance of a token for a given address. Supports both native ETH and ERC20 tokens.
*/