# All Mainnets Deployment Runbook — CCIP, Trustless Bridge, Oracle, AMB, Mapper, PMM (Anchored to ChainID 138)
This runbook ensures deployment of **CCIP Bridge**, **Trustless Bridge**, **Oracle**, **AMB Messaging** (relay), **Mapper**, and **PMM Liquidity Pools** across all mainnets, anchored to ChainID 138.
---
## 1. Prerequisites
- **One-shot check:** Run `scripts/deployment/ensure-prerequisites.sh` from `smom-dbis-138` to validate .env and deps (see [PREREQUISITES.md](./PREREQUISITES.md)).
-`.env` with `PRIVATE_KEY`, `RPC_URL_138`, `ETHEREUM_MAINNET_RPC`, and per-chain RPC/CCIP vars (see below).
- **Dependencies (CCIPLogger):** From `smom-dbis-138` run `npm install --legacy-peer-deps` so Hardhat is available locally.
- Sufficient gas token on each target chain (run `scripts/deployment/check-balances-gas-and-deploy.sh`).
- For **LINK funding:** deployer must have LINK on each chain. For **PMM:** set `DODO_VENDING_MACHINE_ADDRESS` on Chain 138 when available.
- Verify CCIP router/LINK/selector per chain from [Chainlink CCIP Supported Networks](https://docs.chain.link/ccip/supported-networks) if you add new chains.
- **CCIP**: DeployAll.s.sol per chain. Chain 138 and Ethereum use existing WETH/bridges; other chains deploy or reuse WETH+bridges.
- **Trustless Bridge**: DeployTrustlessBridge.s.sol on **Chain 138** (Lockbox) and **Ethereum** (BondManager, ChallengeManager, LiquidityPool, InboxETH, SwapRouter, BridgeSwapCoordinator). Other mainnets not in scope for trustless bridge.
- **Oracle**: DeployOracle.s.sol — primary on Chain 138; optional on others if needed for price feeds.
- [x] Deploy Mapper: AddressMapper on 138 (0xe48E3f24...); AddressMapperEmpty on Ethereum, BSC, Polygon, Base, Arbitrum, Optimism, Avalanche, Cronos, Gnosis
- [ ] Deploy DODO PMM Integration + pools on Chain 138 (see **Remaining gaps: PMM** below)
- [x] Update config/smart-contracts-master.json with mapper addresses per chain (and Oracle on 138)
- [x] Configure bridge destinations (addDestination): Step B done for all mainnets (Ethereum, BSC, Polygon, Base, Optimism, Arbitrum, Avalanche, Cronos, Gnosis); Step A (138 → mainnets) uses `--gas-limit` in script (see **CCIP_BRIDGE_DESTINATIONS_AND_LINK_FUNDING.md**)
- [ ] Fund bridges with LINK on each chain (see **CCIP_BRIDGE_DESTINATIONS_AND_LINK_FUNDING.md**)
- [ ] Deploy CCIPLogger per chain if required (see **Remaining gaps: CCIPLogger** below)
### Remaining gaps: PMM and CCIPLogger
- **PMM (Chain 138):** The `pmm` phase of `deploy-all-mainnets-with-mapper-oracle-pmm.sh` is skipped unless `DODO_VENDING_MACHINE_ADDRESS` (and related DODO/stablecoin env vars) are set in `.env`. Deploy DODO PMM Integration and pools only after setting these; see §5.5 and run the DODO scripts manually.
- **CCIPLogger:** DeployAll.s.sol does **not** deploy CCIPLogger (outputs a Hardhat-based instruction). To have a logger on each mainnet, deploy per chain using the Hardhat script (e.g. `npm run deploy:logger:mainnet` or a chain-specific deployment). Optional for basic bridge operation.
1. Set **DODO_VENDING_MACHINE_ADDRESS** in `.env` to the DODO DVM factory adapter address on Chain 138. **Chain 138 is not in DODO’s official list** — see [DVM_DEPLOYMENT_CHECK.md](DVM_DEPLOYMENT_CHECK.md). Use `scripts/deployment/deploy-official-dvm-chain138.sh` to deploy the official DVM `0.6.9` stack from the vendored DODO tree and then deploy the local adapter.
Use `scripts/deployment/deploy-all-mainnets-with-mapper-oracle-pmm.sh` to run the above in order (see script for exact steps and guards).
## 8. Remaining operator tasks (scripts provided)
| Task | Script / Notes |
|------|----------------|
| Fund bridges with LINK | `scripts/deployment/fund-ccip-bridges-with-link.sh` — use `--link <amount>` (default 10 LINK), `--dry-run` to print only. See [CCIP_BRIDGE_DESTINATIONS_AND_LINK_FUNDING.md](./CCIP_BRIDGE_DESTINATIONS_AND_LINK_FUNDING.md). |
| PMM (Chain 138) | `scripts/deployment/run-pmm-and-pools.sh` — set `DODO_VENDING_MACHINE_ADDRESS` (and official tokens) in .env first; script runs pmm phase then optional XAU pools if `XAU_ADDRESS_138` and `DODOPMM_INTEGRATION_ADDRESS` are set. |
| CCIPLogger | `scripts/deployment/deploy-ccip-logger-all-chains.sh` — from `smom-dbis-138` run after `pnpm install`; deploys to mainnet, BSC, Polygon, Gnosis, Cronos. Optional. |
## 9. Related docs
- **Bridge destinations and LINK funding:** [CCIP_BRIDGE_DESTINATIONS_AND_LINK_FUNDING.md](./CCIP_BRIDGE_DESTINATIONS_AND_LINK_FUNDING.md) — `addDestination` per bridge and LINK funding for CCIP fees.