Skip to content

feat(reader): add get_market_token_price view#312

Open
Tomoya0k wants to merge 3 commits into
SO4-Markets:mainfrom
Tomoya0k:feat/reader-market-token-price
Open

feat(reader): add get_market_token_price view#312
Tomoya0k wants to merge 3 commits into
SO4-Markets:mainfrom
Tomoya0k:feat/reader-market-token-price

Conversation

@Tomoya0k

Copy link
Copy Markdown

Closes #276

Summary

Exposes get_market_token_price as a public view function in the reader contract so LPs and the frontend can query the current USD price per GM token without multiple calls.

Changes

  • contracts/reader: add get_market_token_price that fetches oracle prices and delegates to market_utils::get_market_token_price
  • libs/market_utils: add 3 unit tests covering the acceptance criteria:
    • Parity price: 10,000 USD deposited → GM price = $1.00
    • Post-fee price: 200 USD in fees → GM price = $1.02
    • Zero-supply: returns seed price ($1.00) without panic

Testing

All 19 unit tests pass:
cargo test -p gmx-market-utils

- Add get_market_token_price to reader contract
- Delegates to market_utils::get_market_token_price
- Unit tests: parity price, post-fee price, zero-supply seed price
@Tomoya0k Tomoya0k force-pushed the feat/reader-market-token-price branch from 5f406f5 to df26cd9 Compare June 24, 2026 07:21
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.

feat: market token NAV price view — USD value per GM token

1 participant