feat: Support new transfer logic in all executors
TODO: - Fix failing tests - Remove permit2 from initialization of contracts
This commit is contained in:
@@ -17,7 +17,7 @@ contract MaverickV2ExecutorExposed is MaverickV2Executor {
|
||||
IERC20 tokenIn,
|
||||
address target,
|
||||
address receiver,
|
||||
TransferType transferType
|
||||
bool transferNeeded
|
||||
)
|
||||
{
|
||||
return _decodeData(data);
|
||||
@@ -39,27 +39,16 @@ contract MaverickV2ExecutorTest is TestUtils, Constants {
|
||||
}
|
||||
|
||||
function testDecodeParams() public view {
|
||||
bytes memory params = abi.encodePacked(
|
||||
GHO_ADDR,
|
||||
GHO_USDC_POOL,
|
||||
address(2),
|
||||
TokenTransfer.TransferType.TRANSFER_TO_PROTOCOL
|
||||
);
|
||||
bytes memory params =
|
||||
abi.encodePacked(GHO_ADDR, GHO_USDC_POOL, address(2), true);
|
||||
|
||||
(
|
||||
IERC20 tokenIn,
|
||||
address target,
|
||||
address receiver,
|
||||
TokenTransfer.TransferType transferType
|
||||
) = maverickV2Exposed.decodeParams(params);
|
||||
(IERC20 tokenIn, address target, address receiver, bool transferNeeded)
|
||||
= maverickV2Exposed.decodeParams(params);
|
||||
|
||||
assertEq(address(tokenIn), GHO_ADDR);
|
||||
assertEq(target, GHO_USDC_POOL);
|
||||
assertEq(receiver, address(2));
|
||||
assertEq(
|
||||
uint8(transferType),
|
||||
uint8(TokenTransfer.TransferType.TRANSFER_TO_PROTOCOL)
|
||||
);
|
||||
assertEq(transferNeeded, true);
|
||||
}
|
||||
|
||||
function testDecodeParamsInvalidDataLength() public {
|
||||
@@ -72,12 +61,8 @@ contract MaverickV2ExecutorTest is TestUtils, Constants {
|
||||
|
||||
function testSwap() public {
|
||||
uint256 amountIn = 10e18;
|
||||
bytes memory protocolData = abi.encodePacked(
|
||||
GHO_ADDR,
|
||||
GHO_USDC_POOL,
|
||||
BOB,
|
||||
TokenTransfer.TransferType.TRANSFER_TO_PROTOCOL
|
||||
);
|
||||
bytes memory protocolData =
|
||||
abi.encodePacked(GHO_ADDR, GHO_USDC_POOL, BOB, true);
|
||||
|
||||
deal(GHO_ADDR, address(maverickV2Exposed), amountIn);
|
||||
uint256 balanceBefore = USDC.balanceOf(BOB);
|
||||
@@ -94,20 +79,13 @@ contract MaverickV2ExecutorTest is TestUtils, Constants {
|
||||
bytes memory protocolData =
|
||||
loadCallDataFromFile("test_encode_maverick_v2");
|
||||
|
||||
(
|
||||
IERC20 tokenIn,
|
||||
address pool,
|
||||
address receiver,
|
||||
TokenTransfer.TransferType transferType
|
||||
) = maverickV2Exposed.decodeParams(protocolData);
|
||||
(IERC20 tokenIn, address pool, address receiver, bool transferNeeded) =
|
||||
maverickV2Exposed.decodeParams(protocolData);
|
||||
|
||||
assertEq(address(tokenIn), GHO_ADDR);
|
||||
assertEq(pool, GHO_USDC_POOL);
|
||||
assertEq(receiver, BOB);
|
||||
assertEq(
|
||||
uint8(transferType),
|
||||
uint8(TokenTransfer.TransferType.TRANSFER_TO_PROTOCOL)
|
||||
);
|
||||
assertEq(transferNeeded, true);
|
||||
}
|
||||
|
||||
function testSwapIntegration() public {
|
||||
|
||||
Reference in New Issue
Block a user