68 lines
2.0 KiB
Python
68 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import time
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
SOURCE = ROOT / "reports" / "extraction" / "promod-uniswap-v2-phase2-operator-sequence-latest.json"
|
|
SCRIPT = ROOT / "docs" / "03-deployment" / "PROMOD_UNISWAP_V2_PHASE2_SHELL_PASTE_PACK.sh"
|
|
REPORT = ROOT / "reports" / "extraction" / "promod-uniswap-v2-phase2-shell-paste-pack-latest.json"
|
|
|
|
|
|
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 main() -> None:
|
|
source = load(SOURCE)
|
|
blocks = []
|
|
flat_entries = []
|
|
for chain in source["entries"]:
|
|
for pair in chain["phase_2_pairs"]:
|
|
flat_entries.append(
|
|
{
|
|
"chain_id": chain["chain_id"],
|
|
"network": chain["network"],
|
|
"pair": pair["pair"],
|
|
"amount_env_a": pair["amount_env_a"],
|
|
"amount_env_b": pair["amount_env_b"],
|
|
}
|
|
)
|
|
blocks.append(pair["create_if_absent_block"].strip())
|
|
blocks.append("")
|
|
blocks.append(pair["deploy_block"].strip())
|
|
blocks.append("")
|
|
|
|
payload = {
|
|
"generated_at": now(),
|
|
"program_name": "Mr. Promod Uniswap V2 phase 2 shell paste pack",
|
|
"purpose": "Pure shell-only paste pack for every phase-2 wrapped-mesh pair in sequence.",
|
|
"entries": flat_entries,
|
|
"source_artifacts": [
|
|
"reports/extraction/promod-uniswap-v2-phase2-operator-sequence-latest.json",
|
|
],
|
|
}
|
|
write_json(REPORT, payload)
|
|
write_text(SCRIPT, "\n".join(blocks))
|
|
print(REPORT)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|