// 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 CreateCUSDTUSDTPool * @notice Call createCUSDTUSDTPool on existing DODOPMMIntegration (Chain 138). * @dev Requires caller to have POOL_MANAGER_ROLE. Run with --broadcast. */ contract CreateCUSDTUSDTPool is Script { 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"); 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 deployer = vm.addr(pk); uint64 nextNonce = uint64(vm.envOr("NEXT_NONCE", uint256(0))); if (nextNonce > 0) { vm.setNonce(deployer, nextNonce); } 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( lpFeeBps, initialPrice, k, useTwap ); console.log("cUSDT/USDT pool created at:", pool); vm.stopBroadcast(); } }