From 1ba773ed930677fc171ab4dbf250a7a2794dd4b9 Mon Sep 17 00:00:00 2001 From: defiQUG Date: Tue, 14 Apr 2026 18:19:39 -0700 Subject: [PATCH] Add mainnet cW remediation sequence helper --- ...EV_CHAIN138_ALL_MAINNET_ROLLOUT_TRACKER.md | 4 + scripts/README.md | 9 ++ .../run-mainnet-cw-remediation-sequence.sh | 89 +++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 scripts/deployment/run-mainnet-cw-remediation-sequence.sh diff --git a/docs/04-configuration/MEV_CHAIN138_ALL_MAINNET_ROLLOUT_TRACKER.md b/docs/04-configuration/MEV_CHAIN138_ALL_MAINNET_ROLLOUT_TRACKER.md index 2c05cc49..a428ba0d 100644 --- a/docs/04-configuration/MEV_CHAIN138_ALL_MAINNET_ROLLOUT_TRACKER.md +++ b/docs/04-configuration/MEV_CHAIN138_ALL_MAINNET_ROLLOUT_TRACKER.md @@ -78,6 +78,10 @@ though large parts of the deployment inventory exist. - One-command wrapper for the same sequence: - `bash scripts/deployment/run-mainnet-cw-micro-support-round.sh --dry-run` - re-run with `--apply` only when you intentionally want to broadcast all four support swaps +- Higher-level operator wrapper for this entire Mainnet PMM lane: + - `bash scripts/deployment/run-mainnet-cw-remediation-sequence.sh --mode=full --dry-run` + - mode `micro` = only the four-leg support sweep + - mode `flash-plan` = only the `cWUSDC/USDC` flash quote-push planning branch - `2026-04-14` dry-run outputs for those exact support sizes: - `cwusdt-usdt` `8131` raw → `estimatedOut=4038`, `minOut=3997` - `cwusdc-usdc` `575113` raw → `estimatedOut=159283`, `minOut=157690` diff --git a/scripts/README.md b/scripts/README.md index eddfefe8..c48a183e 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -277,6 +277,15 @@ This runs the currently validated tiny support swaps for `cwusdt-usdt`, `cwusdc- Re-run with `--apply` only when you intentionally want to broadcast the full four-leg support round. +**Higher-level remediation sequence:** +```bash +bash scripts/deployment/run-mainnet-cw-remediation-sequence.sh --dry-run +``` +Modes: +- `--mode=micro` for the four-leg support sweep only +- `--mode=flash-plan` for the `cWUSDC/USDC` flash quote-push plan only +- `--mode=full` for both + ### 15. Mainnet DODO Wave 1 pool deploy helper Repeatable helper for creating and seeding a first-tier Mainnet DODO PMM Wave 1 `cW* / USDC` pair. diff --git a/scripts/deployment/run-mainnet-cw-remediation-sequence.sh b/scripts/deployment/run-mainnet-cw-remediation-sequence.sh new file mode 100644 index 00000000..cfc3e2de --- /dev/null +++ b/scripts/deployment/run-mainnet-cw-remediation-sequence.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +set -euo pipefail + +# High-level operator sequence for current Mainnet cW/USD PMM remediation. +# +# Modes: +# - micro: run the validated four-leg tiny support sweep +# - flash-plan: print the cWUSDC/USDC flash quote-push plan +# - full: do both in sequence +# +# Defaults to dry-run/operator-planning behavior. +# +# Usage: +# bash scripts/deployment/run-mainnet-cw-remediation-sequence.sh --dry-run +# bash scripts/deployment/run-mainnet-cw-remediation-sequence.sh --mode=flash-plan +# bash scripts/deployment/run-mainnet-cw-remediation-sequence.sh --mode=micro --apply + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROXMOX_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" +MICRO_HELPER="${PROXMOX_ROOT}/scripts/deployment/run-mainnet-cw-micro-support-round.sh" +FLASH_PLAN="${PROXMOX_ROOT}/scripts/deployment/plan-mainnet-cwusdc-flash-quote-push-rebalance.sh" +PEG_READINESS="${PROXMOX_ROOT}/scripts/verify/check-mainnet-pmm-peg-bot-readiness.sh" +BOOTSTRAP_VERIFY="${PROXMOX_ROOT}/scripts/verify/check-mainnet-public-dodo-cw-bootstrap-pools.sh" + +MODE="full" +APPLY=0 + +for arg in "$@"; do + case "$arg" in + --mode=*) + MODE="${arg#*=}" + ;; + --dry-run) + APPLY=0 + ;; + --apply) + APPLY=1 + ;; + -h|--help) + sed -n '1,22p' "$0" + exit 0 + ;; + *) + echo "[fail] unknown arg: $arg" >&2 + exit 2 + ;; + esac +done + +case "$MODE" in + micro|flash-plan|full) + ;; + *) + echo "[fail] unsupported mode: $MODE (use micro, flash-plan, or full)" >&2 + exit 2 + ;; +esac + +echo "=== Mainnet cW remediation sequence ===" +echo "mode=$MODE" +echo "apply=$APPLY" +echo + +echo "== preflight ==" +bash "$BOOTSTRAP_VERIFY" +echo +bash "$PEG_READINESS" || true + +if [[ "$MODE" == "micro" || "$MODE" == "full" ]]; then + echo + echo "== micro-support sweep ==" + if (( APPLY == 1 )); then + bash "$MICRO_HELPER" --apply + else + bash "$MICRO_HELPER" --dry-run + fi +fi + +if [[ "$MODE" == "flash-plan" || "$MODE" == "full" ]]; then + echo + echo "== flash quote-push planning ==" + bash "$FLASH_PLAN" +fi + +echo +echo "== post-check ==" +echo "bash scripts/verify/check-mainnet-pmm-peg-bot-readiness.sh" +echo "bash scripts/verify/check-mainnet-public-dodo-cw-bootstrap-pools.sh" +