Summary
LPs and the frontend need to know the current USD price per market (GM) token to display portfolio value and compute withdrawal amounts. Add a dedicated view to reader.
Proposed API
pub fn get_market_token_price(
env: Env,
data_store: Address,
oracle: Address,
market: Address,
maximize: bool, // use max oracle price (for minting) or min (for burning)
) -> u128 // USD price per 1 market token, FLOAT_PRECISION scaled
Implementation Notes
nav = get_pool_value(market, maximize) / market_token.total_supply()
- Handle zero-supply edge case (no market tokens outstanding) — return a seed price
maximize = true uses oracle max prices (conservative for minting)
maximize = false uses oracle min prices (conservative for burning)
Acceptance Criteria
Affected Contracts
reader, market_utils
Summary
LPs and the frontend need to know the current USD price per market (GM) token to display portfolio value and compute withdrawal amounts. Add a dedicated view to
reader.Proposed API
Implementation Notes
nav = get_pool_value(market, maximize) / market_token.total_supply()maximize = trueuses oracle max prices (conservative for minting)maximize = falseuses oracle min prices (conservative for burning)Acceptance Criteria
Affected Contracts
reader,market_utils