Skip to content

[BFT-A][R9] Implement canonical BUY_CBE issuance per mint-on-buy spec #1930

@umwelt

Description

@umwelt

Title

[BFT-A][R9] Implement canonical BUY_CBE issuance per mint-on-buy spec

Category

  • R9 Negative Spec Enforcement

Authoritative Inputs

  • CBE Bonding Curve — Complete Formula Reference section 5
  • CBE Bonding Curve — Rust Implementation Specification section 5
  • Team decision: GRAD_THRESHOLD = 2_745_966 * SCALE

Problem

The current issue incorrectly framed SELL_CBE as something to remove. The new docs clearly define BUY_CBE first, with exact reserve/treasury split, buyer/SOV token split, state checkpointing, and post-commit graduation.

Current Behavior

There is no working canonical BUY_CBE path that matches the documented fixed-width transaction, fee model, split rules, slippage behavior, and state transition ordering.

Required Behavior

Implement BUY_CBE exactly as specified:

  • fee deduction from buyer balance_sov into dao_treasury_sov
  • reserve/treasury split using RHO
  • multi-band mint computation using reserve credit only
  • expected_s_c stale-state check
  • buyer/SOV token split using ALPHA
  • compute buyer_tokens via ratio and sov_tokens by subtraction to preserve exact sum
  • buyer slippage check using the documented formula:
    • buyer_effective = amount_in * SCALE / buyer_tokens
    • reject if buyer_effective > max_price
  • atomic state commit
  • graduation check on reserve_balance >= 2_745_966 * SCALE

Safety Impact

Without the documented BUY_CBE path, supply, reserve, treasury, and graduation semantics remain undefined.

Proposed Fix

Implement BUY_CBE in the dedicated curve executor lane and remove old shortcut/approximation behavior.

Dependencies

Acceptance Criteria

  • BUY_CBE works end to end from fixed-width bytes to atomic state commit
  • Reserve and treasury credits sum exactly to amount_in
  • Buyer and SOV token splits sum exactly to total_delta_s
  • Fee deduction and DAO treasury credit match the documented sequence
  • expected_s_c, max-price slippage, supply limit, and zero-mint checks are enforced
  • Graduation is triggered when reserve_balance >= 2_745_966 * SCALE

Test Plan

  • Zero-input rejection
  • Stale-state rejection
  • Slippage rejection using the documented effective-price formula
  • Exact mint vectors
  • Max-supply rejection
  • Graduation threshold transition tests using 2_745_966 * SCALE

Cleanup After

  • Remove old buy-path semantics that bypass reserve split, checkpointing, buyer/SOV token distribution, or the documented slippage formula

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions