Skip to content

feat: add max_supply constraint to token contract [#66]#152

Open
dev-RAM11 wants to merge 2 commits into
BCPathway:mainfrom
dev-RAM11:feat/max-supply-constraint
Open

feat: add max_supply constraint to token contract [#66]#152
dev-RAM11 wants to merge 2 commits into
BCPathway:mainfrom
dev-RAM11:feat/max-supply-constraint

Conversation

@dev-RAM11
Copy link
Copy Markdown

Closes #66

What was done

Added an optional hard cap on total token supply to the bc-forge token contract.

Files changed

  • contracts/token/src/lib.rs — added MaxSupply to DataKey, MaxSupplyExceeded error, max_supply parameter to initialize, enforcement in internal_mint, and max_supply() getter
  • contracts/token/src/events.rs — added emit_max_supply_set event
  • contracts/token/src/test.rs — added 10 new tests covering all max supply scenarios

Changes

  • initialize now accepts an optional max_supply: Option<i128> — pass None for uncapped supply
  • Minting beyond the cap returns MaxSupplyExceeded error
  • Cap is enforced in both mint and batch_mint
  • Zero or negative cap values are rejected with InvalidAmount
  • New max_supply() getter returns the cap or None if uncapped
  • emit_max_supply_set event emitted when a cap is set at initialization

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 30, 2026

@dev-RAM11 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[Contract] Add Maximum Supply Constraint

1 participant