fix: Fix remaining tests after latest encoding changes
This commit is contained in:
@@ -7,7 +7,9 @@ import "@permit2/src/interfaces/IAllowanceTransfer.sol";
|
||||
import "@openzeppelin/contracts/utils/Address.sol";
|
||||
|
||||
error RestrictTransferFrom__AddressZero();
|
||||
error RestrictTransferFrom__ExceededTransferFromAllowance();
|
||||
error RestrictTransferFrom__ExceededTransferFromAllowance(
|
||||
uint256 allowedAmount, uint256 amountAttempted
|
||||
);
|
||||
error RestrictTransferFrom__UnknownTransferType();
|
||||
|
||||
/**
|
||||
@@ -75,7 +77,6 @@ contract RestrictTransferFrom {
|
||||
if (transferType == TransferType.TransferFrom) {
|
||||
bool isPermit2;
|
||||
address sender;
|
||||
bool isTransferExecuted;
|
||||
uint256 amountSpent;
|
||||
uint256 amountAllowed;
|
||||
assembly {
|
||||
@@ -85,11 +86,14 @@ contract RestrictTransferFrom {
|
||||
sender := tload(_SENDER_SLOT)
|
||||
amountSpent := tload(_AMOUNT_SPENT_SLOT)
|
||||
}
|
||||
if (amount + amountSpent > amountAllowed) {
|
||||
revert RestrictTransferFrom__ExceededTransferFromAllowance();
|
||||
uint256 amountAttempted = amountSpent + amount;
|
||||
if (amountAttempted > amountAllowed) {
|
||||
revert RestrictTransferFrom__ExceededTransferFromAllowance(
|
||||
amountAllowed, amountAttempted
|
||||
);
|
||||
}
|
||||
assembly {
|
||||
tstore(_AMOUNT_SPENT_SLOT, amount)
|
||||
tstore(_AMOUNT_SPENT_SLOT, amountAttempted)
|
||||
}
|
||||
if (isPermit2) {
|
||||
// Permit2.permit is already called from the TychoRouter
|
||||
|
||||
@@ -77,7 +77,7 @@ contract BalancerV2Executor is IExecutor, RestrictTransferFrom {
|
||||
TransferType transferType
|
||||
)
|
||||
{
|
||||
if (data.length != 93) {
|
||||
if (data.length != 94) {
|
||||
revert BalancerV2Executor__InvalidDataLength();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ contract EkuboExecutor is
|
||||
|
||||
ICore immutable core;
|
||||
|
||||
uint256 constant POOL_DATA_OFFSET = 58;
|
||||
uint256 constant POOL_DATA_OFFSET = 57;
|
||||
uint256 constant HOP_BYTE_LEN = 52;
|
||||
|
||||
bytes4 constant LOCKED_SELECTOR = 0xb45a3c0e; // locked(uint256)
|
||||
|
||||
@@ -38,7 +38,7 @@ contract UniswapV4Executor is
|
||||
IExecutor,
|
||||
IUnlockCallback,
|
||||
ICallback,
|
||||
RestrictTransferFrom
|
||||
RestrictTransferFrom
|
||||
{
|
||||
using SafeERC20 for IERC20;
|
||||
using CurrencyLibrary for Currency;
|
||||
@@ -48,8 +48,8 @@ RestrictTransferFrom
|
||||
IPoolManager public immutable poolManager;
|
||||
address private immutable _self;
|
||||
|
||||
bytes4 constant SWAP_EXACT_INPUT_SINGLE_SELECTOR = 0xbaa46608;
|
||||
bytes4 constant SWAP_EXACT_INPUT_SELECTOR = 0x653f1785;
|
||||
bytes4 constant SWAP_EXACT_INPUT_SINGLE_SELECTOR = 0x6022fbcd;
|
||||
bytes4 constant SWAP_EXACT_INPUT_SELECTOR = 0x044f0d3d;
|
||||
|
||||
struct UniswapV4Pool {
|
||||
address intermediaryToken;
|
||||
|
||||
Reference in New Issue
Block a user