⬆️ LE_DIAMOND Upgrade Tool — REAL PRODUCTION UPGRADE ⚠️ MAINNET
Tool v1.0.0 · Facet bundle v1.0.0
⚠️ REAL UPGRADE — targets the ALREADY-LIVE LE_DIAMOND, real member/epoch data, real gas, real consequence.
This is NOT the fresh-deploy tool (le-diamond-deploy.html) — that tool only ever ADDS facets to a
brand-new Diamond. This tool REPLACES facets on a Diamond already serving real traffic. Every step is
independent and resumable (progress auto-saves to this browser). Step 7 (the actual diamondCut) is the
one irreversible on-chain wiring change.
⚠️ Known-safe Remove-list scoping (built in from v1.0.0, from the start — not retrofitted):
the 7 universal EIP-2535/Ownable selectors (diamondCut, the 4 Diamond Loupe reads,
owner/transferOwnership) are hardcoded below as
PROTECTED_CORE_SELECTORS and are structurally excluded from Remove consideration —
unconditionally, before Replace/Add/Remove categorization runs, never removed by this tool regardless
of ABI-comparison logic. This replicates `pay-diamond-upgrade.html` v1.5.1's FIXED, selector-based
approach exactly (simpler than an address-based scheme — these 7 selectors are universal constants,
true regardless of which Diamond domain or which addresses currently hold them). This is the direct
fix for the real incident that bricked the live PAY_DIAMOND earlier the same day this tool was built
(see docs_role_based/002_crypto-dev/2026-07-30_DiamondTools_Fix_Records_v1.md, DIAMOND-TOOL-FIX 006/008
history). Still — review the COMPUTE CUT preview and run SIMULATE before every real CALL diamondCut.
Progress backup Every resolved address auto-saves to this browser (localStorage key 'leDiamondUpgradeV1'). Export/Import move progress across devices/browsers; Reset clears everything (asks to confirm).
Step 1 — Connect wallet, verify OWNER + network
Strict OWNER gate, same as every other tool in this project — if the
connected wallet isn't exactly OWNER, every deploy/write button stays disabled.
Step 2 — Set the ALREADY-LIVE LE_DIAMOND address
Pre-filled with the real T121 mainnet address from
2026-07-29_Diamond_Contract_Reference_MAINNET_v3.md. Edit only if
LE_DIAMOND is ever redeployed and this address changes.
LE_DIAMOND:
Steps 3-6 — Deploy the 4 Learn & Earn facets
Same real compiled source already embedded in le-diamond-deploy.html (no
functional change since the T121 deploy — this first real use of the tool will therefore
produce a clean Replace-only cut with 0 Add/Remove). Same manual-override/resumable pattern
as every other Diamond tool in this project: paste a known address to skip redeploying.
Click "REFRESH LIVE SELECTORS FROM CHAIN" first — a free, read-only facets()
call straight to the real LE_DIAMOND — to pull the actual current selector set (and each
selector's live facetAddress) directly from chain state. COMPUTE CUT builds
Replace/Add against that live data, and builds the Remove list ONLY from selectors that are NOT
one of the 7 hardcoded PROTECTED_CORE_SELECTORS (see the warning box above) —
core Diamond selectors can never appear in a Remove list from this tool.
Step 8 — Verify
Calls facets() through the live Diamond and shows every
registered facet address + selector count, so the upgrade can be visually confirmed.