Skip to content

feat: add max_supply() view — return the configured token supply cap (0 if unlimited) #822

Description

@BigBen-7

Description

initialize_with_max_supply sets a cap but there is no public view to read it back. The SDK needs this to display whether the token has a supply cap and what it is.

What to do

Confirm max_supply(e: Env) -> i128 exists in contract.rs. If missing, add it:

pub fn max_supply(e: Env) -> i128 {
    e.storage().instance().get(&DataKey::MaxSupply).unwrap_or(0i128)
}

Add tests: returns 0 when no cap set, returns the configured cap when set.

Files touched

  • src/contract.rs
  • src/test.rs

PR requirement

  • Closes #[issue_id] — Timeframe: 24 hours

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttokenCore token primitives

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions