feat(fee+burn+essence): 5% transparent fee, burn→close, Essence ledger + dashboard

Monetization (design Rev 4, §3.1) — transparent in-tx fee, non-custodial:
- @pyre/core: computeFeeBreakdown (single source of truth, BigInt) + FeeBreakdown
  threaded through close/burn previews; fee tests.
- @pyre/config: PYRE_TREASURY_WALLET / PYRE_FEE_BPS (500) / swap fee / max contribution.
- @pyre/solana: close-empty + burn→close now append ONE System transfer of exactly
  the disclosed fee to the treasury; rent/authority/feePayer pinned to wallet.
  buildBurnTx re-validates EVERY account on-chain and value-gates via the classifier
  (classic SPL + Token-2022) — never burns protected/valuable/NFT/unsupported;
  ignores client amount (burns real balance); whole-build rejection.
- @pyre/api: close-empty/burn endpoints carry the fee + bounded optional contribution;
  /api/receipt persists (cleanup_receipts) and records the on-chain treasury fee as
  Essence; GET /api/essence; startup migrate(). Best-effort DB (never fails receipts).
- @pyre/db: Postgres Essence ledger (rounds, cleanup_receipts, essence_contributions),
  idempotent migrations, parameterized + u64-safe.
- @pyre/web: fee preview ("reclaim · feeds the PYRE · you net" + treasury) + optional
  "feed more" slider; burn flow w/ destructive confirm; decode+match verifies the fee
  transfer (treasury + exact lamports) before signing; public "🔥 fed the PYRE" panel.

Built by agents (2 waves) + 2 audits. Security audit found a HIGH — buildBurnTx
didn't value-gate CLASSIC spl tokens (a direct API caller could burn USDC/an NFT);
FIXED (classify classic accounts too) + 2 regression tests. Integration: SHIP.
typecheck 8/8, core 91, solana 30, web build green. Live: burn preview on the dust
token shows 5% → treasury; non-empty/non-owned/valuable rejected. Nightly DB backup
cron enabled.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-31 06:11:00 +00:00
parent f9c471ef71
commit b98b904896
22 changed files with 3115 additions and 182 deletions

View File

@@ -147,10 +147,10 @@
<section class="overall">
<div class="overall-head">
<h2>Overall MVP Progress</h2>
<span class="overall-pct">44%</span>
<span class="overall-pct">58%</span>
</div>
<div class="bar"><span style="width: 44%"></span></div>
<p class="count">23 of 52 phase deliverables complete</p>
<div class="bar"><span style="width: 58%"></span></div>
<p class="count">31 of 53 phase deliverables complete</p>
</section>
<h2 class="section">Development Phases</h2>
@@ -204,18 +204,19 @@
<li class="item"><span class="mark"></span><span>Live signed close verified e2e (needs an empty ATA)</span></li>
</ul>
</article>
<article class="card todo">
<article class="card in_progress">
<header class="card-head">
<h3><span class="phase-id">Phase 3</span> Burn Junk</h3>
<span class="badge todo">TODO</span>
<span class="badge in_progress">IN PROGRESS</span>
</header>
<p class="count">0 / 5 complete</p>
<p class="count">5 / 6 complete</p>
<ul class="checklist">
<li class="item"><span class="mark"></span><span>Incinerate-only classification</span></li>
<li class="item"><span class="mark"></span><span>Burn transaction builder</span></li>
<li class="item"><span class="mark"></span><span>Burn-then-close flow</span></li>
<li class="item"><span class="mark"></span><span>Stronger confirmations</span></li>
<li class="item"><span class="mark"></span><span>Receipt update</span></li>
<li class="item done"><span class="mark"></span><span>Incinerate-only classification</span></li>
<li class="item done"><span class="mark"></span><span>Burn transaction builder (server re-validated, value-gated)</span></li>
<li class="item done"><span class="mark"></span><span>Burn-then-close flow (+ transparent 5% fee)</span></li>
<li class="item done"><span class="mark"></span><span>Stronger confirmations (destructive confirm + decode-match)</span></li>
<li class="item done"><span class="mark"></span><span>Receipt update (on-chain verified)</span></li>
<li class="item"><span class="mark"></span><span>Live signed burn verified e2e</span></li>
</ul>
</article>
<article class="card todo">
@@ -252,13 +253,13 @@
<h3><span class="phase-id">Phase 6</span> Essence / Round Prototype</h3>
<span class="badge in_progress">IN PROGRESS</span>
</header>
<p class="count">2 / 6 complete</p>
<p class="count">5 / 6 complete</p>
<ul class="checklist">
<li class="item done"><span class="mark"></span><span>Safe swap candidate detection (Jupiter)</span></li>
<li class="item done"><span class="mark"></span><span>Route quote preview (price impact + dust gate + Shield)</span></li>
<li class="item"><span class="mark"></span><span>Net Essence estimate</span></li>
<li class="item"><span class="mark"></span><span>Round dashboard</span></li>
<li class="item"><span class="mark"></span><span>Contribution database record</span></li>
<li class="item done"><span class="mark"></span><span>Net Essence estimate (fee preview)</span></li>
<li class="item done"><span class="mark"></span><span>Round dashboard (public &#39;fed the PYRE&#39; panel)</span></li>
<li class="item done"><span class="mark"></span><span>Contribution database record (Postgres ledger)</span></li>
<li class="item"><span class="mark"></span><span>No claim promises until on-chain logic exists</span></li>
</ul>
</article>