Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- MASTER_INDEX: Last Updated 2026-03-06; status 59/59 contracts; add NEXT_STEPS_LIST, CONTRACT_NEXT_STEPS_LIST - docs/README, NEXT_STEPS_INDEX, 06-besu/MASTER_INDEX: Last Updated 2026-03-06 - Contract check script: 59 addresses (PMM, vault/reserve, CompliantFiatTokens); canonical CCIP/router - New docs: EXECUTION_CHECKLIST, NEXT_STEPS_LIST, DOTENV_AUDIT, ADDITIONAL_PATHS, deployer gas runbook, WEMIX_ACQUISITION_TABLED, etc. - Config: deployer-gas-routes, cro-wemix-swap-routes, routing-registry, token-mapping - Scripts: check-contracts-on-chain-138, check-pmm-pool-balances-chain138, deployer-gas-auto-route, acquire-cro-and-wemix-gas - Operator rule: operator-lan-access-check.mdc Made-with: Cursor
98 lines
6.7 KiB
Markdown
98 lines
6.7 KiB
Markdown
# Deployer Gas Auto-Route Runbook
|
|
|
|
**Purpose:** Convert deployer wallet ERC-20 (or compliant) tokens to **native gas tokens** on each target chain where balance is below threshold. Uses internal path (Chain 138), Protocolink (public chains), or manual/LiFi (Wemix).
|
|
|
|
**Deployer address:** `0x4A666F96fC8764181194447A7dFdb7d471b301C8`
|
|
|
|
---
|
|
|
|
## Prerequisites
|
|
|
|
1. **Balance check:** Run deployer balance check first so you know which chains need gas.
|
|
2. **Environment:** `smom-dbis-138/.env` (or project env loaded by `scripts/lib/load-project-env.sh`) with:
|
|
- `PRIVATE_KEY` or `DEPLOYER_ADDRESS`
|
|
- Per-chain RPC URLs: `RPC_URL_138`, `ETHEREUM_MAINNET_RPC`, `BSC_RPC_URL`, `POLYGON_MAINNET_RPC`, `GNOSIS_MAINNET_RPC`, `ARBITRUM_MAINNET_RPC`, `OPTIMISM_MAINNET_RPC`, `BASE_MAINNET_RPC`, `AVALANCHE_RPC_URL`, `CRONOS_RPC_URL`, `CELO_RPC_URL`, `WEMIX_RPC`, `GNOSIS_RPC`. For ALL Mainnet (651940) and Etherlink (42793): set `RPC_URL_651940` and `RPC_URL_42793` (or equivalent) when present so the orchestrator can show balance/route for those chains; otherwise they appear as "no RPC configured".
|
|
3. **Config:** [config/deployer-gas-routes.json](../../config/deployer-gas-routes.json) — chain-to-method mapping and thresholds. **Multiple swap routes for CRO and WEMIX:** [config/cro-wemix-swap-routes.json](../../config/cro-wemix-swap-routes.json) — SwapSpace, ChangeNOW, SimpleSwap, StealthEX and others; used by `acquire-cro-and-wemix-gas.sh`.
|
|
|
|
---
|
|
|
|
## Steps
|
|
|
|
### 1. Run balance check (optional but recommended)
|
|
|
|
```bash
|
|
cd smom-dbis-138
|
|
./scripts/deployment/check-balances-gas-and-deploy.sh
|
|
```
|
|
|
|
Or from repo root (if env is loaded):
|
|
|
|
```bash
|
|
source scripts/lib/load-project-env.sh
|
|
cd smom-dbis-138 && ./scripts/deployment/check-balances-gas-and-deploy.sh
|
|
```
|
|
|
|
Confirm which chains show **INSUFFICIENT for deploy**.
|
|
|
|
### 2. Run the orchestrator
|
|
|
|
From **repo root**:
|
|
|
|
```bash
|
|
./scripts/deployment/deployer-gas-auto-route.sh
|
|
```
|
|
|
|
Options:
|
|
|
|
- `--dry-run` — do not execute any tx; only report and run path scripts in read-only mode.
|
|
- `--no-execute` — output tx data and instructions only; no signing (Protocolink path never signs; script only outputs quote and next steps).
|
|
- `--chain 138` — run only for chain 138 (or `--chain 1111` for Wemix only).
|
|
|
|
The orchestrator:
|
|
|
|
1. Reads [config/deployer-gas-routes.json](../../config/deployer-gas-routes.json).
|
|
2. For each chain, gets deployer native balance via RPC and compares to `thresholdEther`.
|
|
3. For chains **below threshold**, dispatches by `method`:
|
|
- **internal (138):** Runs [scripts/deployment/chain138-tokens-to-gas.sh](../../scripts/deployment/chain138-tokens-to-gas.sh). If no cUSDT/cUSDC→WETH pool exists (current state), outputs "use genesis/validator only".
|
|
- **protocolink:** Runs [scripts/deployment/protocolink-swap-to-gas.cjs](../../scripts/deployment/protocolink-swap-to-gas.cjs) to get a quote and next-step instructions; you build/sign the tx separately.
|
|
- **manual:** Prints instructions and links (e.g. SwapSpace, ChangeNOW for Wemix); for 1111 also runs [scripts/deployment/wemix-acquire-via-lifi.js](../../scripts/deployment/wemix-acquire-via-lifi.js) for JSON output.
|
|
|
|
### 3. Per-path actions
|
|
|
|
| Path | Action |
|
|
|------|--------|
|
|
| **Chain 138** | If token-aggregation has no c*→WETH pool: fund deployer via **genesis alloc** or **validator transfer**. See [FUNDING_AND_DEPLOYMENT_CHECKLIST.md](FUNDING_AND_DEPLOYMENT_CHECKLIST.md). |
|
|
| **Protocolink (public chains)** | Use the quote/output from `protocolink-swap-to-gas.cjs`. Build transaction via [Protocolink API](https://docs.protocolink.com/protocolink-api/overview) (estimate router data, build tx); sign with deployer key and submit. |
|
|
| **Cronos (25)** | **Manual (multiple routes):** Protocolink does not support Cronos. Use any aggregator from [config/cro-wemix-swap-routes.json](../../config/cro-wemix-swap-routes.json) (SwapSpace, ChangeNOW, SimpleSwap, StealthEX) to swap ETH/BNB/USDT/USDC → CRO; send to deployer on Cronos. Required ~15 CRO. List all routes: `./scripts/deployment/acquire-cro-and-wemix-gas.sh` or `--list`. |
|
|
| **Wemix (1111)** | **Manual (multiple routes):** Use any aggregator from [config/cro-wemix-swap-routes.json](../../config/cro-wemix-swap-routes.json) (SwapSpace, ChangeNOW, SimpleSwap, StealthEX) to swap ETH/BNB/POL → WEMIX; send to deployer on chain 1111. Required ~0.4 WEMIX. List all routes: `./scripts/deployment/acquire-cro-and-wemix-gas.sh` or `--list`. Then run `deploy-bridges-config-ready-chains.sh wemix` and complete-config. See [WEMIX_ACQUISITION_TABLED.md](WEMIX_ACQUISITION_TABLED.md). |
|
|
|
|
---
|
|
|
|
## References
|
|
|
|
- [FUNDING_AND_DEPLOYMENT_CHECKLIST.md](FUNDING_AND_DEPLOYMENT_CHECKLIST.md) — balance check, funding sources, mint ERC-20.
|
|
- [WEMIX_ACQUISITION_TABLED.md](WEMIX_ACQUISITION_TABLED.md) — Wemix gas acquisition options and un-table steps.
|
|
- [REMAINING_DEPLOYMENTS_FOR_FULL_NETWORK_COVERAGE.md](REMAINING_DEPLOYMENTS_FOR_FULL_NETWORK_COVERAGE.md) — Phase A/B/C and deployer gas as prerequisite.
|
|
- [ADDITIONAL_RECOMMENDATIONS_TABLE.md](../00-meta/ADDITIONAL_RECOMMENDATIONS_TABLE.md) — deployer gas check (0a), operator quick reference (22).
|
|
- [DEX_AND_AGGREGATORS_CHAIN138_EXPLAINER.md](../04-configuration/DEX_AND_AGGREGATORS_CHAIN138_EXPLAINER.md) — token-aggregation quote API and DODO PMM on 138.
|
|
|
|
### Multiple swap routes (CRO / WEMIX)
|
|
|
|
**Config:** [config/cro-wemix-swap-routes.json](../../config/cro-wemix-swap-routes.json) defines all aggregator routes for Cronos (25) and Wemix (1111). Each chain has a `swapRoutes` array with `id`, `name`, `type`, `fromAssets`, `toAsset`, `url`, `description`. To add a new route: append an object to `chains."25".swapRoutes` or `chains."1111".swapRoutes` and run `acquire-cro-and-wemix-gas.sh` to list it.
|
|
|
|
---
|
|
|
|
## Quick reference
|
|
|
|
| Command | Purpose |
|
|
|---------|---------|
|
|
| `./scripts/deployment/deployer-gas-auto-route.sh` | Run full auto-route (report + path scripts). |
|
|
| `./scripts/deployment/deployer-gas-auto-route.sh --dry-run` | Report only; no execute. |
|
|
| `./scripts/deployment/deployer-gas-auto-route.sh --chain 138` | Only Chain 138 path. |
|
|
| `./scripts/deployment/chain138-tokens-to-gas.sh` | Chain 138: token-aggregation quote c*→WETH (or "use genesis/validator"). |
|
|
| `node scripts/deployment/protocolink-swap-to-gas.cjs --chain-id 1` | Protocolink quote for Ethereum (USDC→WETH). |
|
|
| `node scripts/deployment/wemix-acquire-via-lifi.js` | Wemix: manual instructions and deployer address (JSON). |
|
|
| `./scripts/deployment/acquire-cro-and-wemix-gas.sh` | Print all CRO and WEMIX swap routes from config (multiple aggregators). |
|
|
| `./scripts/deployment/acquire-cro-and-wemix-gas.sh --list` | One line per route (name + URL). |
|
|
| `./scripts/deployment/acquire-cro-and-wemix-gas.sh --json` | Emit deployer and config path only (for tooling). |
|