fix(Bebop): Fix encoding and tests

Misc: Fix revert condition in UniswapXFiller

Took 1 hour 20 minutes
This commit is contained in:
Diana Carvalho
2025-08-13 15:11:43 +01:00
parent 7024da395d
commit e79347842f
13 changed files with 96 additions and 791 deletions

View File

@@ -24,9 +24,6 @@ contract BebopExecutor is IExecutor, IExecutorErrors, RestrictTransferFrom {
/// @notice Bebop-specific errors
error BebopExecutor__InvalidDataLength();
error BebopExecutor__InvalidInput();
error BebopExecutor__InvalidSignatureLength();
error BebopExecutor__InvalidSignatureType();
error BebopExecutor__ZeroAddress();
/// @notice The Bebop settlement contract address
@@ -78,17 +75,14 @@ contract BebopExecutor is IExecutor, IExecutorErrors, RestrictTransferFrom {
IERC20(tokenIn).forceApprove(bebopSettlement, type(uint256).max);
}
// Check the receiver's balance before the swap
uint256 balanceBefore = _balanceOf(tokenOut, receiver);
// Execute the swap with the forwarded calldata
uint256 ethValue = tokenIn == address(0) ? givenAmount : 0;
// Use OpenZeppelin's Address library for safe call with value
// This will revert if the call fails
// slither-disable-next-line unused-return
bebopSettlement.functionCallWithValue(finalCalldata, ethValue);
// Calculate actual amount received by the receiver
uint256 balanceAfter = _balanceOf(tokenOut, receiver);
calculatedAmount = balanceAfter - balanceBefore;
}
@@ -149,6 +143,7 @@ contract BebopExecutor is IExecutor, IExecutorErrors, RestrictTransferFrom {
}
// Use assembly to modify the filledTakerAmount at the correct position
// slither-disable-next-line assembly
assembly {
// Get pointer to the data portion of the bytes array
let dataPtr := add(bebopCalldata, 0x20)

View File

@@ -60,10 +60,9 @@ contract UniswapXFiller is AccessControl, IReactorCallback {
ResolvedOrder[] calldata resolvedOrders,
bytes calldata callbackData
) external onlyRole(REACTOR_ROLE) {
require(
resolvedOrders.length == 1,
UniswapXFiller__BatchExecutionNotSupported()
);
if (resolvedOrders.length != 1) {
revert UniswapXFiller__BatchExecutionNotSupported();
}
ResolvedOrder memory order = resolvedOrders[0];