# Prerequisites for LINK Funding, PMM, and CCIPLogger

Complete these **before** running the three operator task scripts.

---

## 1. Environment

- **`.env`** in `smom-dbis-138` with at least:
  - `PRIVATE_KEY` — deployer key (with gas on each chain and LINK where needed).
  - `RPC_URL_138` — Chain 138 RPC.
  - Per-chain RPC and CCIP vars (see runbook and `.env.example`).

**Check:** Run `scripts/deployment/ensure-prerequisites.sh` to validate and fix what can be automated.

---

## 2. Dependencies (for CCIPLogger)

- From **`smom-dbis-138`** run:
  ```bash
  npm install --legacy-peer-deps
  ```
  so Hardhat is available in `smom-dbis-138/node_modules`.

- If Hardhat compile fails (e.g. missing `@emoney/interfaces`), either:
  - Install the missing package if it exists, or
  - Skip CCIPLogger (optional) or use a Foundry-only workflow.

---

## 3. LINK funding

- **Requirement:** Deployer must hold **LINK** on each chain where you fund bridges (Chain 138, Ethereum, BSC, Polygon, Base, Optimism, Arbitrum, Avalanche, Cronos, Gnosis).
- **.env:** Bridge and LINK token vars are already set from deployment; no extra prereq except balance.
- **Script:** `scripts/deployment/fund-ccip-bridges-with-link.sh` (use `DRY_RUN=1` first).

---

## 4. PMM (Chain 138)

- **Requirement:** A **DODO Vending Machine (DVM) factory** address on Chain 138.
  - DODO does not list Chain 138; use your own deployment or an existing DVM if available.
- **.env:** Set:
  - `DODO_VENDING_MACHINE_ADDRESS` — DVM factory on Chain 138.
  - `OFFICIAL_USDT_ADDRESS=0x004b63A7B5b0E06f6bB6adb4a5F9f590BF3182D1`, `OFFICIAL_USDC_ADDRESS=0x71D6687F38b93CCad569Fa6352c876eea967201b` — live Chain 138 quote-side mirror stables for PMM pools.
  - `COMPLIANT_USDT_ADDRESS`, `COMPLIANT_USDC_ADDRESS` — already set.
- **Script:** `scripts/deployment/run-pmm-and-pools.sh`.

---

## 5. CCIPLogger (optional)

- **Requirement:** Node/npm and Hardhat in `smom-dbis-138` (see §2).
- **.env:** `PRIVATE_KEY` and per-chain RPC (Hardhat reads `.env`).
- **Script:** `scripts/deployment/deploy-ccip-logger-all-chains.sh` (run from `smom-dbis-138`).

---

## One-shot check

From `smom-dbis-138`:

```bash
./scripts/deployment/ensure-prerequisites.sh
```

Then run each task script as needed (LINK funding, PMM, CCIPLogger).
