feat: ExecutorTransferMethods in UniswapV3Executor
This commit is contained in:
committed by
Diana Carvalho
parent
147ba68392
commit
389009901e
@@ -87,7 +87,10 @@ contract UniswapV2ExecutorTest is Test, Constants {
|
||||
assertEq(target, address(2));
|
||||
assertEq(receiver, address(3));
|
||||
assertEq(zeroForOne, false);
|
||||
assertEq(0, uint8(method));
|
||||
assertEq(
|
||||
uint8(ExecutorTransferMethods.TransferMethod.TRANSFER),
|
||||
uint8(method)
|
||||
);
|
||||
}
|
||||
|
||||
function testDecodeParamsInvalidDataLength() public {
|
||||
|
||||
@@ -6,8 +6,8 @@ import {Test} from "../../lib/forge-std/src/Test.sol";
|
||||
import {Constants} from "../Constants.sol";
|
||||
|
||||
contract UniswapV3ExecutorExposed is UniswapV3Executor {
|
||||
constructor(address _factory, bytes32 _initCode)
|
||||
UniswapV3Executor(_factory, _initCode)
|
||||
constructor(address _factory, bytes32 _initCode, address _permit2)
|
||||
UniswapV3Executor(_factory, _initCode, _permit2)
|
||||
{}
|
||||
|
||||
function decodeData(bytes calldata data)
|
||||
@@ -19,7 +19,8 @@ contract UniswapV3ExecutorExposed is UniswapV3Executor {
|
||||
uint24 fee,
|
||||
address receiver,
|
||||
address target,
|
||||
bool zeroForOne
|
||||
bool zeroForOne,
|
||||
TransferMethod method
|
||||
)
|
||||
{
|
||||
return _decodeData(data);
|
||||
@@ -48,10 +49,10 @@ contract UniswapV3ExecutorTest is Test, Constants {
|
||||
vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock);
|
||||
|
||||
uniswapV3Exposed = new UniswapV3ExecutorExposed(
|
||||
USV3_FACTORY_ETHEREUM, USV3_POOL_CODE_INIT_HASH
|
||||
USV3_FACTORY_ETHEREUM, USV3_POOL_CODE_INIT_HASH, PERMIT2_ADDRESS
|
||||
);
|
||||
pancakeV3Exposed = new UniswapV3ExecutorExposed(
|
||||
PANCAKESWAPV3_DEPLOYER_ETHEREUM, PANCAKEV3_POOL_CODE_INIT_HASH
|
||||
PANCAKESWAPV3_DEPLOYER_ETHEREUM, PANCAKEV3_POOL_CODE_INIT_HASH, PERMIT2_ADDRESS
|
||||
);
|
||||
}
|
||||
|
||||
@@ -67,7 +68,8 @@ contract UniswapV3ExecutorTest is Test, Constants {
|
||||
uint24 fee,
|
||||
address receiver,
|
||||
address target,
|
||||
bool zeroForOne
|
||||
bool zeroForOne,
|
||||
ExecutorTransferMethods.TransferMethod method
|
||||
) = uniswapV3Exposed.decodeData(data);
|
||||
|
||||
assertEq(tokenIn, WETH_ADDR);
|
||||
@@ -76,6 +78,10 @@ contract UniswapV3ExecutorTest is Test, Constants {
|
||||
assertEq(receiver, address(2));
|
||||
assertEq(target, address(3));
|
||||
assertEq(zeroForOne, false);
|
||||
assertEq(
|
||||
uint8(method),
|
||||
uint8(ExecutorTransferMethods.TransferMethod.TRANSFER)
|
||||
);
|
||||
}
|
||||
|
||||
function testDecodeParamsInvalidDataLength() public {
|
||||
@@ -116,7 +122,8 @@ contract UniswapV3ExecutorTest is Test, Constants {
|
||||
int256(0), // amount1Delta
|
||||
dataOffset,
|
||||
dataLength,
|
||||
protocolData
|
||||
protocolData,
|
||||
uint8(ExecutorTransferMethods.TransferMethod.TRANSFER)
|
||||
);
|
||||
uniswapV3Exposed.handleCallback(callbackData);
|
||||
vm.stopPrank();
|
||||
|
||||
Reference in New Issue
Block a user