126 lines
4.5 KiB
Python
126 lines
4.5 KiB
Python
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import time
|
|
from decimal import Decimal
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
BASE_MATRIX = ROOT / "reports" / "extraction" / "promod-uniswap-v2-phase1-bridge-from-138-matrix-latest.json"
|
|
REPORT = ROOT / "reports" / "extraction" / "promod-uniswap-v2-phase1-bridge-3x-matrix-latest.json"
|
|
DOC = ROOT / "docs" / "03-deployment" / "PROMOD_UNISWAP_V2_PHASE1_BRIDGE_3X_MATRIX.md"
|
|
|
|
MULTIPLIER = Decimal("3")
|
|
|
|
|
|
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) -> None:
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(json.dumps(payload, indent=2) + "\n")
|
|
|
|
|
|
def write_text(path: Path, text: str) -> None:
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(text.rstrip() + "\n")
|
|
|
|
|
|
def fmt(v: Decimal) -> str:
|
|
return format(v.normalize() if v != 0 else Decimal("0"), "f")
|
|
|
|
|
|
def main() -> None:
|
|
base = load(BASE_MATRIX)
|
|
total_usdt = Decimal("0")
|
|
total_usdc = Decimal("0")
|
|
entries = []
|
|
|
|
for entry in base["entries"]:
|
|
needed_usdt = Decimal(entry["cUSDT_needed_from_138"])
|
|
needed_usdc = Decimal(entry["cUSDC_needed_from_138"])
|
|
bridged_usdt = needed_usdt * MULTIPLIER
|
|
bridged_usdc = needed_usdc * MULTIPLIER
|
|
total_usdt += bridged_usdt
|
|
total_usdc += bridged_usdc
|
|
entries.append(
|
|
{
|
|
"chain_id": entry["chain_id"],
|
|
"network": entry["network"],
|
|
"phase_1_pair": entry["phase_1_pair"],
|
|
"base_cUSDT_needed": entry["cUSDT_needed_from_138"],
|
|
"base_cUSDC_needed": entry["cUSDC_needed_from_138"],
|
|
"bridge_multiplier": "3",
|
|
"cUSDT_to_bridge": fmt(bridged_usdt),
|
|
"cUSDC_to_bridge": fmt(bridged_usdc),
|
|
"bridge_config_env": entry["bridge_config_env"],
|
|
"bridge_config_present": entry["bridge_config_present"],
|
|
"recommended_action": entry["recommended_action"],
|
|
"bridge_note": entry["bridge_note"],
|
|
}
|
|
)
|
|
|
|
payload = {
|
|
"generated_at": now(),
|
|
"program_name": "Mr. Promod Uniswap V2 phase 1 bridge 3x matrix",
|
|
"purpose": "Strict triple-sized Chain 138 bridge funding plan for phase-1 cWUSDT/cWUSDC rollout.",
|
|
"bridge_multiplier": "3",
|
|
"totals_to_bridge_from_138": {
|
|
"cUSDT": fmt(total_usdt),
|
|
"cUSDC": fmt(total_usdc),
|
|
},
|
|
"entries": entries,
|
|
"source_artifacts": [
|
|
"reports/extraction/promod-uniswap-v2-phase1-bridge-from-138-matrix-latest.json",
|
|
],
|
|
}
|
|
write_json(REPORT, payload)
|
|
|
|
lines = [
|
|
"# Mr. Promod Uniswap V2 Phase 1 Bridge 3x Matrix",
|
|
"",
|
|
f"- Generated: `{payload['generated_at']}`",
|
|
"- Purpose: strict triple-sized Chain 138 bridge funding plan for the remaining phase-1 pool rollout.",
|
|
f"- Bridge multiplier: `{payload['bridge_multiplier']}x`",
|
|
f"- Total cUSDT to bridge from Chain 138: `{payload['totals_to_bridge_from_138']['cUSDT']}`",
|
|
f"- Total cUSDC to bridge from Chain 138: `{payload['totals_to_bridge_from_138']['cUSDC']}`",
|
|
"",
|
|
"| Chain | Network | Base cUSDT Need | Base cUSDC Need | 3x cUSDT To Bridge | 3x cUSDC To Bridge | Bridge Env |",
|
|
"|---|---|---:|---:|---:|---:|---|",
|
|
]
|
|
|
|
for entry in entries:
|
|
lines.append(
|
|
f"| `{entry['chain_id']}` | {entry['network']} | "
|
|
f"`{entry['base_cUSDT_needed']}` | "
|
|
f"`{entry['base_cUSDC_needed']}` | "
|
|
f"`{entry['cUSDT_to_bridge']}` | "
|
|
f"`{entry['cUSDC_to_bridge']}` | "
|
|
f"`{entry['bridge_config_env']}` |"
|
|
)
|
|
|
|
lines.extend(["", "## Notes", ""])
|
|
for entry in entries:
|
|
lines.append(f"### Chain `{entry['chain_id']}` — {entry['network']}")
|
|
lines.append("")
|
|
lines.append(f"- Recommended action: `{entry['recommended_action']}`")
|
|
lines.append(f"- 3x cUSDT to bridge: `{entry['cUSDT_to_bridge']}`")
|
|
lines.append(f"- 3x cUSDC to bridge: `{entry['cUSDC_to_bridge']}`")
|
|
lines.append(f"- Bridge env: `{entry['bridge_config_env']}`")
|
|
lines.append(f"- Bridge present: `{str(entry['bridge_config_present']).lower()}`")
|
|
lines.append(f"- Bridge note: {entry['bridge_note']}")
|
|
lines.append("")
|
|
|
|
write_text(DOC, "\n".join(lines))
|
|
print(REPORT)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|