Skip to content

Add helper for computing bonding curve price at any given supply step without mutating contract state #552

Description

@Chucks1093

Summary

Computing the expected price for a given supply step requires running the same formula used in the buy/sell path. A pure helper function should expose this calculation so tests and off-chain tooling can predict prices without invoking a state-mutating transaction.

Scope

  • Add a read-only query_price(supply: u64) -> i128 contract function
  • Must return the same value the buy function would compute for that supply step
  • Should not require admin authentication
  • Add unit tests for supply 0, supply 1, and a mid-range supply value confirming the result matches the inline formula

Acceptance Criteria

  • query_price is read-only and requires no auth
  • Returns the same value as the buy-path formula for the same supply
  • Unit tests pass for supply 0, 1, and mid-range
  • No storage reads or writes occur during the call

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions