Changes: - If the tokenIn is ETH, skip permit2 approval - Make executors payable: When using delegatecall the executor inherits the execution context of whoever calls it. Our main swap function can accept ETH, it needs to be payable so by consequence the executors also need to be. - Set uniswap v2 executor in test router - Add tests for all possible cases of swap - Add tests for all cases of splitSwap - Add test functions to handle permit2 and encode swaps --- don't change below this line --- ENG-4041 Took 3 hours 50 minutes Took 49 seconds Took 14 seconds
42 lines
1.6 KiB
Solidity
42 lines
1.6 KiB
Solidity
// SPDX-License-Identifier: UNLICENSED
|
|
pragma solidity ^0.8.28;
|
|
|
|
import "forge-std/Test.sol";
|
|
|
|
contract Constants is Test {
|
|
address ADMIN = makeAddr("admin"); //admin=us
|
|
address BOB = makeAddr("bob"); //bob=someone!=us
|
|
address FUND_RESCUER = makeAddr("fundRescuer");
|
|
address FEE_SETTER = makeAddr("feeSetter");
|
|
address FEE_RECEIVER = makeAddr("feeReceiver");
|
|
address EXECUTOR_SETTER = makeAddr("executorSetter");
|
|
address ALICE = 0xcd09f75E2BF2A4d11F3AB23f1389FcC1621c0cc2;
|
|
uint256 ALICE_PK =
|
|
0x123456789abcdef123456789abcdef123456789abcdef123456789abcdef1234;
|
|
|
|
// Dummy contracts
|
|
address DUMMY = makeAddr("dummy");
|
|
address PAUSER = makeAddr("pauser");
|
|
address UNPAUSER = makeAddr("unpauser");
|
|
|
|
// Assets
|
|
address WETH_ADDR = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
|
|
address DAI_ADDR = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
|
|
address USDC_ADDR = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
|
|
address WBTC_ADDR = address(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599);
|
|
|
|
// uniswap v2
|
|
address WETH_DAI_POOL = 0xA478c2975Ab1Ea89e8196811F51A7B7Ade33eB11;
|
|
address DAI_USDC_POOL = 0xAE461cA67B15dc8dc81CE7615e0320dA1A9aB8D5;
|
|
address WETH_WBTC_POOL = 0xBb2b8038a1640196FbE3e38816F3e67Cba72D940;
|
|
address USDC_WBTC_POOL = 0x004375Dff511095CC5A197A54140a24eFEF3A416;
|
|
|
|
/**
|
|
* @dev Deploys a dummy contract with non-empty bytecode
|
|
*/
|
|
function deployDummyContract() internal {
|
|
bytes memory minimalBytecode = hex"01"; // Single-byte bytecode
|
|
vm.etch(DUMMY, minimalBytecode); // Deploy minimal bytecode
|
|
}
|
|
}
|