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

@@ -76,12 +76,17 @@ contract UniswapV3ExecutorTest is Test, Constants {
uint256 initialPoolReserve = IERC20(WETH_ADDR).balanceOf(DAI_WETH_USV3);
vm.startPrank(DAI_WETH_USV3);
bytes memory protocolData =
abi.encodePacked(WETH_ADDR, DAI_ADDR, poolFee);
uint256 dataOffset = 3; // some offset
uint256 dataLength = protocolData.length;
bytes memory callbackData = abi.encodePacked(
int256(amountOwed), // amount0Delta
int256(0), // amount1Delta
WETH_ADDR,
DAI_ADDR,
poolFee
dataOffset,
dataLength,
protocolData
);
uniswapV3Exposed.handleCallback(callbackData);
vm.stopPrank();
@@ -90,7 +95,7 @@ contract UniswapV3ExecutorTest is Test, Constants {
assertEq(finalPoolReserve - initialPoolReserve, amountOwed);
}
function testSwapWETHForDAI() public {
function testSwapIntegration() public {
uint256 amountIn = 10 ** 18;
deal(WETH_ADDR, address(uniswapV3Exposed), amountIn);