Fee router/burner

What it is

The Fee Router/Burner is the piece that calculates the protocol fee, routes the treasury half, and burns 50% in EDM at the exact moment an event proves out. It never runs before proof, it never ignores caps, and it never touches gas. In Trade it fires per milestone when the EMT mints; in Tokens it fires at settlement. The rhythm is always: PASS → EMT/settle → fee line → 50% burn in EDM → receipt.

What it does

Trade (milestone release):

  • computes the stage fee (base 0.5% of the released amount, applying the per-tranche cap: ≤ $1M→$5k, $1–5M→$25k, >$5M→$50k),

  • draws the fee from the prepaid escrow posted at award,

  • converts the burn half to EDM if prepaid in EDSD/USD,

  • executes the burn and emits a burn hash,

  • routes the treasury half to the configured buckets (attestors / network ops / builders / ecosystem),

  • records a single, human-readable fee line on the receipt and the per-order ledger.

Tokens (buy / retire):

  • applies 4% total (default 2% buyer + 2% seller),

  • burns 50% of that fee in EDM immediately (burn hash on the receipt),

  • routes the treasury half to buckets and records the fee line.

Seller assignment (1%) and cash-out (0.5%) fees in Trade are operational and handled by their modules; they do not burn and show as separate lines. Gas is tiny, pass-through, and never burned.

Inputs and outputs

Inputs:

  • Event payload: order/listing id, stage (Trade) or action (Tokens), released amount in EDSD, reference to the EMT (Trade) or settlement id (Tokens).

  • Policy: fee rule and caps, treasury split, EDM conversion path (if needed).

  • Funding: prepaid fee escrow (Trade) or collected at settlement (Tokens).

Outputs:

  • Burn transaction in EDM (hash on the receipt and proof page).

  • Treasury transfers to buckets, with per-bucket amounts.

  • Fee line on the receipt: gross, cap note (if any), burn amount, treasury amount, net to parties.

  • Ledger updates: per-event entry + cumulative per order (Trade) or per listing (Tokens).

Prepaid escrow (Trade) — how it reconciles

At award, the buyer pre-pays the sum of capped stage fees (in EDM or EDSD/USD). The Router keeps a per-order escrow:

  • At each release it consumes the stage fee, burns 50% in EDM, routes the treasury half, and reduces the escrow balance.

  • If prepaid in EDSD/USD, it converts only the burn half to EDM at each milestone, then burns (governance sets slippage bounds and the conversion source).

  • At order close, any escrow remainder is returned automatically to the buyer in EDSD.

Variance/partial-pay events recompute the fee on the adjusted amount and consume less escrow. Caps always apply to the stage, not the order.

Conversion to EDM

  • Source: internal EDM liquidity (treasury buffer) or an approved pool/desk, never user AMMs by default.

  • Bounds: slippage ceiling and daily conversion limits; if bounds are exceeded, the release is deferred with a clear flag (E_BURN_CONVERSION_UNAVAILABLE) and retried; money stays Locked/held until the burn can be executed atomically with the event.

  • Audit: the conversion tx and the burn tx are both referenced on the receipt.

Invariants

  • Fee after proof only. The Router can only be called from the settlement path after an EMT (Trade) or at settlement (Tokens).

  • Caps enforced. Stage fee in Trade is never above its tranche cap; Tokens fee is fixed at 4%.

  • 50% burn, always. Exactly half of the protocol fee burns in EDM at the event; burns never fund rewards or rebates.

  • No gas burn. Gas is not a protocol fee and is never burned.

  • Conservation. Accounting matches: escrow_start – Σ(stage_fees) = escrow_end (Trade); Σ(burns) + Σ(treasury) = Σ(protocol_fees) per program.

  • Idempotency. Each event has a unique watermark (order, stage, sub-lot) or (listing, settlement id); double calls are no-ops.

Events & webhooks

  • fee.burn.posted — amount in EDM, burn tx hash, event reference (order/stage or listing).

  • fee.treasury.routed — bucketed amounts with program and epoch references.

  • trade.release.posted / tokens.settlement.posted — carry the fee line and burn hash on the receipt.

  • Ledger endpoints show escrow balance (Trade), cumulative burns, and per-bucket treasury totals.

Governance knobs

Tunable (within bounds):

  • Treasury split of the non-burn half across attestors / network ops / builders / ecosystem / stakers.

  • EDM conversion source and slippage ceiling; size of the burn buffer.

  • Escrow reconciliation policy (refund timing at order close).

  • Receipt/Explorer fields (visibility), not amounts.

Not tunable (safety foundations):

  • 0.5% per milestone (Trade) with caps per tranche; 4% per settlement (Tokens).

  • 50% burn of each protocol fee in EDM at the moment of proof.

  • No EMT, no funds; One-Claim; must-fund before shipping; Locked→Unlocked rules.

Edge cases handled gracefully

  • Partial releases / replacements. Fee is recomputed on the adjusted amount; escrow is consumed accordingly; lineage is preserved.

  • Revocations. No burn posts for frozen stages; prior burns remain immutable.

  • Currency switches. If a program switches fee payment from EDM to EDSD mid-order, the Router respects the new mode from the next stage; conversion/burn logic adjusts automatically.

  • Rounding. Fees, treasury splits, and burns round down at the smallest atomic unit; the 1-unit remainder is carried to treasury and logged.

Why this makes finance and audit happy

Every money-moving event ends with a single line that balances: gross, cap (if applied), burn, treasury, and net. Burns are provable transactions in EDM with hashes on the receipt; escrow math is closed-form and visible; treasury interest on Locked EDSD is reported from the Treasury module alongside fee lines. There are no hidden discounts, no early burns, and no fuzzy math—just proof, fee, 50% burn, and a receipt you can file.

Drawing

Last updated