Allows verify-only / read-only steps when nonce gate fails (e.g. stuck pool) until operator clears pools with SSH access; unsafe for broadcast deploys. Made-with: Cursor
152 lines
6.1 KiB
Bash
Executable File
152 lines
6.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run all deployment next steps for Chain 138 in order:
|
|
# preflight → (optional mirror+seed pool) → PMM mesh (default) → register c* as GRU → verify.
|
|
#
|
|
# Usage: ./scripts/deployment/run-all-next-steps-chain138.sh [--dry-run] [--skip-preflight] [--skip-mirror] [--skip-mesh] [--legacy-pools-only] [--mesh-only] [--skip-register-gru] [--skip-verify]
|
|
# --dry-run Print steps only; do not run deploy/scripts.
|
|
# --skip-preflight Skip preflight-chain138-deploy.sh (e.g. pending nonce / stuck pool; do NOT deploy until preflight passes).
|
|
# --skip-mirror Do not deploy TransactionMirror + seed pool step.
|
|
# --skip-mesh Do not run full PMM mesh creation script.
|
|
# --legacy-pools-only Equivalent to --skip-mesh (keeps legacy mirror+seed behavior only).
|
|
# --mesh-only Skip mirror+seed step and run mesh creation only.
|
|
# --skip-register-gru Skip RegisterGRUCompliantTokens (e.g. if already registered).
|
|
# --skip-verify Skip final on-chain verification.
|
|
#
|
|
# Requires: repo root; smom-dbis-138/.env with PRIVATE_KEY, RPC_URL_138; for register-gru: UNIVERSAL_ASSET_REGISTRY, CUSDT_ADDRESS_138, CUSDC_ADDRESS_138 (and optional c* vars).
|
|
# See: docs/03-deployment/DEPLOYMENT_ORDER_OF_OPERATIONS.md
|
|
|
|
set -euo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
REPO_ROOT="$PROJECT_ROOT"
|
|
SMOM="$PROJECT_ROOT/smom-dbis-138"
|
|
|
|
load_smom_env() {
|
|
if [[ -f "$SMOM/scripts/lib/deployment/dotenv.sh" ]]; then
|
|
# shellcheck disable=SC1090
|
|
source "$SMOM/scripts/lib/deployment/dotenv.sh"
|
|
load_deployment_env --repo-root "$SMOM"
|
|
return 0
|
|
fi
|
|
if [[ -f "$SMOM/.env" ]]; then
|
|
local had_nounset=0
|
|
if [[ $- == *u* ]]; then
|
|
had_nounset=1
|
|
set +u
|
|
fi
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "$SMOM/.env"
|
|
set +a
|
|
(( had_nounset )) && set -u
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
DRY_RUN=""
|
|
SKIP_PREFLIGHT=""
|
|
SKIP_MIRROR=""
|
|
SKIP_MESH=""
|
|
MESH_ONLY=""
|
|
SKIP_REGISTER_GRU=""
|
|
SKIP_VERIFY=""
|
|
for a in "$@"; do
|
|
[[ "$a" == "--dry-run" ]] && DRY_RUN=1
|
|
[[ "$a" == "--skip-preflight" ]] && SKIP_PREFLIGHT=1
|
|
[[ "$a" == "--skip-mirror" ]] && SKIP_MIRROR=1
|
|
[[ "$a" == "--skip-mesh" ]] && SKIP_MESH=1
|
|
[[ "$a" == "--legacy-pools-only" ]] && SKIP_MESH=1
|
|
[[ "$a" == "--mesh-only" ]] && MESH_ONLY=1 && SKIP_MIRROR=1
|
|
[[ "$a" == "--skip-register-gru" ]] && SKIP_REGISTER_GRU=1
|
|
[[ "$a" == "--skip-verify" ]] && SKIP_VERIFY=1
|
|
done
|
|
|
|
echo "=== Chain 138 — run all next steps ==="
|
|
echo " dry-run: $DRY_RUN skip-preflight: $SKIP_PREFLIGHT skip-mirror: $SKIP_MIRROR skip-mesh: $SKIP_MESH mesh-only: $MESH_ONLY skip-register-gru: $SKIP_REGISTER_GRU skip-verify: $SKIP_VERIFY"
|
|
echo ""
|
|
|
|
# 1) Preflight
|
|
echo "--- Step 1: Preflight ---"
|
|
if [[ -n "$SKIP_PREFLIGHT" ]]; then
|
|
echo "SKIP: --skip-preflight (no nonce/RPC gate). Do not broadcast deploys until preflight-chain138-deploy.sh passes." >&2
|
|
if [[ -n "$DRY_RUN" ]]; then
|
|
echo "[DRY-RUN] would skip $PROJECT_ROOT/scripts/deployment/preflight-chain138-deploy.sh"
|
|
fi
|
|
elif [[ -n "$DRY_RUN" ]]; then
|
|
echo "[DRY-RUN] $PROJECT_ROOT/scripts/deployment/preflight-chain138-deploy.sh"
|
|
else
|
|
"$SCRIPT_DIR/preflight-chain138-deploy.sh" || { echo "Preflight failed." >&2; exit 1; }
|
|
fi
|
|
echo ""
|
|
|
|
# 2) TransactionMirror + seed pool (legacy step; optional)
|
|
if [[ -z "$SKIP_MIRROR" ]]; then
|
|
echo "--- Step 2: TransactionMirror + seed pool ---"
|
|
if [[ -n "$DRY_RUN" ]]; then
|
|
echo "[DRY-RUN] $PROJECT_ROOT/scripts/deployment/deploy-transaction-mirror-and-pmm-pool-after-txpool-clear.sh"
|
|
else
|
|
"$PROJECT_ROOT/scripts/deployment/deploy-transaction-mirror-and-pmm-pool-after-txpool-clear.sh" || { echo "Deploy failed." >&2; exit 1; }
|
|
fi
|
|
echo ""
|
|
else
|
|
echo "--- Step 2: TransactionMirror + seed pool (skipped) ---"
|
|
echo ""
|
|
fi
|
|
|
|
# 3) PMM full mesh (default on Chain 138)
|
|
if [[ -z "$SKIP_MESH" ]]; then
|
|
echo "--- Step 3: PMM full mesh (Chain 138) ---"
|
|
if [[ -n "$DRY_RUN" ]]; then
|
|
echo "[DRY-RUN] $PROJECT_ROOT/scripts/create-pmm-full-mesh-chain138.sh"
|
|
else
|
|
"$PROJECT_ROOT/scripts/create-pmm-full-mesh-chain138.sh" || { echo "PMM full mesh failed." >&2; exit 1; }
|
|
fi
|
|
echo ""
|
|
else
|
|
echo "--- Step 3: PMM full mesh (skipped; legacy-only mode) ---"
|
|
echo ""
|
|
fi
|
|
|
|
# 4) Register c* as GRU (optional)
|
|
if [[ -z "$SKIP_REGISTER_GRU" ]]; then
|
|
echo "--- Step 4: Register c* as GRU (UniversalAssetRegistry) ---"
|
|
if [[ -n "$DRY_RUN" ]]; then
|
|
echo "[DRY-RUN] cd $SMOM && forge script script/deploy/RegisterGRUCompliantTokens.s.sol --rpc-url \$RPC_URL_138 --broadcast --private-key \$PRIVATE_KEY --with-gas-price 1000000000"
|
|
else
|
|
if load_smom_env; then
|
|
# Fallback: Register script expects CUSDT_ADDRESS_138/CUSDC_ADDRESS_138; use COMPLIANT_USDT/COMPLIANT_USDC if set
|
|
[[ -z "${CUSDT_ADDRESS_138:-}" && -n "${COMPLIANT_USDT:-}" ]] && export CUSDT_ADDRESS_138="$COMPLIANT_USDT"
|
|
[[ -z "${CUSDC_ADDRESS_138:-}" && -n "${COMPLIANT_USDC:-}" ]] && export CUSDC_ADDRESS_138="$COMPLIANT_USDC"
|
|
if [[ -n "${UNIVERSAL_ASSET_REGISTRY:-}" && ( -n "${CUSDT_ADDRESS_138:-}" || -n "${CUSDC_ADDRESS_138:-}" ) ]]; then
|
|
(cd "$SMOM" && forge script script/deploy/RegisterGRUCompliantTokens.s.sol --rpc-url "${RPC_URL_138:-http://192.168.11.211:8545}" --broadcast --private-key "$PRIVATE_KEY" --with-gas-price 1000000000) || echo "RegisterGRUCompliantTokens failed or skipped (check UNIVERSAL_ASSET_REGISTRY and CUSDT_ADDRESS_138/CUSDC_ADDRESS_138)."
|
|
else
|
|
echo "Skip: set UNIVERSAL_ASSET_REGISTRY and CUSDT_ADDRESS_138 (and optional c* vars) in $SMOM/.env to register c* as GRU."
|
|
fi
|
|
else
|
|
echo "Skip: $SMOM/.env not found."
|
|
fi
|
|
fi
|
|
echo ""
|
|
else
|
|
echo "--- Step 4: Register c* as GRU (skipped) ---"
|
|
echo ""
|
|
fi
|
|
|
|
# 5) Verify
|
|
if [[ -z "$SKIP_VERIFY" ]]; then
|
|
echo "--- Step 5: On-chain verification ---"
|
|
if [[ -n "$DRY_RUN" ]]; then
|
|
echo "[DRY-RUN] $PROJECT_ROOT/scripts/verify/check-contracts-on-chain-138.sh"
|
|
else
|
|
load_smom_env || true
|
|
"$REPO_ROOT/scripts/verify/check-contracts-on-chain-138.sh" "${RPC_URL_138:-}" || true
|
|
fi
|
|
echo ""
|
|
else
|
|
echo "--- Step 5: Verify (skipped) ---"
|
|
echo ""
|
|
fi
|
|
|
|
echo "=== Next steps run complete. ==="
|