**Note: Nothing here is optional nor future — these are planned deployments (Chain 138 and multichain).**
**Last Updated:** 2026-02-16
**Purpose:** Single entry point to run all deployments: AddressMapper (other chains), DODO PMM 138, Mainnet trustless, Paymaster. Run from repo root or `smom-dbis-138/` with `.env` and PRIVATE_KEY.
---
## Completion status (automated run)
| Step | Status | Notes |
|------|--------|------|
| **§1 Dry-run** | ✅ Done | `./scripts/run-optional-deployments.sh --dry-run` — all phases listed; phases 4, 6, 7, 8, 9 would run (1–3, 5 skipped when env set). |
| **§2A AddressMapper (Cronos)** | ✅ Deployed | Deployed at `0x6F521cd9FCF7884cD4E9486c7790e818638e09Dd` on Cronos (chain 25). `config/smart-contracts-master.json` → `chains["25"].mapper` updated. |
| **§2B DODO PMM 138** | ✅ Code | Phase 7 skips unless `DODO_VENDING_MACHINE_ADDRESS` is set; DeployDODOPMMIntegration.s.sol no-ops when required env unset. Set DODO_VENDING_MACHINE_ADDRESS + COMPLIANT_* to run. |
| **§2C Trustless (Mainnet)** | ✅ Unblocked | `ETHEREUM_MAINNET_RPC` set to https://ethereum.publicnode.com; DeployTrustlessBridge run (BondManager, InboxETH, LiquidityPoolETH, etc.). Addresses in smom-dbis-138/.env (`*_MAINNET`). Re-run deploy if broadcast was interrupted. |
| **Phase 4 Reserve Keeper** | ✅ Code | Script skips Phase 4 unless `ORACLE_PRICE_FEED` or `RESERVE_KEEPER` is set; DeployKeeper.s.sol no-ops with message when ORACLE_PRICE_FEED unset. Set env to run or skip. |
**To finish deployments:** If Phase 6/8 failed with "Replacement transaction underpriced", run **Fix stuck transaction** (cancel-pending or flush-stuck-tx) first, then `./scripts/run-optional-deployments.sh --execute --phases 6,8`. Set DODO env vars for §2B to run Phase 7. Use a Mainnet RPC that accepts your key for §2C Mainnet.
---
## What else is needed (beyond PRIVATE_KEY in .env)
All steps read `PRIVATE_KEY` from `smom-dbis-138/.env`. In addition:
| Item | Required in .env | Notes |
|------|------------------|------------------|
| **§2A AddressMapper (other chain)** | None | Set `RPC_URL` or `CRONOS_RPC` for target chain (e.g. `CRONOS_RPC=https://evm.cronos.org`). Deployer needs native gas on that chain (e.g. CRO on Cronos). |
| **§2B DODO PMM 138** | `DODO_VENDING_MACHINE_ADDRESS`, `COMPLIANT_USDT_ADDRESS`, `COMPLIANT_USDC_ADDRESS` | `OFFICIAL_USDT_ADDRESS`, `OFFICIAL_USDC_ADDRESS`, `DODO_APPROVE_ADDRESS`. Get DODO Vending Machine from [DODO docs](https://docs.dodoex.io/) or Chain 138 DODO deployment. `.env.example` has COMPLIANT_*; add `DODO_VENDING_MACHINE_ADDRESS=0x...`. |
| **§2C Trustless (138)** | `RPC_URL_138` | Defaults to `http://192.168.11.211:8545` if unset. Deployer needs ETH on 138. |
| **§2C Trustless (Mainnet)** | `ETHEREUM_MAINNET_RPC` | Deployer needs ETH on Mainnet. Add `--broadcast --via-ir --verify` when running. |
| **§2D Paymaster** | `RPC_URL_138` | Script is informational. To deploy: use ERC-4337 / Smart Accounts kit, then set `ENTRY_POINT`, `SMART_ACCOUNT_FACTORY`, `PAYMASTER` in .env. |
| **§3 Run all** | `RPC_URL_138` | Same as above; Phase 7 (DODO) only runs if `DODO_VENDING_MACHINE_ADDRESS` (and compliant USDT/USDC) are set. |
| **Phase 4 (Reserve Keeper)** | `ORACLE_PRICE_FEED` or `RESERVE_KEEPER` | Set `ORACLE_PRICE_FEED` to deploy a new keeper; or set `RESERVE_KEEPER` to an existing PriceFeedKeeper address to skip (e.g. from `config/smart-contracts-master.json` chain 138 `Price_Feed_Keeper`). |
**Summary:** For **§2A, §2C (138), §3** you only need `PRIVATE_KEY` and `RPC_URL_138` (and gas on the chain). For **§2B** add the three DODO/compliant vars. For **§2C Mainnet** add `ETHEREUM_MAINNET_RPC` and Mainnet ETH.
**If you see "Replacement transaction underpriced":** A **stuck transaction** (same nonce as the next deploy) is in the node’s mempool. Raising gas on the deploy does not fix it. Do one of the following, then re-run the deploy:
1.**Replace the stuck tx (recommended):** From repo root, run
`./scripts/cancel-pending-transactions.sh`
(sources `smom-dbis-138/.env`, sends 0-value self-transfers at the stuck nonce(s) with high gas so they replace and clear). If the script reports "No pending" but deploy still fails, try
to send one replacement at the current nonce (uses 500 gwei; set `GAS_PRICE_138` for higher). Then run `./scripts/run-optional-deployments.sh --execute --phases 6,8`.
2.**Clear the node mempool (Chain 138 RPC/validators):** From a host that can reach the RPC, run
`./scripts/flush-stuck-tx-rpc-and-validators.sh`
(tries `txpool_besuClear` on RPC, or full pool clear on validators). Then run the deploy again.
3.**If replacement still fails (e.g. "underpriced" even at 500 gwei):** The RPC node may have a stuck tx that Besu will not replace by gas price, or the pool clear did not affect that node. **Option A:** Run `flush-stuck-tx-rpc-and-validators.sh` from the **same host that serves the RPC** (e.g. the Chain 138 RPC VM), then run the deploy **from a machine on the same LAN** immediately after. **Option B:** Use a fresh deployer wallet so the next nonce is 0.
4.**After all else: verify RPC 2101 full approve and in sync with 5 validators.** Run
to confirm the RPC on VMID 2101 has Chain 138, ADMIN API, ≥5 peers (including all 5 validator IPs 192.168.11.100–104), block production advancing, and optionally all 5 validators active (requires SSH from LAN). Ensures the RPC is permissioned and synced before or after deploy.
**Where the stuck transaction comes from:** The stuck tx is the **Lockbox138 deploy** (Phase 6) from a previous run. Forge sent it with nonce 13274 to the **RPC at VMID 2101** (192.168.11.211). The RPC accepted it into its **local transaction pool**, but the tx was never included in a block (e.g. block production stalled, or the tx was never propagated to validators). So it sits in the **RPC node’s mempool** at nonce 13274. Every new tx you send at 13274 is treated as a replacement; Besu rejects it as “underpriced” unless the new tx has higher gas than the one already in the pool (or the pool is cleared). The full flush (`clear-all-transaction-pools.sh`) runs over **SSH** on the Proxmox host (r630-01); if you ran it from a machine without SSH to 192.168.11.11, the RPC pool may not have been cleared. After a restart, validators can also re-gossip the same tx back to the RPC. See [STUCK_TX_ROOT_CAUSE_AND_GUARDRAILS](../08-monitoring/STUCK_TX_ROOT_CAUSE_AND_GUARDRAILS.md).
**Phase 4 and Phase 7 skip automatically** when required env is missing: Phase 4 is skipped unless `ORACLE_PRICE_FEED` or `RESERVE_KEEPER` is set; Phase 7 is skipped unless `DODO_VENDING_MACHINE_ADDRESS` is set (and the Forge script also no-ops if compliant USDT/USDC are unset).
1.**Update env:** Add new addresses to `smom-dbis-138/.env` (and root `.env` if used). See script output for `export ...` lines.
2.**Update config:** In `config/smart-contracts-master.json` set `chains["<chainId>"].mapper` and `contracts.Address_Mapper` for other-chain mappers; add DODO/Trustless addresses when deployed.
3.**Verify:** Run `./scripts/verify/check-contracts-on-chain-138.sh`. From LAN with secrets: `./scripts/verify/run-contract-verification-with-proxy.sh` for Blockscout.
4.**Periodic checks:** Run `./scripts/run-completable-tasks-from-anywhere.sh` (config + on-chain + validation).
| 4 | Check contracts on 138 | `./scripts/verify/check-contracts-on-chain-138.sh` |
| 4b | **After all else:** RPC 2101 full approve and in sync | `./scripts/verify/verify-rpc-2101-approve-and-sync.sh` — full fix flow: [RPC_AND_VALIDATOR_TESTING_RUNBOOK](../08-monitoring/RPC_AND_VALIDATOR_TESTING_RUNBOOK.md). |