feat: bridges, PMM, flash workflow, token-aggregation, and deployment docs
- CCIP/trustless bridge contracts, GRU tokens, DEX/PMM tests, reserve vault.
- Token-aggregation service routes, planner, chain config, relay env templates.
- Config snapshots and multi-chain deployment markdown updates.
- gitignore services/btc-intake/dist/ (tsc output); do not track dist.
Run forge build && forge test before deploy (large solc graph).
Made-with: Cursor
2026-04-07 23:40:52 -07:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
pragma solidity ^0.8.20;
|
|
|
|
|
|
|
|
|
|
import {Test} from "forge-std/Test.sol";
|
|
|
|
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
|
|
|
import {DODOIntegrationExternalUnwinder} from "../../contracts/flash/DODOIntegrationExternalUnwinder.sol";
|
|
|
|
|
|
|
|
|
|
contract DODOIntegrationExternalUnwinderMainnetForkTest is Test {
|
|
|
|
|
address constant DODO_PMM_INTEGRATION_MAINNET = 0xa9F284eD010f4F7d7F8F201742b49b9f58e29b84;
|
|
|
|
|
address constant POOL_CWUSDC_USDC = 0x69776fc607e9edA8042e320e7e43f54d06c68f0E;
|
|
|
|
|
address constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
|
|
|
|
|
address constant CWUSDC = 0x2de5F116bFcE3d0f922d9C8351e0c5Fc24b9284a;
|
|
|
|
|
|
|
|
|
|
bool public forkAvailable;
|
|
|
|
|
DODOIntegrationExternalUnwinder internal unwinder;
|
|
|
|
|
|
|
|
|
|
modifier skipIfNoFork() {
|
|
|
|
|
if (!forkAvailable) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setUp() public {
|
|
|
|
|
string memory rpcUrl = vm.envOr("ETHEREUM_MAINNET_RPC", string(""));
|
|
|
|
|
if (bytes(rpcUrl).length == 0) {
|
|
|
|
|
forkAvailable = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
try vm.createSelectFork(rpcUrl) {
|
|
|
|
|
forkAvailable = true;
|
|
|
|
|
} catch {
|
|
|
|
|
forkAvailable = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unwinder = new DODOIntegrationExternalUnwinder(DODO_PMM_INTEGRATION_MAINNET);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function testFork_cWUSDCToUSDC_unwindsThroughMainnetDodoIntegration() public skipIfNoFork {
|
|
|
|
|
uint256 amountIn = 1_000_000; // 1 cWUSDC
|
2026-04-12 06:33:54 -07:00
|
|
|
deal(CWUSDC, address(this), amountIn);
|
|
|
|
|
IERC20(CWUSDC).approve(address(unwinder), amountIn);
|
feat: bridges, PMM, flash workflow, token-aggregation, and deployment docs
- CCIP/trustless bridge contracts, GRU tokens, DEX/PMM tests, reserve vault.
- Token-aggregation service routes, planner, chain config, relay env templates.
- Config snapshots and multi-chain deployment markdown updates.
- gitignore services/btc-intake/dist/ (tsc output); do not track dist.
Run forge build && forge test before deploy (large solc graph).
Made-with: Cursor
2026-04-07 23:40:52 -07:00
|
|
|
|
|
|
|
|
uint256 before = IERC20(USDC).balanceOf(address(this));
|
|
|
|
|
uint256 amountOut = unwinder.unwind(CWUSDC, USDC, amountIn, 1, abi.encode(POOL_CWUSDC_USDC));
|
|
|
|
|
uint256 afterBal = IERC20(USDC).balanceOf(address(this));
|
|
|
|
|
|
|
|
|
|
assertGt(amountOut, 0, "amountOut > 0");
|
|
|
|
|
assertEq(afterBal - before, amountOut, "USDC received");
|
|
|
|
|
}
|
|
|
|
|
}
|