# All Next Steps (Current)

**Last updated:** 2026-02-23  
**Status:** Repo is unblocked. Dotenv uses correct file (repo-root `.env` or `ENV_FILE`). Remaining steps are operator/env and one external dependency.

---

## Priority: Obtain liquid on Mainnet & wire off/on-ramps

**First:** Get liquidity on Ethereum Mainnet so 138→mainnet flows complete; then wire fiat on-ramps and off-ramps.

- **Priority doc:** [MAINNET_LIQUIDITY_AND_RAMPS_PRIORITY.md](../../../docs/00-meta/MAINNET_LIQUIDITY_AND_RAMPS_PRIORITY.md) (in `docs/00-meta/`).
- **Summary:** (1) Fund deployer with ETH/WETH on mainnet. (2) Run `fund-mainnet-lp.sh` and, if used, `fund-mainnet-relay-bridge.sh`. (3) Wire ramp API (metamask-integration) and document on-ramp (buy on mainnet → bridge to 138) and off-ramp (138→mainnet → sell).

---

## Unblocked in repo

| Item | Status |
|------|--------|
| **Dotenv** | `scripts/lib/deployment/dotenv.sh` loads `ENV_FILE` if set and existing, else `PROJECT_ROOT/.env`. Export `ENV_FILE` to use a different file. |
| **load-env.sh** | Sets and exports `ENV_FILE` to repo-root `.env` unless already set; scripts using `load_deployment_env` use the same file. |
| **run-all-four-gaps.sh** | Uses dotenv lib; respects `ENV_FILE`. |
| **Fund/deploy scripts** | Use `load_deployment_env` (fund-ccip-bridges-with-link.sh, fund-mainnet-lp.sh, deploy-pmm-all-l2s.sh, deploy-trustless-l2s.sh, etc.). |
| **Burn/Mint AMB** | Scripts, validation (14 Forge tests), and docs in place. Live transfer blocked only by CCIP network (see below). |

---

## 1. Environment (do first)

- **Create/use correct .env:** Copy `.env.example` to `.env` in repo root (or set `ENV_FILE=/path/to/your/.env` when running scripts).
- **Required in .env:** `PRIVATE_KEY`, `RPC_URL_138` (or `RPC_138`). For fund mainnet LP: `LIQUIDITY_POOL_ETH_MAINNET` (or `LIQUIDITY_POOL`), `ETHEREUM_MAINNET_RPC`. For CCIP funding: per-chain RPC and LINK token addresses.

---

## 2. Operator runbook order

| # | Step | Command / note |
|---|------|----------------|
| 1 | **DApp LXC (5801)** | `./scripts/deployment/deploy-dapp-lxc.sh`. Configure Cloudflare Tunnel, DNS, NPMplus for dapp.d-bis.org. |
| 2 | **Fund mainnet LP (G4)** | Set `LIQUIDITY_POOL_ETH_MAINNET` in .env. Then: `./scripts/deployment/fund-mainnet-lp.sh --eth 1 --weth 0.5` (or interactive). |
| 3 | **Fund CCIP bridges with LINK** | Deployer must have LINK (and gas) on each chain. `./scripts/deployment/fund-ccip-bridges-with-link.sh` (use `DRY_RUN=1` first to print commands). |
| 4 | **Burn/Mint AMB checks** | If present in your clone: `./scripts/bridge/check-deployer-balances-all-destinations.sh`, `./scripts/bridge/check-burn-mint-amb-link-balances.sh`, `./scripts/monitoring/check-burn-mint-amb-138-health.sh`, `./scripts/verify/run-burn-mint-amb-validation.sh`. Otherwise use `cast balance` and contract reads per §3 and deployment docs. |
| 5 | **Optional G1 – PMM on L2s** | `./scripts/deployment/deploy-pmm-all-l2s.sh` (or `--chain polygon base`). Needs per-chain RPC and DVM/token addresses in .env. |
| 6 | **Optional G2 – Trustless L2s** | `./scripts/deployment/deploy-trustless-l2s.sh` (optionally `--chain polygon`). |
| 7 | **Optional G3 – Lockbox L2s** | `./scripts/deployment/deploy-trustless-l2s.sh --lockbox`. |
| 8 | **Optional – CCIPLogger other chains** | `./scripts/deployment/deploy-ccip-logger-all-chains.sh`. Needs Node/npm and Hardhat. |
| 9 | **Verification** | `./scripts/deployment/verify-chain138-full-deployment.sh`, `forge test`, DApp build and E2E as in runbook. |

