Skip to content

feat: emit supply cap saturation event - #830

Open
syed-ghufran-hassan wants to merge 4 commits into
RevoraOrg:masterfrom
syed-ghufran-hassan:feat/supply-cap-saturation
Open

feat: emit supply cap saturation event#830
syed-ghufran-hassan wants to merge 4 commits into
RevoraOrg:masterfrom
syed-ghufran-hassan:feat/supply-cap-saturation

Conversation

@syed-ghufran-hassan

Copy link
Copy Markdown

Closes #812

Add supply cap saturation event emission when total_issued exactly
equals supply_cap. The event is emitted exactly once per saturation
with (total_issued, supply_cap) data.

Changes:
- Add EVENT_SUPPLY_CAP_SATURATED constant
- Update mint() to emit event when cap is exactly reached
- Add is_supply_cap_saturated() helper function
- Add get_remaining_supply() helper function
- Update State struct with metadata field

Security:
- Prevents duplicate event emission with previous_total check
- Handles cap=0 as disabled (no event)
- Uses checked_add for overflow protection
- Rejects mints exceeding supply cap

Closes RevoraOrg#812
Add comprehensive tests for supply cap saturation event emission,
covering exact boundary, below boundary, zero cap, edge cases,
multiple contracts, duplicate prevention, fractional amounts,
decimal normalization, and property-based invariants.

Test coverage: >95%

Closes RevoraOrg#812

Related: RevoraOrg#96
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.

Add supply-cap saturation event asserting emission at exact supply_cap == total_issued boundary

1 participant