fix(token): enforce PULSE supply cap - #112
Open
afeezorobsco-cyber wants to merge 3 commits into
Open
Conversation
Cap lives in pulse_token::mint() (DataKey::MaxSupply, instance storage) so every authorized minter - leaderboard reward/reward_bonus or any future minter - shares one global ceiling. Result is computed via i128::checked_add before any write; over-cap or overflow mints reject with MaxSupplyExceeded (SPulse-Org#7) leaving balance and total_supply untouched. No authoritative tokenomics value exists in the repo, so the cap is deployer-supplied via initialize(_, max_supply); legacy instances fail closed until admin declares a cap through set_max_supply, an admin-only one-way ratchet (cannot raise, cannot go below current supply). Closes issue SPulse-Org#34.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
##close #90
Summary
Enforces a global PULSE maximum supply at the token contract's
mint()boundary so every authorized minting path shares the same hard ceiling.Changes
total_supply.Security
The cap is enforced in the token contract itself rather than relying on individual callers. Therefore
reward,reward_bonus, and other authorized minters cannot bypass the global supply ceiling.An attempted mint that would exceed the remaining supply fails atomically.
Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceIssue
Closes #[ISSUE_NUMBER]