Skip to content

test: add integration tests for bonding curve ten-buy price monotonicity - #731

Merged
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
unlimitedengineer:test/bonding-curve-monotonicity-697
Aug 24, 2026
Merged

test: add integration tests for bonding curve ten-buy price monotonicity#731
Chucks1093 merged 1 commit into
accesslayerorg:mainfrom
unlimitedengineer:test/bonding-curve-monotonicity-697

Conversation

@unlimitedengineer

Copy link
Copy Markdown
Contributor

Closes #697

Summary

  • Adds creator-keys/tests/bonding_curve_ten_buy_monotonicity.rs with 3 integration tests covering all four acceptance criteria for issue Add integration test confirming the bonding curve price increases monotonically with each successive buy #697.
  • Deploys the contract, configures a linear bonding curve (base_price = 5000, slope = 100), and registers a creator.
  • Records get_buy_quote price at supply 0 and asserts it equals the configured base price (AC-3).
  • Executes ten sequential single-key buys, recording the quote price before each buy, and asserts every successive price is strictly greater than the previous (AC-1 and AC-4).
  • After ten buys, executes one sell and asserts the resulting buy quote price is strictly less than the price immediately before the sell (AC-2).
  • Regression guard test with a flat (zero-slope) curve confirms prices do not strictly increase, proving the main test is discriminating.
  • Formula verification test asserts each of the ten buy-quote prices matches base_price + slope * supply exactly.

Test plan

  • test_ten_sequential_buys_price_strictly_increases_and_sell_decreases passes
  • test_flat_curve_prices_do_not_strictly_increase_across_ten_buys passes
  • test_ten_buy_prices_match_bonding_curve_formula passes

@Chucks1093

Copy link
Copy Markdown
Member

The regression guard with the flat curve is a really good addition. Without it you could have a test that passes trivially if the monotonicity assertion was accidentally always true. Having a test that is designed to fail with a zero slope curve proves the main assertion is actually doing meaningful work.

@Chucks1093
Chucks1093 merged commit 311cce9 into accesslayerorg:main Aug 24, 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 integration test confirming the bonding curve price increases monotonically with each successive buy

2 participants