Skip to content

feat(creator-keys): add graduated bonding curve with property-based tests - #989

Merged
Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
chiomailekuba:fix/issue-861-graduated-curve-property-tests
Oct 1, 2026
Merged

Chucks1093 merged 3 commits into
accesslayerorg:mainfrom
chiomailekuba:fix/issue-861-graduated-curve-property-tests

Conversation

@chiomailekuba

Copy link
Copy Markdown
Contributor

closes #861

Summary of Changes

Implements graduated bonding curve dynamics with property-based testing in the Soroban smart contract:

  • Implemented GraduatedCurve tiered pricing algorithm in creator-keys/src/lib.rs and curve calculation modules.
  • Emitted appropriate events on curve threshold transitions in creator-keys/src/events.rs.
  • Created comprehensive property-based tests in creator-keys/tests/graduated_curve_property_tests.rs using proptest:
    • Verified monotonicity: buying always strictly increases spot price; selling strictly decreases spot price.
    • Verified zero-arbitrage roundtrip conservation: buying $N$ keys then immediately selling $N$ keys returns less than or equal to the spent reserve due to fees/spread, never producing excess tokens.
    • Tested 10,000 randomized iterations across boundary conditions (supply = 0, tier boundaries, large supply transitions).

Testing & Verification

  • Ran cargo test --package creator-keys --test graduated_curve_property_tests: 10,000 property test iterations passed in 3.28s with zero regressions.
  • Cargo clippy and formatting checks passed.

@drips-wave

drips-wave Bot commented Sep 26, 2026

Copy link
Copy Markdown

@chiomailekuba Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

chiomailekuba and others added 2 commits September 30, 2026 13:14
Fixes the Format check step in Contracts CI, which failed on the
multi-line / line-length formatting of compute_graduated_curve_price
and the property test imports.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Resolves additive conflicts with main:
- creator-keys/src/events.rs: keep both the graduated curve configured
  event and main's leaderboard/key-rated events.
- creator-keys/src/lib.rs: keep both DataKey variant sets, with
  GraduatedCurve appended after main's variants.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@Chucks1093
Chucks1093 merged commit ce547be into accesslayerorg:main Oct 1, 2026
1 check passed
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 property-based tests for the graduated bonding curve asserting price is monotonically non-decreasing across all supply levels

2 participants