From 5d0c1371650931d50dc239f417f964a8b2fecb52 Mon Sep 17 00:00:00 2001 From: zaragoza444 Date: Tue, 21 Jul 2026 02:48:04 -0700 Subject: [PATCH] chore(deployment): add phase 1-2-3 BTC production run script for dev-bis-ali Co-authored-by: Cursor --- .../run-btc-1000-production-phase-123.sh | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 scripts/deployment/run-btc-1000-production-phase-123.sh diff --git a/scripts/deployment/run-btc-1000-production-phase-123.sh b/scripts/deployment/run-btc-1000-production-phase-123.sh new file mode 100644 index 0000000..e1f3aba --- /dev/null +++ b/scripts/deployment/run-btc-1000-production-phase-123.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# Phase 1+2+3: deploy BTC ledger/wallet stack, verify headroom, hot pool, primary wallet. +# Run on dev-bis-ali only: +# bash scripts/deployment/run-btc-1000-production-phase-123.sh +set -euo pipefail + +REPO_DIR="${OMNL_BANK_ROOT:-$HOME/smom-dbis-138}" +ENV_FILE="${OMNL_BANK_ENV:-$REPO_DIR/.env}" +API_KEY="${OMNL_API_KEY:-${OMNL_SUPER_ADMIN_SECURE_KEY:-}}" + +log() { echo "[$(date -Iseconds)] $*"; } + +cd "$REPO_DIR" +git pull --ff-only origin main + +if [[ -f "$ENV_FILE" ]]; then + set -a + set +u + # shellcheck disable=SC1090 + source "$ENV_FILE" + set -u + set +a +fi + +node scripts/deployment/sync-production-mint-env.mjs --write /tmp/mint.frag +if [[ -x scripts/deployment/merge-env-fragment.sh ]]; then + bash scripts/deployment/merge-env-fragment.sh "$ENV_FILE" /tmp/mint.frag +else + cat /tmp/mint.frag >>"$ENV_FILE" +fi + +log "=== Phase 1: deploy settlement + btc-intake + oracle ===" +bash scripts/deployment/deploy-btc-wallet-production.sh +bash scripts/deployment/cutover-chain138-oracle-python.sh || log "WARN: oracle cutover skipped" + +log "=== Phase 1 verify ===" +curl -sf -H "Authorization: Bearer ${API_KEY}" \ + http://127.0.0.1:3011/api/v1/settlement/btc/ledger | head -c 400 +echo +curl -sf -H "Authorization: Bearer ${API_KEY}" \ + http://127.0.0.1:3011/api/v1/settlement/btc/contracts | head -c 200 +echo + +log "=== Phase 3: hot cBTC pool (dry run) ===" +node scripts/deployment/hot-cbtc-liquidity-1000.mjs + +if [[ "${HOT_CBTC_EXECUTE:-0}" == "1" ]]; then + log "=== Phase 3 execute hot liquidity ===" + HOT_CBTC_EXECUTE=1 node scripts/deployment/hot-cbtc-liquidity-1000.mjs +fi + +log "=== Phase 3 verify trade ===" +node scripts/deployment/verify-cbtc-trade.mjs || true + +log "=== Public smoke ===" +SETTLEMENT_URL=https://secure.omdnl.org/settlement \ + OMNL_API_KEY="${API_KEY}" \ + node scripts/deployment/smoke-btc-settlement.mjs || true + +log "Done. Phase 2 (1,000 cBTC to 0xeb389…) may already be funded on-chain — check explorer."