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
This commit is contained in:
56
script/dex/AddLiquidityCUSDWCUSDCV2PoolChain138.s.sol
Normal file
56
script/dex/AddLiquidityCUSDWCUSDCV2PoolChain138.s.sol
Normal file
@@ -0,0 +1,56 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
import {DODOPMMIntegration} from "../../contracts/dex/DODOPMMIntegration.sol";
|
||||
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
|
||||
/**
|
||||
* @title AddLiquidityCUSDWCUSDCV2PoolChain138
|
||||
* @notice Add liquidity to the Chain 138 cUSDW / cUSDC_V2 DODO PMM pool.
|
||||
* @dev Env: PRIVATE_KEY, DODO_PMM_INTEGRATION or DODO_PMM_INTEGRATION_ADDRESS,
|
||||
* CUSDW_ADDRESS_138, CUSDC_V2_ADDRESS_138, POOL_CUSDWCUSDCV2,
|
||||
* ADD_LIQUIDITY_CUSDWCUSDCV2_BASE, ADD_LIQUIDITY_CUSDWCUSDCV2_QUOTE.
|
||||
* Optional fallback amounts:
|
||||
* - ADD_LIQUIDITY_BASE_AMOUNT
|
||||
* - ADD_LIQUIDITY_QUOTE_AMOUNT
|
||||
* Optional: NEXT_NONCE.
|
||||
*/
|
||||
contract AddLiquidityCUSDWCUSDCV2PoolChain138 is Script {
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address integrationAddr = vm.envAddress("DODO_PMM_INTEGRATION");
|
||||
if (integrationAddr == address(0)) {
|
||||
integrationAddr = vm.envAddress("DODO_PMM_INTEGRATION_ADDRESS");
|
||||
}
|
||||
require(integrationAddr != address(0), "DODO_PMM_INTEGRATION not set");
|
||||
|
||||
address cusdw = vm.envAddress("CUSDW_ADDRESS_138");
|
||||
address cusdcV2 = vm.envAddress("CUSDC_V2_ADDRESS_138");
|
||||
address pool = vm.envAddress("POOL_CUSDWCUSDCV2");
|
||||
require(cusdw != address(0), "CUSDW_ADDRESS_138 not set");
|
||||
require(cusdcV2 != address(0), "CUSDC_V2_ADDRESS_138 not set");
|
||||
require(pool != address(0), "POOL_CUSDWCUSDCV2 not set");
|
||||
|
||||
uint256 defaultBase = vm.envOr("ADD_LIQUIDITY_BASE_AMOUNT", uint256(0));
|
||||
uint256 defaultQuote = vm.envOr("ADD_LIQUIDITY_QUOTE_AMOUNT", uint256(0));
|
||||
uint256 baseAmount = vm.envOr("ADD_LIQUIDITY_CUSDWCUSDCV2_BASE", defaultBase);
|
||||
uint256 quoteAmount = vm.envOr("ADD_LIQUIDITY_CUSDWCUSDCV2_QUOTE", defaultQuote);
|
||||
require(baseAmount > 0, "ADD_LIQUIDITY_CUSDWCUSDCV2_BASE not set");
|
||||
require(quoteAmount > 0, "ADD_LIQUIDITY_CUSDWCUSDCV2_QUOTE not set");
|
||||
|
||||
address deployer = vm.addr(pk);
|
||||
uint64 nextNonce = uint64(vm.envOr("NEXT_NONCE", uint256(0)));
|
||||
if (nextNonce > 0) {
|
||||
vm.setNonce(deployer, nextNonce);
|
||||
}
|
||||
|
||||
DODOPMMIntegration integration = DODOPMMIntegration(integrationAddr);
|
||||
vm.startBroadcast(pk);
|
||||
IERC20(cusdw).approve(address(integration), type(uint256).max);
|
||||
IERC20(cusdcV2).approve(address(integration), type(uint256).max);
|
||||
integration.addLiquidity(pool, baseAmount, quoteAmount);
|
||||
console.log("Added liquidity to cUSDW/cUSDC_V2 pool:", pool);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,10 @@ import {DODOPMMIntegration} from "../../contracts/dex/DODOPMMIntegration.sol";
|
||||
* @dev Requires caller to have POOL_MANAGER_ROLE. Run with --broadcast.
|
||||
*/
|
||||
contract CreateCUSDCUSDCPool is Script {
|
||||
uint256 constant LP_FEE_BPS = 3;
|
||||
uint256 constant INITIAL_PRICE_1E18 = 1e18;
|
||||
uint256 constant K_50PCT = 0.5e18;
|
||||
bool constant USE_TWAP = true;
|
||||
uint256 constant DEFAULT_LP_FEE_BPS = 10;
|
||||
uint256 constant DEFAULT_INITIAL_PRICE_1E18 = 1e18;
|
||||
uint256 constant DEFAULT_K_0PCT = 0;
|
||||
bool constant DEFAULT_USE_TWAP = false;
|
||||
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
@@ -30,12 +30,16 @@ contract CreateCUSDCUSDCPool is Script {
|
||||
}
|
||||
|
||||
DODOPMMIntegration integration = DODOPMMIntegration(integrationAddr);
|
||||
uint256 lpFeeBps = vm.envOr("DODO_LP_FEE_BPS", DEFAULT_LP_FEE_BPS);
|
||||
uint256 initialPrice = vm.envOr("DODO_INITIAL_PRICE_1E18", DEFAULT_INITIAL_PRICE_1E18);
|
||||
uint256 k = vm.envOr("DODO_K_FACTOR_1E18", DEFAULT_K_0PCT);
|
||||
bool useTwap = vm.envOr("DODO_ENABLE_TWAP", DEFAULT_USE_TWAP);
|
||||
vm.startBroadcast(pk);
|
||||
address pool = integration.createCUSDCUSDCPool(
|
||||
LP_FEE_BPS,
|
||||
INITIAL_PRICE_1E18,
|
||||
K_50PCT,
|
||||
USE_TWAP
|
||||
lpFeeBps,
|
||||
initialPrice,
|
||||
k,
|
||||
useTwap
|
||||
);
|
||||
console.log("cUSDC/USDC pool created at:", pool);
|
||||
vm.stopBroadcast();
|
||||
|
||||
@@ -10,10 +10,10 @@ import {DODOPMMIntegration} from "../../contracts/dex/DODOPMMIntegration.sol";
|
||||
* @dev Requires caller to have POOL_MANAGER_ROLE. Run with --broadcast.
|
||||
*/
|
||||
contract CreateCUSDTCUSDCPool is Script {
|
||||
uint256 constant LP_FEE_BPS = 3;
|
||||
uint256 constant INITIAL_PRICE_1E18 = 1e18;
|
||||
uint256 constant K_50PCT = 0.5e18;
|
||||
bool constant USE_TWAP = true;
|
||||
uint256 constant DEFAULT_LP_FEE_BPS = 10;
|
||||
uint256 constant DEFAULT_INITIAL_PRICE_1E18 = 1e18;
|
||||
uint256 constant DEFAULT_K_0PCT = 0;
|
||||
bool constant DEFAULT_USE_TWAP = false;
|
||||
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
@@ -30,12 +30,16 @@ contract CreateCUSDTCUSDCPool is Script {
|
||||
}
|
||||
|
||||
DODOPMMIntegration integration = DODOPMMIntegration(integrationAddr);
|
||||
uint256 lpFeeBps = vm.envOr("DODO_LP_FEE_BPS", DEFAULT_LP_FEE_BPS);
|
||||
uint256 initialPrice = vm.envOr("DODO_INITIAL_PRICE_1E18", DEFAULT_INITIAL_PRICE_1E18);
|
||||
uint256 k = vm.envOr("DODO_K_FACTOR_1E18", DEFAULT_K_0PCT);
|
||||
bool useTwap = vm.envOr("DODO_ENABLE_TWAP", DEFAULT_USE_TWAP);
|
||||
vm.startBroadcast(pk);
|
||||
address pool = integration.createCUSDTCUSDCPool(
|
||||
LP_FEE_BPS,
|
||||
INITIAL_PRICE_1E18,
|
||||
K_50PCT,
|
||||
USE_TWAP
|
||||
lpFeeBps,
|
||||
initialPrice,
|
||||
k,
|
||||
useTwap
|
||||
);
|
||||
console.log("cUSDT/cUSDC pool created at:", pool);
|
||||
vm.stopBroadcast();
|
||||
|
||||
@@ -10,10 +10,10 @@ import {DODOPMMIntegration} from "../../contracts/dex/DODOPMMIntegration.sol";
|
||||
* @dev Requires caller to have POOL_MANAGER_ROLE. Run with --broadcast.
|
||||
*/
|
||||
contract CreateCUSDTUSDTPool is Script {
|
||||
uint256 constant LP_FEE_BPS = 3;
|
||||
uint256 constant INITIAL_PRICE_1E18 = 1e18;
|
||||
uint256 constant K_50PCT = 0.5e18;
|
||||
bool constant USE_TWAP = true;
|
||||
uint256 constant DEFAULT_LP_FEE_BPS = 10;
|
||||
uint256 constant DEFAULT_INITIAL_PRICE_1E18 = 1e18;
|
||||
uint256 constant DEFAULT_K_0PCT = 0;
|
||||
bool constant DEFAULT_USE_TWAP = false;
|
||||
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
@@ -30,12 +30,16 @@ contract CreateCUSDTUSDTPool is Script {
|
||||
}
|
||||
|
||||
DODOPMMIntegration integration = DODOPMMIntegration(integrationAddr);
|
||||
uint256 lpFeeBps = vm.envOr("DODO_LP_FEE_BPS", DEFAULT_LP_FEE_BPS);
|
||||
uint256 initialPrice = vm.envOr("DODO_INITIAL_PRICE_1E18", DEFAULT_INITIAL_PRICE_1E18);
|
||||
uint256 k = vm.envOr("DODO_K_FACTOR_1E18", DEFAULT_K_0PCT);
|
||||
bool useTwap = vm.envOr("DODO_ENABLE_TWAP", DEFAULT_USE_TWAP);
|
||||
vm.startBroadcast(pk);
|
||||
address pool = integration.createCUSDTUSDTPool(
|
||||
LP_FEE_BPS,
|
||||
INITIAL_PRICE_1E18,
|
||||
K_50PCT,
|
||||
USE_TWAP
|
||||
lpFeeBps,
|
||||
initialPrice,
|
||||
k,
|
||||
useTwap
|
||||
);
|
||||
console.log("cUSDT/USDT pool created at:", pool);
|
||||
vm.stopBroadcast();
|
||||
|
||||
63
script/dex/CreateCUSDWCUSDCV2Pool.s.sol
Normal file
63
script/dex/CreateCUSDWCUSDCV2Pool.s.sol
Normal file
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import {Script, console} from "forge-std/Script.sol";
|
||||
import {DODOPMMIntegration} from "../../contracts/dex/DODOPMMIntegration.sol";
|
||||
|
||||
/**
|
||||
* @title CreateCUSDWCUSDCV2Pool
|
||||
* @notice Create a Chain 138 DODO PMM pool for cUSDW / cUSDC_V2 using the generic createPool path.
|
||||
* @dev Assumes repo-native D-WIN-aligned cUSDW on Chain 138 and staged cUSDC V2 as the quote leg.
|
||||
* Env: PRIVATE_KEY, DODO_PMM_INTEGRATION or DODO_PMM_INTEGRATION_ADDRESS,
|
||||
* CUSDW_ADDRESS_138, CUSDC_V2_ADDRESS_138.
|
||||
* Optional params:
|
||||
* - DODO_LP_FEE_BPS (default 3)
|
||||
* - DODO_INITIAL_PRICE_1E18 (default 1e18)
|
||||
* - DODO_K_FACTOR_1E18 (default 0.5e18)
|
||||
* - DODO_ENABLE_TWAP (default true)
|
||||
* - NEXT_NONCE
|
||||
*/
|
||||
contract CreateCUSDWCUSDCV2Pool is Script {
|
||||
uint256 constant DEFAULT_LP_FEE_BPS = 3;
|
||||
uint256 constant DEFAULT_INITIAL_PRICE_1E18 = 1e18;
|
||||
uint256 constant DEFAULT_K_50PCT = 0.5e18;
|
||||
bool constant DEFAULT_USE_TWAP = true;
|
||||
|
||||
function run() external {
|
||||
uint256 pk = vm.envUint("PRIVATE_KEY");
|
||||
address integrationAddr = vm.envAddress("DODO_PMM_INTEGRATION");
|
||||
if (integrationAddr == address(0)) {
|
||||
integrationAddr = vm.envAddress("DODO_PMM_INTEGRATION_ADDRESS");
|
||||
}
|
||||
require(integrationAddr != address(0), "DODO_PMM_INTEGRATION not set");
|
||||
|
||||
address cusdw = vm.envAddress("CUSDW_ADDRESS_138");
|
||||
address cusdcV2 = vm.envAddress("CUSDC_V2_ADDRESS_138");
|
||||
require(cusdw != address(0), "CUSDW_ADDRESS_138 not set");
|
||||
require(cusdcV2 != address(0), "CUSDC_V2_ADDRESS_138 not set");
|
||||
|
||||
uint256 lpFeeBps = vm.envOr("DODO_LP_FEE_BPS", DEFAULT_LP_FEE_BPS);
|
||||
uint256 initialPrice = vm.envOr("DODO_INITIAL_PRICE_1E18", DEFAULT_INITIAL_PRICE_1E18);
|
||||
uint256 kFactor = vm.envOr("DODO_K_FACTOR_1E18", DEFAULT_K_50PCT);
|
||||
bool useTwap = vm.envOr("DODO_ENABLE_TWAP", DEFAULT_USE_TWAP);
|
||||
|
||||
address deployer = vm.addr(pk);
|
||||
uint64 nextNonce = uint64(vm.envOr("NEXT_NONCE", uint256(0)));
|
||||
if (nextNonce > 0) {
|
||||
vm.setNonce(deployer, nextNonce);
|
||||
}
|
||||
|
||||
DODOPMMIntegration integration = DODOPMMIntegration(integrationAddr);
|
||||
vm.startBroadcast(pk);
|
||||
address pool = integration.createPool(
|
||||
cusdw,
|
||||
cusdcV2,
|
||||
lpFeeBps,
|
||||
initialPrice,
|
||||
kFactor,
|
||||
useTwap
|
||||
);
|
||||
console.log("cUSDW/cUSDC_V2 pool created at:", pool);
|
||||
vm.stopBroadcast();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user