feat: Support Pancakeswap v3 on ethereum

- Needed to take pool code init hash as input param for executors
- Added tests for ethereum. Will test base on-chain.
- Important note: Pancakeswap uses their deployer instead of their factory (this is a different address) for target verification.
This commit is contained in:
TAMARA LIPOWSKI
2025-03-19 15:30:58 -04:00
parent 0a8a34be03
commit 2a4ee88cad
7 changed files with 78 additions and 28 deletions

View File

@@ -6,8 +6,8 @@ import {Test} from "../../lib/forge-std/src/Test.sol";
import {Constants} from "../Constants.sol";
contract UniswapV2ExecutorExposed is UniswapV2Executor {
constructor(address _factory, bytes32 _init_code)
UniswapV2Executor(_factory, _init_code)
constructor(address _factory, bytes32 _initCode)
UniswapV2Executor(_factory, _initCode)
{}
function decodeParams(bytes calldata data)

View File

@@ -6,7 +6,9 @@ import {Test} from "../../lib/forge-std/src/Test.sol";
import {Constants} from "../Constants.sol";
contract UniswapV3ExecutorExposed is UniswapV3Executor {
constructor(address _factory) UniswapV3Executor(_factory) {}
constructor(address _factory, bytes32 _initCode)
UniswapV3Executor(_factory, _initCode)
{}
function decodeData(bytes calldata data)
external
@@ -37,6 +39,7 @@ contract UniswapV3ExecutorTest is Test, Constants {
using SafeERC20 for IERC20;
UniswapV3ExecutorExposed uniswapV3Exposed;
UniswapV3ExecutorExposed pancakeV3Exposed;
IERC20 WETH = IERC20(WETH_ADDR);
IERC20 DAI = IERC20(DAI_ADDR);
@@ -44,7 +47,12 @@ contract UniswapV3ExecutorTest is Test, Constants {
uint256 forkBlock = 17323404;
vm.createSelectFork(vm.rpcUrl("mainnet"), forkBlock);
uniswapV3Exposed = new UniswapV3ExecutorExposed(USV3_FACTORY_ETHEREUM);
uniswapV3Exposed = new UniswapV3ExecutorExposed(
USV3_FACTORY_ETHEREUM, USV3_POOL_CODE_INIT_HASH
);
pancakeV3Exposed = new UniswapV3ExecutorExposed(
PANCAKESWAPV3_DEPLOYER_ETHEREUM, PANCAKEV3_POOL_CODE_INIT_HASH
);
}
function testDecodeParams() public view {
@@ -84,6 +92,12 @@ contract UniswapV3ExecutorTest is Test, Constants {
);
}
function testVerifyPairAddressPancake() public view {
pancakeV3Exposed.verifyPairAddress(
WETH_ADDR, USDT_ADDR, 500, PANCAKESWAPV3_WETH_USDT_POOL
);
}
function testUSV3Callback() public {
uint24 poolFee = 3000;
uint256 amountOwed = 1000000000000000000;