- Update dbis_core, cross-chain-pmm-lps, explorer-monorepo, metamask-integration, pr-workspace/chains - Omit embedded publish git dirs and empty placeholders from index Made-with: Cursor
189 lines
11 KiB
Markdown
189 lines
11 KiB
Markdown
# Pre-Deployment Checklist — DODO PMM, Pools, Provider, Router & APIs
|
||
|
||
**Last Updated:** 2026-04-02
|
||
**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 canonical official DODO V2 DVM-backed stack: `0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895`. |
|
||
| **PMM pools** | ✅ Reconciled | 104 desired-state pools aligned; live funded public pools include cUSDT/cUSDC `0x9e89bAe009adf128782E19e8341996c596ac40dC`, cUSDT/USDT `0x866Cb44b59303d8dc5f4F9E3E7A8e8b0bf238d66`, cUSDC/USDC `0xc39B7D0F40838cbFb54649d327f49a6DAC964062`, plus retained XAU public pools. |
|
||
| **DODOPMMProvider** | ✅ Deployed | `0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e`; canonical stable routes aligned. |
|
||
| **EnhancedSwapRouter** | ❌ Not deployed | Chain 138 deployment script exists, but live WETH-to-stable routes and non-DODO providers are still not configured. |
|
||
| **Token-aggregation API** | ✅ Implemented, runnable | Single-hop quotes; now persists the canonical Chain 138 DODO pool set on the live explorer deployment. |
|
||
| **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=0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895`, `DODO_PMM_PROVIDER_ADDRESS=0x3f729632E9553EBacCdE2e9b4c8F2B285b014F2e`.
|
||
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:-0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895}"
|
||
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=0x86ADA6Ef91A3B450F89f2b751e93B1b7A3218895` (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. **67/67** per check-contracts-on-chain-138.sh when TransactionMirror, DODO pools, vault/reserve, CompliantFiatTokens, ISO20022Router, and the cross-chain flash trio 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, provider, and flash-infrastructure 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` | Legacy router deployment path (mainnet-oriented). The live Chain 138 execution surface is `EnhancedSwapRouterV2` plus the funded pilot-compatible venue layer; verify with `scripts/verify/check-chain138-pilot-dex-venues.sh`. |
|
||
| `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.
|