feat(contract): supply cap, token-weighted quorum, two-step admin cancel, cross-contract auth#1198
Merged
Emmyt24 merged 5 commits intoMay 28, 2026
Conversation
- set_supply_cap() allows updating max_supply post-creation - Existing validate_max_supply in mint.rs and batch_settle already enforce the cap atomically; tests wired via batch_create_tokens - Tests: creation-time validation, mint enforcement, batch cap closes nova-launch01#1139
- Replace hardcoded TOTAL_ELIGIBLE=10 with sum of all token total_supplies - Falls back to vote count when no tokens deployed (test-safe) - Quorum threshold remains configurable via update_governance_config - Tests: quorum-met, quorum-failed, configurable threshold closes nova-launch01#1140
- Add cancel_admin(): current admin can cancel a pending transfer - Emits adm_cxl event on cancellation - Tests: cancel clears pending, unauthorized cancel rejected, cancel with no pending fails, event emitted closes nova-launch01#1141
- Add TrustedCaller(Address) DataKey to storage - register_trusted_caller / revoke_trusted_caller (admin-only) - assert_trusted_caller: rejects unregistered callers, emits cc_auth event - Events: tc_add, tc_rem, cc_auth, adm_cxl - Tests: register/assert, spoof rejected, revoke blocks, unauthorized ops closes nova-launch01#1142
- set_supply_cap(): update max_supply post-creation (closes nova-launch01#1139) - cancel_admin(): cancel pending admin transfer (closes nova-launch01#1141) - register_trusted_caller() / revoke_trusted_caller() / assert_trusted_caller() (closes nova-launch01#1142) - Module declarations for supply_cap_test, cross_contract_auth_test, governance_quorum_test
|
@Mozez155 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! 🚀 |
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.
Summary
Implements four contract security and governance features.
#1139 — Supply cap enforcement
set_supply_cap()allows updatingmax_supplypost-creation (must be ≥ current supply)validate_max_supplyinmint.rsandbatch_settleinbatch_operations.rsalready enforce the cap atomically on every mint pathget_remaining_mintable#1140 — Token-weighted quorum
TOTAL_ELIGIBLE = 10intimelock.rswith the sum of all deployed tokentotal_supplyvaluesupdate_governance_config#1141 — Two-step admin transfer cancel
cancel_admin(): current admin cancels a pending transfer, emitsadm_cxleventpropose_admin/accept_adminunchanged#1142 — Cross-contract authorization
TrustedCaller(Address)DataKey added to storageregister_trusted_caller/revoke_trusted_caller(admin-only, emittc_add/tc_rem)assert_trusted_caller: validates caller is registered, emitscc_authevent; rejects spoofed callers withUnauthorizedVerification
Closes #1139
Closes #1140
Closes #1141
Closes #1142