# Pre-Deployment Checklist — DODO PMM, Pools, Provider, Router & APIs **Last Updated:** 2026-02-28 **Purpose:** Single source of truth for component status and ordered steps required before deployment (Chain 138). **See also:** [DEPLOYMENT_ORDER_OF_OPERATIONS.md](DEPLOYMENT_ORDER_OF_OPERATIONS.md) — full deployment order (Phase 0–6) and remaining recommendations. ### Deployment safety (required) - **Correct RPC:** Use only **Core RPC** (`RPC_URL_138` = VMID 2101, e.g. `http://192.168.11.211:8545`). Never use Public RPC for deployments. Set in `smom-dbis-138/.env`. - **Correct dotenv:** All secrets from **`smom-dbis-138/.env`** only. Check: `cd smom-dbis-138 && ./scripts/deployment/check-env-required.sh`. Pre-flight from repo root: `./scripts/deployment/preflight-chain138-deploy.sh`. - **Gas / cost estimate:** Run `cd smom-dbis-138 && ./scripts/deployment/calculate-costs-consolidated.sh` (or see [DEPLOYMENT_GAS_COSTS_REALTIME](../11-references/DEPLOYMENT_GAS_COSTS_REALTIME.md)) before deploying for accurate cost estimates. - **Do not deploy when stuck:** If nonce has pending txs or you see "Replacement transaction underpriced", run `./scripts/clear-all-transaction-pools.sh` then wait ~60s before deploying. Prefer scripts that check nonce (e.g. `deploy-transaction-mirror-and-pmm-pool-after-txpool-clear.sh`). --- ## 1. Component status (current state) | Component | Status | Address / Notes | |-----------|--------|-----------------| | **DODOPMMIntegration** | ✅ Deployed | Chain 138: `0x79cdbaFBaA0FdF9F55D26F360F54cddE5c743F7D` (Mock DVM). | | **PMM pools (cUSDT/cUSDC, cUSDT/USDT, cUSDC/USDC)** | ✅ Created | cUSDT/cUSDC: `0x9fcB06Aa1FD5215DC0E91Fd098aeff4B62fEa5C8`; cUSDT/USDT: `0xa3Ee6091696B28e5497b6F491fA1e99047250c59`; cUSDC/USDC: `0x90bd9Bf18Daa26Af3e814ea224032d015db58Ea5`. | | **DODOPMMProvider** | ✅ Deployed | `0x8EF6657D2a86c569F6ffc337EE6b4260Bd2e59d0`; all three pools registered via `script/liquidity/RegisterDODOPools.s.sol`. | | **EnhancedSwapRouter** | ❌ Not deployed | Mainnet-only script today; for Chain 138 deploy when Uniswap/Balancer pools exist; set quoter/poolId. | | **Token-aggregation API** | ✅ Implemented, runnable | Single-hop quotes; can index DODO once pools exist (set `CHAIN_138_DODO_PMM_INTEGRATION`). | | **Bridge quote (swap+bridge+swap)** | ✅ Implemented | `POST /api/bridge/quote`; on-chain coordinator optional. | | **Cross-chain cW* mesh** | Design/tooling only | Edge pools and bots not deployed. | --- ## 2. Prerequisites before running deployment - [ ] **RPC 2101 (Core) writable** If Core was read-only: run `./scripts/maintenance/make-rpc-vmids-writable-via-ssh.sh` then `./scripts/maintenance/health-check-rpc-2101.sh`. See [RPC_2101_READONLY_FIX.md](RPC_2101_READONLY_FIX.md). - [ ] **Deployer wallet funded (Chain 138)** At least ~0.006 ETH (5M gas × 1 gwei + buffer). Recommended 1–2 ETH. Check: `./scripts/deployment/check-balances-gas-and-deploy.sh` (from `smom-dbis-138`). - [ ] **Env set in `smom-dbis-138/.env` only** Required: `PRIVATE_KEY`, `RPC_URL_138` (must be Core RPC, not Public). For PMM: `DODO_PMM_INTEGRATION_ADDRESS=0x79cdbaFBaA0FdF9F55D26F360F54cddE5c743F7D`. Optional: `GAS_PRICE_138` or `GAS_PRICE` (default 1 gwei). After TransactionMirror deploy: set `TRANSACTION_MIRROR_ADDRESS` from script output. Verify: `cd smom-dbis-138 && ./scripts/deployment/check-env-required.sh`. - [ ] **Gas / cost estimate run** Before deploying: `cd smom-dbis-138 && ./scripts/deployment/calculate-costs-consolidated.sh` for estimated deployment cost (Chain 138 min gas 1 gwei). - [ ] **Deployer has POOL_MANAGER_ROLE on DODOPMMIntegration** Pool creation and (if used) DODOPMMProvider registration require this role. - [ ] **No stuck transactions** Do not deploy if there are pending/stuck txs. If you see "Replacement transaction underpriced" or stuck nonce: run `./scripts/clear-all-transaction-pools.sh` then wait ~60s before re-running deploy. Use scripts that check nonce when available. --- ## 3. Steps to complete before deployment (in order) ### Step 1: Deploy TransactionMirror (if not already deployed) ```bash cd smom-dbis-138 export RPC_URL_138="${RPC_URL_138:-http://192.168.11.211:8545}" forge script script/DeployTransactionMirror.s.sol:DeployTransactionMirror \ --rpc-url "$RPC_URL_138" --broadcast --private-key "$PRIVATE_KEY" --with-gas-price 1000000000 ``` - Save the logged TransactionMirror address to `smom-dbis-138/.env` as `TRANSACTION_MIRROR_ADDRESS`. ### Step 2: Create PMM pools (mesh-first; legacy three as minimum) Use **Core RPC only** (no Public fallback). Preferred is full mesh creation; use legacy three-pool flow as minimum fallback. **2a) Preferred — full mesh on Chain 138:** ```bash cd smom-dbis-138 # Creates c* vs c*; optional c* vs official USDT/USDC; optional c* vs WETH; optional official vs WETH. ./scripts/create-pmm-full-mesh-chain138.sh # Optional flags: # MESH_ONLY_C_STAR=1 # MESH_INCLUDE_WETH=0 # MESH_INCLUDE_OFFICIAL_WETH=0 ``` **2b) Combined (TransactionMirror + cUSDT/cUSDC pool only):** ```bash ./scripts/deployment/deploy-transaction-mirror-and-pmm-pool-after-txpool-clear.sh ``` This deploys TransactionMirror then creates **only** the cUSDT/cUSDC pool. For minimum legacy completion use 2c. **2c) Create each legacy pool manually** (e.g. after 2b, or if mirror already deployed): ```bash cd smom-dbis-138 export DODO_PMM_INTEGRATION="${DODO_PMM_INTEGRATION_ADDRESS:-0x79cdbaFBaA0FdF9F55D26F360F54cddE5c743F7D}" export RPC_URL_138="${RPC_URL_138:-http://192.168.11.211:8545}" export GAS_PRICE="${GAS_PRICE_138:-${GAS_PRICE:-1000000000}}" # cUSDT/cUSDC forge script script/dex/CreateCUSDTCUSDCPool.s.sol:CreateCUSDTCUSDCPool \ --rpc-url "$RPC_URL_138" --broadcast --private-key "$PRIVATE_KEY" --with-gas-price "$GAS_PRICE" # cUSDT/USDT forge script script/dex/CreateCUSDTUSDTPool.s.sol:CreateCUSDTUSDTPool \ --rpc-url "$RPC_URL_138" --broadcast --private-key "$PRIVATE_KEY" --with-gas-price "$GAS_PRICE" # cUSDC/USDC forge script script/dex/CreateCUSDCUSDCPool.s.sol:CreateCUSDCUSDCPool \ --rpc-url "$RPC_URL_138" --broadcast --private-key "$PRIVATE_KEY" --with-gas-price "$GAS_PRICE" ``` If you see “Replacement transaction underpriced”, wait for the pending tx to be mined or clear the tx pool, then retry (optionally with higher gas). After each creation, note the pool address for Step 4. ### Step 3: Add liquidity to pools (optional but recommended) Use `DODOPMMIntegration.addLiquidity(pool, baseAmount, quoteAmount)` for each pool. Approve base/quote tokens to the integration contract first. See [DODO_PMM_INTEGRATION.md](../../smom-dbis-138/docs/integration/DODO_PMM_INTEGRATION.md). ### Step 4: Deploy DODOPMMProvider and register pools ```bash cd smom-dbis-138 forge script script/liquidity/DeployDODOPMMProvider.s.sol:DeployDODOPMMProvider \ --rpc-url "$RPC_URL_138" --broadcast --private-key "$PRIVATE_KEY" --with-gas-price "$GAS_PRICE" ``` Save the logged address as `DODO_PMM_PROVIDER_ADDRESS` in `.env`. Then register each created pool (legacy three at minimum, full mesh when used): ```solidity provider.registerPool(tokenIn, tokenOut, poolAddress); ``` (e.g. via `cast send` or a small script) so that `getQuote` / `executeSwap` work for those pairs. ### Step 5: EnhancedSwapRouter (optional, when Uniswap/Balancer exist on 138) Current deploy script is mainnet-only (`block.chainid == 1`). For Chain 138: - When Uniswap V3 / Balancer pools exist on 138, add or use a Chain-138–aware deploy script (env-based quoter/poolId). - Run with `--rpc-url $RPC_URL_138` and configure quoter and Balancer poolId after deploy. See [CONTRACT_DEPLOYMENT_RUNBOOK.md](CONTRACT_DEPLOYMENT_RUNBOOK.md) § EnhancedSwapRouter. ### Step 6: Token-aggregation API (DODO indexing) - Ensure `CHAIN_138_DODO_PMM_INTEGRATION=0x79cdbaFBaA0FdF9F55D26F360F54cddE5c743F7D` (or equivalent) is set where the token-aggregation service runs. Optional: `CHAIN_138_DODO_POOL_MANAGER`, `CHAIN_138_DODO_VENDING_MACHINE` (see token-aggregation `.env.example` and [dex-factories.ts](../../smom-dbis-138/services/token-aggregation/src/config/dex-factories.ts)). - Once pools exist, the service can index DODO pools from DODOPMMIntegration and expose single-hop quotes. ### Step 7: On-chain verification After any new deployment: ```bash ./scripts/verify/check-contracts-on-chain-138.sh [RPC_URL] ``` Target: all expected addresses (e.g. 59/59 per check-contracts-on-chain-138.sh when TransactionMirror, DODO pools, vault/reserve, and CompliantFiatTokens are present). Update [REQUIRED_FIXES_AND_DEPLOYMENTS_STATUS.md](REQUIRED_FIXES_AND_DEPLOYMENTS_STATUS.md) and [CONTRACT_ADDRESSES_REFERENCE.md](../11-references/CONTRACT_ADDRESSES_REFERENCE.md) with new pool and provider addresses. --- ## 4. Script reference | Script | Purpose | |--------|---------| | `scripts/deployment/deploy-transaction-mirror-and-pmm-pool-after-txpool-clear.sh` | Deploy TransactionMirror + create cUSDT/cUSDC pool (Core RPC only). | | `smom-dbis-138/script/dex/CreateCUSDTCUSDCPool.s.sol` | Create cUSDT/cUSDC pool. | | `smom-dbis-138/script/dex/CreateCUSDTUSDTPool.s.sol` | Create cUSDT/USDT pool. | | `smom-dbis-138/script/dex/CreateCUSDCUSDCPool.s.sol` | Create cUSDC/USDC pool. | | `smom-dbis-138/script/liquidity/DeployDODOPMMProvider.s.sol` | Deploy DODOPMMProvider (then register pools). | | `smom-dbis-138/script/bridge/trustless/DeployEnhancedSwapRouter.s.sol` | Deploy EnhancedSwapRouter (mainnet-only; Chain 138 needs env/config). | | `scripts/verify/check-contracts-on-chain-138.sh` | Verify expected contract addresses on Chain 138. | --- ## 5. References - [POOLS_AND_NETWORKS_FULL_DESIGN.md](../11-references/POOLS_AND_NETWORKS_FULL_DESIGN.md) — Every pool and network in the full design (61 pools, 6 networks). - [REQUIRED_FIXES_AND_DEPLOYMENTS_STATUS.md](REQUIRED_FIXES_AND_DEPLOYMENTS_STATUS.md) — RPC fix, missing contracts, completion steps. - [UNDEPLOYED_CONTRACTS_PRE_DEPLOYMENT_TASKS.md](UNDEPLOYED_CONTRACTS_PRE_DEPLOYMENT_TASKS.md) — Dry-run and validation tasks. - [PMM_DEX_ROUTING_STATUS.md](../11-references/PMM_DEX_ROUTING_STATUS.md) — Full PMM/DEX routing status. - [DODO_PMM_INTEGRATION.md](../../smom-dbis-138/docs/integration/DODO_PMM_INTEGRATION.md) — Pool creation, liquidity, swap usage. - [CONTRACT_DEPLOYMENT_RUNBOOK.md](CONTRACT_DEPLOYMENT_RUNBOOK.md) — EnhancedSwapRouter & DODOPMMProvider config.