feat: Change signature of _handleCallback to take only bytes calldata

The selector and executor are decoded inside this function now.
For Uniswap V3 I had to manually slice the msg.data from uniswapV3SwapCallback to get the data that matters for the callback

Took 3 hours 12 minutes
This commit is contained in:
Diana Carvalho
2025-02-18 11:11:43 +00:00
parent 2604935609
commit 2aa63d7ec0
4 changed files with 47 additions and 58 deletions

View File

@@ -82,11 +82,10 @@ contract Dispatcher {
calculatedAmount = abi.decode(result, (uint256));
}
function _handleCallback(
bytes4 selector,
address executor,
bytes memory data
) internal {
function _handleCallback(bytes calldata data) internal {
bytes4 selector = bytes4(data[data.length - 4:]);
address executor = address(uint160(bytes20(data[data.length - 24:])));
if (!executors[executor]) {
revert Dispatcher__UnapprovedExecutor();
}