Tighten EnhancedSwapRouter, InboxETH, SwapRouter, MerkleProofVerifier; align DEXIntegration and ForkTests with updated behavior. Made-with: Cursor
62 lines
2.5 KiB
Solidity
62 lines
2.5 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.19;
|
|
|
|
import {Test, console} from "forge-std/Test.sol";
|
|
import "../../../contracts/bridge/trustless/SwapRouter.sol";
|
|
import "../../../contracts/bridge/trustless/LiquidityPoolETH.sol";
|
|
|
|
/**
|
|
* @title DEXIntegrationTest
|
|
* @notice Test suite for DEX integration
|
|
*/
|
|
contract DEXIntegrationTest is Test {
|
|
SwapRouter public swapRouter;
|
|
LiquidityPoolETH public liquidityPool;
|
|
|
|
address public constant WETH = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
|
|
address public constant UNISWAP_V3_ROUTER = address(0xE592427A0AEce92De3Edee1F18E0157C05861564);
|
|
address public constant CURVE_3POOL = address(0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7);
|
|
address public constant ONEINCH_ROUTER = address(0x1111111254EEB25477B68fb85Ed929f73A960582);
|
|
address public constant USDT = address(0xdAC17F958D2ee523a2206206994597C13D831ec7);
|
|
address public constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
|
|
address public constant DAI = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
|
|
|
|
function setUp() public {
|
|
liquidityPool = new LiquidityPoolETH(WETH, 5, 11000);
|
|
swapRouter = new SwapRouter(
|
|
UNISWAP_V3_ROUTER,
|
|
CURVE_3POOL,
|
|
ONEINCH_ROUTER,
|
|
WETH,
|
|
USDT,
|
|
USDC,
|
|
DAI
|
|
);
|
|
}
|
|
|
|
function test_SwapRouter_Addresses() public view {
|
|
// Test contract addresses are set correctly
|
|
assertEq(swapRouter.uniswapV3Router(), UNISWAP_V3_ROUTER, "Uniswap router should match");
|
|
assertEq(swapRouter.weth(), WETH, "WETH address should match");
|
|
assertEq(swapRouter.usdt(), USDT, "USDT address should match");
|
|
assertEq(swapRouter.usdc(), USDC, "USDC address should match");
|
|
assertEq(swapRouter.dai(), DAI, "DAI address should match");
|
|
}
|
|
|
|
function test_SwapRouter_FeeTiers() public view {
|
|
// Test fee tier constants
|
|
assertEq(swapRouter.FEE_TIER_LOW(), 500, "Low fee tier should be 0.05%");
|
|
assertEq(swapRouter.FEE_TIER_MEDIUM(), 3000, "Medium fee tier should be 0.3%");
|
|
assertEq(swapRouter.FEE_TIER_HIGH(), 10000, "High fee tier should be 1%");
|
|
}
|
|
|
|
// Note: Actual swap execution tests would require:
|
|
// 1. Forking mainnet, or
|
|
// 2. Using mock DEX contracts, or
|
|
// 3. Integration testing on testnet
|
|
// This is a placeholder for integration tests
|
|
|
|
// Note: Actual swap tests would require forking mainnet or using mocks
|
|
// This is a placeholder for integration tests
|
|
}
|