---

## 3. Burn/Mint AMB (138 → hop)

- **Live transfer:** Blocked by **CCIP Router "chain not supported"** until Chainlink CCIP supports Chain 138 as source and target hop chains (e.g. BSC 56) as destinations. No repo change can fix this.
- **After CCIP is configured:**  
  1. Ensure deployer has WETH and LINK on 138 (mint LINK via Forge script or bridge script if present: e.g. `./scripts/bridge/mint-link-chain138.sh`).  
  2. Run test transfer if script present: `ASSUME_LINK_WEI=1000000000000000000 ./scripts/verify/send-burn-mint-amb-test-transfer.sh 56 1000000000000000`; otherwise use Forge/cast per deployment docs.  
  3. On destination, verify recipient BridgedWETH balance (see `config/smart-contracts-master.json` for BridgedWETH address).
- **If transfer fails:** `cast run <txHash> --rpc-url "$RPC_URL_138"` for revert reason.

---

## 4. Optional / as needed

- **LINK on all chains:** Re-run `fund-ccip-bridges-with-link.sh` after funding deployer with LINK (and gas) on each chain.
- **PMM pool creation:** Grant POOL_MANAGER_ROLE and create pools on DODO_PMM_INTEGRATION; for real liquidity use official DVM (see DVM_DEPLOYMENT_CHECK.md).
- **Etherscan verification:** After Etherscan V2 migration, verify CCIPLogger and other contracts per deployment docs.
- **Polygon deployer balance:** If `check-deployer-balances-all-destinations.sh` reports Polygon (137) LOW, fund deployer with MATIC. Use `--report-only` or `ALLOW_LOW_BALANCE=1` for report-only.
- **New Burn/Mint AMB hop:** Run `deploy-burn-mint-amb.sh hop`, set `BURN_MINT_AMB_RECEIVER_<id>`, run destinations script, then `enable-no-prefunding-bridged-weth.sh <id>`. Routers in `scripts/bridge/ccip-router-addresses.env`.

---

## 5. Quick reference

| Task | Command |
|------|--------|
| Load correct .env | `source scripts/load-env.sh` or `ENV_FILE=/path/to/.env source scripts/load-env.sh` |
| Deployer balances | `./scripts/bridge/check-deployer-balances-all-destinations.sh` [--report-only] (if present; else use cast) |
| Burn/Mint LINK + health | `./scripts/bridge/check-burn-mint-amb-link-balances.sh`, `./scripts/monitoring/check-burn-mint-amb-138-health.sh` (if present) |
| Burn/Mint validation | `./scripts/verify/run-burn-mint-amb-validation.sh` (if present) |
| Fund CCIP (dry-run) | `DRY_RUN=1 ./scripts/deployment/fund-ccip-bridges-with-link.sh` |
| Fund mainnet LP | Set `LIQUIDITY_POOL_ETH_MAINNET` in .env, then `./scripts/deployment/fund-mainnet-lp.sh --eth 1 --weth 0.5` |
| Liquidity gaps (G1–G4) | `./scripts/deployment/run-all-four-gaps.sh` [g1 g2g3 g4] [--eth 1 --weth 0.5] |
| Verify Chain 138 | `./scripts/deployment/verify-chain138-full-deployment.sh` |
| Verify on other chains (same Etherscan key) | [ETHERSCAN_V2_VERIFY_OTHER_CHAINS.md](ETHERSCAN_V2_VERIFY_OTHER_CHAINS.md); run `./scripts/deployment/verify-ccip-logger-other-chains.sh` (after setting CCIP_LOGGER_* and CCIP_*_ROUTER in .env) or `npx hardhat verify --network <net> <address> "<router>" "0x0...0" 138` |

---

## Summary

- **Repo:** Unblocked. Correct dotenv (repo-root `.env` or `ENV_FILE`) is used by deployment and bridge scripts.
- **External blocker:** Live 138→hop Burn/Mint AMB transfer until CCIP supports Chain 138 and destinations.
- **Operator:** Set .env (and `LIQUIDITY_POOL_ETH_MAINNET` for G4), then run runbook steps and optional items above.
