Files
proxmox/scripts/lib/promod_uniswap_v2_phase_order.py
defiQUG 4fab998e51
All checks were successful
Deploy to Phoenix / deploy (push) Successful in 9s
chore: sync workspace docs, configs, and submodules
2026-04-18 12:07:15 -07:00

111 lines
4.3 KiB
Python

#!/usr/bin/env python3
from __future__ import annotations
from pathlib import Path
import json
import time
ROOT = Path(__file__).resolve().parents[2]
LIQUIDITY_PROGRAM = ROOT / "reports" / "extraction" / "promod-uniswap-v2-liquidity-program-latest.json"
FIRST_MATRIX = ROOT / "reports" / "extraction" / "promod-uniswap-v2-first-deployment-target-matrix-latest.json"
REPORT = ROOT / "reports" / "extraction" / "promod-uniswap-v2-phase-order-latest.json"
DOC = ROOT / "docs" / "03-deployment" / "PROMOD_UNISWAP_V2_PHASE_ORDER.md"
def now() -> str:
return time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
def load(path: Path):
return json.loads(path.read_text())
def write_json(path: Path, payload):
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(payload, indent=2) + "\n")
def write_text(path: Path, text: str):
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(text.rstrip() + "\n")
def main():
liquidity = load(LIQUIDITY_PROGRAM)
first = load(FIRST_MATRIX)
first_by_chain = {entry["chain_id"]: entry for entry in first["entries"]}
entries = []
for entry in liquidity["entries"]:
chain_id = entry["chain_id"]
first_entry = first_by_chain.get(chain_id, {})
phase_1 = first_entry.get("first_pair")
phase_2 = first_entry.get("next_wrapped_expansion_pairs", [])
phase_3 = entry.get("settlement_phase_pairs", [])
entries.append(
{
"chain_id": chain_id,
"network": entry["network"],
"tier": entry["tier"],
"hub_stable": entry["hub_stable"],
"phase_1_core_rail": phase_1,
"phase_1_required_tokens": first_entry.get("required_tokens", []),
"phase_2_full_cw_wrapped_mesh": phase_2,
"phase_2_other_gru_v2_cw_tokens": first_entry.get("other_gru_v2_cw_tokens", []),
"phase_3_settlement_rails": phase_3,
"remaining_live_blockers": first_entry.get("remaining_live_blockers", []),
"post_phase_1_commands": first_entry.get("post_deploy_commands", []),
}
)
payload = {
"generated_at": now(),
"program_name": liquidity["program_name"],
"purpose": "Strict phase-order artifact for Mr. Promod's Uniswap V2 rollout: phase 1 core rail -> phase 2 full cW* wrapped mesh -> phase 3 settlement rails.",
"mainnet_funding_posture": liquidity["mainnet_funding_posture"],
"entries": entries,
"source_artifacts": [
"reports/extraction/promod-uniswap-v2-liquidity-program-latest.json",
"reports/extraction/promod-uniswap-v2-first-deployment-target-matrix-latest.json",
],
}
write_json(REPORT, payload)
lines = [
"# Mr. Promod Uniswap V2 Phase Order",
"",
f"- Generated: `{payload['generated_at']}`",
f"- Program: {payload['program_name']}",
f"- Mainnet funding posture: `{payload['mainnet_funding_posture']['mode']}` via `{', '.join(payload['mainnet_funding_posture']['required_deployer_assets'])}`",
"- Purpose: strict rollout order for each chain: phase 1 core rail -> phase 2 full cW* wrapped mesh -> phase 3 settlement rails.",
"",
"| Chain | Network | Phase 1 Core Rail | Phase 2 Full cW* Wrapped Mesh | Phase 3 Settlement Rails |",
"|---|---|---|---|---|",
]
for entry in entries:
phase_2 = ", ".join(f"`{pair}`" for pair in entry["phase_2_full_cw_wrapped_mesh"][:10]) or ""
phase_3 = ", ".join(f"`{pair}`" for pair in entry["phase_3_settlement_rails"]) or ""
lines.append(
f"| `{entry['chain_id']}` | {entry['network']} | `{entry['phase_1_core_rail']}` | {phase_2} | {phase_3} |"
)
lines.extend(
[
"",
"## Phase Rules",
"",
"- Phase 1 opens the network with the standardized core rail `cWUSDT/cWUSDC` when available.",
"- Phase 2 expands the rest of the documented GRU v2 `cW*` assets into wrapped pairs against `cWUSDC` and `cWUSDT`.",
"- Phase 3 adds canonical settlement rails only after the wrapped mesh exists and the chain is ready to expose deeper stable exits.",
]
)
write_text(DOC, "\n".join(lines))
print(REPORT)
if __name__ == "__main__":
main()