# Chain 138 Deployment: Warnings and Optional Tasks

**Last updated:** 2026-02-20

This document lists warnings and errors from deployment/verification and how they were fixed or deferred, plus a consolidated **Todos list** including optional tasks.

---

## 1. Warnings and Errors Addressed

### 1.1 Verify script (verify-chain138-full-deployment.sh)

| Item | Before | After |
|------|--------|--------|
| **CCIPTxReporter not in .env** | Error | Warning (optional; set `CHAIN138_CCIP_REPORTER` when deployed) |
| **genesis.json not found** | Error | Warning (optional for RPC-only Chain 138) |
| **Namespace besu-network not found** | Warning | Unchanged (optional when not using K8s for Chain 138) |
| **log_info / log_success / log_warn / log_error** | Undefined when init.sh not loaded | Fallback functions defined in script |
| **Unset CHAIN138_CCIP_REPORTER etc.** | Script exit (set -u) | Defaults set after sourcing .env |

Verification now exits **0** when only optional items are missing; failures are reserved for required RPC, .env, and core contracts.

### 1.2 @emoney/interfaces (Hardhat / CCIPLogger)

- **Issue:** Hardhat compile failed with `Library @emoney/interfaces is not installed` when running `deploy-ccip-logger-all-chains.sh`.
- **Fix:** Replaced `@emoney/interfaces` with relative imports:
  - `contracts/reserve/ReserveTokenIntegration.sol`: `../emoney/interfaces/IeMoneyToken.sol`, `../emoney/interfaces/ITokenFactory138.sol`
  - `script/reserve/DeployReserveSystem.s.sol`: `../../contracts/emoney/interfaces/ITokenFactory138.sol`
- **Note:** Forge already remaps `@emoney/=contracts/emoney/` in `foundry.toml`; Hardhat has no remapping, so relative imports were used.

### 1.3 Hardhat compile (CCIPLogger deploy)

- **Issue:** After adding 0.8.22 for OpenZeppelin, full Hardhat compile can hit “Stack too deep” (needs `viaIR: true`) and is slow.
- **Status:** Hardhat config has two compilers (0.8.20, 0.8.22). If “Stack too deep” appears, enable `viaIR: true` in `hardhat.config.js` for the relevant compiler(s); compile may be slow. CCIPLogger deploy remains **optional**; see ensure-prerequisites.sh.

### 1.4 LINK funding (fund-ccip-bridges-with-link.sh)

- **Issue:** All chains failed (insufficient LINK, RPC, or gas).
- **Status:** Operator must hold LINK on each target chain and re-run the script. No code change.

### 1.5 DODO_VENDING_MACHINE_ADDRESS

- **Issue:** ensure-prerequisites.sh warns when unset; run-pmm-and-pools.sh exits if unset.
- **Status:** Documented in .env.example; set to DODO DVM factory on Chain 138 when using PMM. See docs/deployment/ALL_MAINNETS_DEPLOYMENT_RUNBOOK.md.

---

## 2. .env Additions

- **CHAIN138_CCIP_REPORTER:** Optional. Documented in .env.example; set after deploying CCIPTxReporter (e.g. deploy-ccip-reporter or CCIPLogger).
- **DODO_VENDING_MACHINE_ADDRESS:** Comment in .env.example clarified (DVM factory on Chain 138; ensure-prerequisites warns if unset).

---

## 3. Master Todos List (including optional)

### Required / one-time

- [x] Update .env with phased core addresses after 01_DeployCore / 02_DeployBridges.
- [x] Run ensure-prerequisites.sh before deploy.
- [x] Run check-balances-gas-and-deploy.sh (and --deploy for Chain 138 when intended).
- [x] Fix verify-chain138-full-deployment.sh (optional checks → warnings; log_* fallbacks; unset vars).
- [x] Fix @emoney/interfaces for Hardhat (relative imports in ReserveTokenIntegration and DeployReserveSystem).
- [x] Add .env.example placeholders/comments for CHAIN138_CCIP_REPORTER and DODO_VENDING_MACHINE_ADDRESS.

### Optional

- [x] **LINK funding:** Script run; transfers failed (deployer needs LINK on each chain). Re-run when LINK is available.
- [x] **CCIPLogger:** Hardhat viaIR + 0.8.22. Deployed to mainnet at `0x4F95297C23d9f4A1032B1c6a2E553225CB175BEe`; `CCIP_LOGGER_ETH_ADDRESS` in .env.
- [x] **PMM / DODO:** Mock DVM deployed on Chain 138 (`MockDVMFactory` + `MockDVMPool`); `DODO_VENDING_MACHINE_ADDRESS` and `DODO_PMM_INTEGRATION` set; `run-pmm-and-pools.sh` run. For real DODO liquidity use official DVM (see DVM_DEPLOYMENT_CHECK.md).
- [x] **CCIPTxReporter:** Contract added, deployed to Chain 138 at `0x3F88b662F04d9B1413BA8d65bFC229e830D7d077`; `CHAIN138_CCIP_REPORTER` in .env.
- [x] **genesis.json:** Left as warning for RPC-only.
- [x] **Kubernetes / besu-network:** Left as warning when not using K8s.
- [x] **Forge clean:** Run when needed; `forge build` available.

### Reference

- Prerequisites: `scripts/deployment/ensure-prerequisites.sh`
- Balance check + deploy: `scripts/deployment/check-balances-gas-and-deploy.sh` [--deploy]
- Verification: `scripts/deployment/verify-chain138-full-deployment.sh`
- LINK: `scripts/deployment/fund-ccip-bridges-with-link.sh`
- PMM: `scripts/deployment/run-pmm-and-pools.sh`
- CCIPLogger: `scripts/deployment/deploy-ccip-logger-all-chains.sh`
- Single env source: `smom-dbis-138/.env` (see docs/04-configuration/DOTENV_FILES_REFERENCE.md in parent repo).
