Files
proxmox/docs/03-deployment/FUNDING_AND_DEPLOYMENT_CHECKLIST.md

222 lines
9.0 KiB
Markdown
Raw Permalink Normal View History

# Funding and Deployment Checklist
**Last Updated:** 2026-02-13
**Purpose:** Single source for network token funding sources and deployment flow. Use this after balance checks show insufficient funds.
**Related:** [check-balances-gas-and-deploy.sh](../../smom-dbis-138/scripts/deployment/check-balances-gas-and-deploy.sh) | [WALLET_REQUIREMENTS](../../smom-dbis-138/docs/operations/status-reports/WALLET_REQUIREMENTS.md) | [STEPS_FROM_PROXMOX_OR_LAN_WITH_SECRETS](../00-meta/STEPS_FROM_PROXMOX_OR_LAN_WITH_SECRETS.md)
---
## 1. Balance Check (Run First)
Before any deployment, verify network token balances:
```bash
cd smom-dbis-138
./scripts/deployment/check-balances-gas-and-deploy.sh
```
This checks **native gas token** only (ETH, MATIC, BNB, etc.). ERC-20 tokens (USDT, LINK) cannot pay gas unless a meta-tx relayer is used.
**Deployer address:** `cast wallet address $PRIVATE_KEY` (from smom-dbis-138/.env)
**Auto-route (tokens → gas):** If the deployer holds ERC-20 (e.g. USDT, USDC, LINK) on a chain but is short on native gas, you can use the deployer gas auto-route to get swap/bridge instructions or quotes. Run from repo root: `./scripts/deployment/deployer-gas-auto-route.sh` (optional: `--dry-run`, `--chain 138`). See [DEPLOYER_GAS_AUTO_ROUTE_RUNBOOK.md](DEPLOYER_GAS_AUTO_ROUTE_RUNBOOK.md).
---
## 2. Funding Sources by Network
### Chain 138 (DeFi Oracle Meta Mainnet)
Chain 138 is a **private Besu QBFT network**. There is no public faucet.
| Source | How | Notes |
|--------|-----|-------|
| **Genesis alloc** | Deployer may already be pre-funded in genesis.json | Check `smom-dbis-138/config/genesis.json` alloc section. If address is listed, funds exist at chain start. If balance is 0, chain may have been redeployed or funds spent. |
| **Transfer from genesis faucet** | Use a genesis-funded account's private key | Genesis alloc addresses (examples): `0xa55A4B57A91561e9df5a883D4883Bd4b1a7C4882` (GENESIS_FAUCET_1), others in genesis.json. If you have the private key for any funded account, send ETH to deployer: `cast send DEPLOYER_ADDRESS --value 10ether --rpc-url $RPC_URL_138 --private-key $FUNDING_PRIVATE_KEY` |
| **Validator transfer** | Use validator node account | If you control a validator, transfer ETH from its account to the deployer. |
| **Pre-fund in genesis** | Add deployer to genesis alloc, redeploy chain | For new chains or re-genesis; requires operator access to Besu nodes. |
**Chain 138 RPC URLs:**
- Admin/deploy (LAN): `http://192.168.11.211:8545` or `https://rpc-core.d-bis.org`
- Public: `https://rpc-http-pub.d-bis.org`
**Required for deploy:** ~0.006 ETH minimum (5M gas × 1 gwei + 20% buffer). Recommended: 12 ETH for future operations.
---
### Ethereum Mainnet
| Source | How | Notes |
|--------|-----|-------|
| **Exchange** | Buy ETH on Coinbase, Binance, etc.; withdraw to deployer address | Typical 12 hour confirmation. |
| **Bridge from L2** | Arbitrum, Optimism, Base → Mainnet | Use official bridges. |
| **Another wallet** | Send ETH from any funded wallet | |
**Required:** ~0.025 ETH minimum; recommended 0.050.20 ETH for deployment + buffer.
---
### Polygon, Base, Optimism, etc.
| Source | How | Notes |
|--------|-----|-------|
| **Exchange** | Buy MATIC/ETH; withdraw to deployer | |
| **Bridge** | Bridge from Ethereum or other chains | |
| **Testnet faucets** | Sepolia, Base Sepolia, Polygon Amoy | Use chain-specific faucets (e.g. sepoliafaucet.com, faucet.quicknode.com). |
---
### Testnets (Sepolia, Base Sepolia, Polygon Amoy)
| Network | Faucet |
|---------|--------|
| **Ethereum Sepolia** | https://sepoliafaucet.com, https://www.alchemy.com/faucets/ethereum-sepolia |
| **Base Sepolia** | https://www.alchemy.com/faucets/base-sepolia |
| **Polygon Amoy** | https://faucet.polygon.technology/ |
---
## 3. Deployment Checklist
### Pre-deployment
- [ ] **PRIVATE_KEY** set in `smom-dbis-138/.env`
- [ ] **RPC_URL_138** or **CHAIN138_RPC_URL** set (e.g. `http://192.168.11.211:8545` or `https://rpc-http-pub.d-bis.org`)
- [ ] **cast** (Foundry) and **forge** installed
- [ ] Balance check passes for target network(s)
### Step 1: Run balance check
```bash
cd smom-dbis-138
./scripts/deployment/check-balances-gas-and-deploy.sh
```
Confirm Chain 138 shows **OK for deploy**. If not, fund the deployer per §2.
### Step 2: Deploy on Chain 138
```bash
cd smom-dbis-138
./scripts/deployment/check-balances-gas-and-deploy.sh --deploy
```
This runs:
1. **01_DeployCore** (phased core)
2. **02_DeployBridges** (if CCIP_ROUTER set and 01 succeeded)
### Alternative: Full phased deployment
```bash
cd smom-dbis-138
./scripts/deployment/deploy-all-phases.sh
```
Phases: 1) Core, 2) Bridges, 3) Channel managers, 4) Deterministic core, 5) Vault, 6) Reserve.
### Step 3: Operator tasks (from LAN)
```bash
./scripts/run-all-operator-tasks-from-lan.sh --deploy
```
Includes backup, Blockscout verification, phased deploy, optional TransactionMirror and VM creation.
---
## 4. Mint ERC-20 Tokens (LINK, cUSDT, cUSDC) for Deployer
The deployer needs **LINK** for CCIP fees and **cUSDT/cUSDC** for cross-chain flows. Run:
```bash
./scripts/mint-tokens-for-deployer.sh
```
**Defaults:** 1,000,000 LINK, 100,000 cUSDT, 100,000 cUSDC, wrap 1 ETH to WETH9/WETH10.
**Custom amounts:**
```bash
./scripts/mint-tokens-for-deployer.sh --amount-link=500000 --amount-stable=50000 --wrap-eth=2
```
**Dry-run:** `./scripts/mint-tokens-for-deployer.sh --dry-run`
**Manual commands** (if script fails, e.g. stuck tx):
```bash
cd smom-dbis-138 && source .env
RPC="${RPC_URL_138:-http://192.168.11.211:8545}"
GAS=100000 GAS_PRICE=1000000000
DEPLOYER=0x4A666F96fC8764181194447A7dFdb7d471b301C8
# Mint 1M LINK (MockLinkToken - unrestricted mint)
cast send 0xb7721dD53A8c629d9f1Ba31a5819AFe250002b03 "mint(address,uint256)" $DEPLOYER 1000000000000000000000000 --rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy --gas-limit $GAS --gas-price $GAS_PRICE
# Mint 100k cUSDT (deployer must be owner)
cast send 0x93E66202A11B1772E55407B32B44e5Cd8eda7f22 "mint(address,uint256)" $DEPLOYER 100000000000 --rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy --gas-limit $GAS --gas-price $GAS_PRICE
# Mint 100k cUSDC (deployer must be owner)
cast send 0xf22258f57794CC8E06237084b353Ab30fFfa640b "mint(address,uint256)" $DEPLOYER 100000000000 --rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy --gas-limit $GAS --gas-price $GAS_PRICE
# Wrap 1 ETH to WETH9
cast send 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 "deposit()" --value 1000000000000000000 --rpc-url "$RPC" --private-key "$PRIVATE_KEY" --legacy --gas-limit $GAS --gas-price $GAS_PRICE
```
**If you see "Replacement transaction underpriced":** A stuck transaction is blocking the deployer nonce. Options: (1) wait for it to be mined, (2) send a 0-ETH tx from MetaMask to advance nonce, (3) restart Besu RPC and flush mempool from Proxmox.
**Verify:** `cd smom-dbis-138 && ./scripts/deployment/list-deployer-tokens-all-networks.sh`
---
## 5. Post-deployment
- [ ] Update `smom-dbis-138/.env` with new contract addresses (UNIVERSAL_ASSET_REGISTRY, CCIPWETH9_BRIDGE_CHAIN138, etc.)
- [ ] Run Blockscout verification: `./scripts/verify/run-contract-verification-with-proxy.sh`
- [ ] Update [CONTRACT_ADDRESSES_REFERENCE](../11-references/CONTRACT_ADDRESSES_REFERENCE.md)
---
## 6. Troubleshooting
### "Chain 138 balance 0" but genesis has alloc
- Chain may have been redeployed with different genesis.
- Check current balance: `cast balance DEPLOYER --rpc-url $RPC_URL_138`
- Transfer from another genesis-funded account if you have its private key.
### "PRIVATE_KEY not set"
- Ensure `smom-dbis-138/.env` exists and contains `PRIVATE_KEY=0x...`
### "RPC not accessible"
- For `192.168.11.211`: requires LAN/VPN access.
- Do **not** switch deployment to public RPC. For deployment on Chain 138, use Core RPC only (`RPC_URL_138` on VMID 2101).
- If Core RPC is unreachable, restore LAN/VPN access or fix Core RPC health first, then re-run deployment.
### "insufficient funds" on broadcast
- Fund deployer with more native token (ETH on Chain 138).
- Increase gas price if needed: `GAS_PRICE_138=2000000000` (2 gwei).
---
## 7. Quick Reference
| Action | Command |
|--------|---------|
| Check balances | `cd smom-dbis-138 && ./scripts/deployment/check-balances-gas-and-deploy.sh` |
| Deploy Chain 138 | `./scripts/deployment/check-balances-gas-and-deploy.sh --deploy` |
| Full phased deploy | `./scripts/deployment/deploy-all-phases.sh` |
| Operator tasks | `./scripts/run-all-operator-tasks-from-lan.sh --deploy` |
| Verify contracts | `./scripts/verify/run-contract-verification-with-proxy.sh` |
| Mint LINK/cUSDT/cUSDC | `./scripts/mint-tokens-for-deployer.sh` |
| Check deployer tokens | `cd smom-dbis-138 && ./scripts/deployment/list-deployer-tokens-all-networks.sh` |
| Check deployer | `cast wallet address $PRIVATE_KEY` |
| Chain 138 balance | `cast balance $DEPLOYER --rpc-url $RPC_URL_138` |
---
**See also:** [WALLET_REQUIREMENTS](../../smom-dbis-138/docs/operations/status-reports/WALLET_REQUIREMENTS.md), [TOKENS_AND_CHAINS_SUMMARY](../../smom-dbis-138/docs/deployment/TOKENS_AND_CHAINS_SUMMARY.md).