Skip to content

feat: add graduated bonding curve with supply milestones - #1203

Open
FreshTVMax wants to merge 2 commits into
accesslayerorg:mainfrom
FreshTVMax:fix/issue-829-add-a-graduated-bonding-curve-that-switches-r2
Open

FreshTVMax wants to merge 2 commits into
accesslayerorg:mainfrom
FreshTVMax:fix/issue-829-add-a-graduated-bonding-curve-that-switches-r2

Conversation

@FreshTVMax

Copy link
Copy Markdown

Overview

This PR adds a graduated bonding curve to the creator-keys program. Instead of a single exponent applied across the entire supply range, the curve now selects an exponent based on configurable supply milestones, allowing creators to design pricing that starts accessible and becomes steeper at higher supply tiers.

Related Issue

Changes

📈 Graduated Bonding Curve

  • [ADD] creator-keys/src/supply_milestones.rs
    • Milestone storage and lookup for per-key graduated curve configuration.
    • configure_graduated_curve(key_id: BytesN<32>, milestones: Vec<(u32, u32)>) callable by the key creator; validates each (supply_threshold, exponent) pair with exponents in the 1–5 range.
    • Panics with CurveAlreadyActive if any sales have started before configuration.
    • Emits a graduated_curve_configured event containing all milestone pairs.
    • Exponent selection helper that returns the base exponent below the first milestone and steps up at each configured threshold based on current supply.

Verification Results

cargo build -p creator-keys
✅ compiles

cargo test -p creator-keys
✅ milestone validation, exponent selection at each tier, and CurveAlreadyActive guard covered
Acceptance Criteria Status
Correct exponent applied at each supply tier ✅ Exponent resolved from the active milestone for the current supply
Buy at supply below the first milestone uses the base exponent ✅ Base exponent returned when supply is under the first threshold
Exponent steps up correctly at each configured milestone threshold ✅ Selection walks milestones in order and applies the matching exponent
Configuration after sales have started panics with CurveAlreadyActive ✅ Guarded before any milestone state is written
graduated_curve_configured event emitted with all pairs ✅ Event includes every configured (supply_threshold, exponent) pair

Closes #829

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.

Add a graduated bonding curve that switches steepness at configurable supply milestones

1 participant