Skip to content

Coin.burn: let holders spend PRIME points (fork 890) - #36

Draft
TypeError86 wants to merge 1 commit into
mainfrom
feat/prime-burn
Draft

TypeError86 wants to merge 1 commit into
mainfrom
feat/prime-burn

Conversation

@TypeError86

@TypeError86 TypeError86 commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Lets holders spend PRIME points on products by burning them. This PR is the contract and API only: no UI, product catalogue or order backend.

What's in it

  • New Coin.burn(amount, symbol, ref) on the existing Coin contract. No new contract.
  • Only PRIME can be burned, and only by the holder, from their own balance. Nobody can burn for someone else, admins included.
  • Soulbound still blocks transfers, but holders can now destroy their own PRIME.
  • Pausing PRIME blocks burns, and minting too.
  • Each burn leaves a permanent on-chain record per wallet + ref (e.g. an order id), so one order can't be paid twice. Total supply goes down, and a per-wallet burned total is kept.
  • Read-only API:
    • GET /api/wallet/burn/<pk>/PRIME/<ref> returns {flat, height, tx_hash, finalized}.
    • GET /api/wallet/burns/<pk> lists the wallet's burns.
    • GET /api/wallet/burned/<pk> returns the wallet's burned total.
    • prime_burned is added to stats and Prometheus.
  • Activates at a new FORKHEIGHT2: mainnet epoch 890, testnet epoch 45. It can't share the epoch 877 fork, which already shipped in v1.6.2.

Testing

  • 82/82 consensus::tests pass, 18 of them new in tests/coin_burn.rs. The full Rust suite also passes.
  • What the tests cover:
    • fork boundary on mainnet and testnet, with no state reads before activation
    • one use per ref, and nobody can squat another wallet's ref
    • pause, soulbound, and argument validation
    • the PRIME-only allowlist
    • revert after a partial write
    • metering worst case
    • nodes stay in sync
  • The Elixir API changes are only syntax-checked.

Questions for the team

  • Where do users spend points? A marketplace in amahub with our own products? Who manages the catalogue and prices?
  • Burning outside the UI: anyone can sign Coin.burn from any wallet or the SDK, without our UI. That only destroys their own points. Fine as is, or should burns require an order approved by our backend?
  • PRIME only: OK for now? Adding more coins later needs another fork.
  • Emergency stop: is pause acceptable, given it also stops minting?
  • Failed orders: if we can't deliver after a user burned, do we re-mint their points? What about a wrong amount or an expired order? Tx fees are never refunded either way.
  • Blocker: can amahub count "balance + burned" as minted before epoch 890? Otherwise burned points get re-minted.
  • Timing: do the 890 / 45 fork heights fit our release and validator upgrade schedule? Re-check them against live heights on release day.
  • Wallet: should it show a "permanently destroy X PRIME" warning before we promote this?

@TypeError86
TypeError86 requested a review from vans163 October 22, 2026 11:08
@TypeError86 TypeError86 self-assigned this Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant