Skip to content

feat(contract): supply cap, token-weighted quorum, two-step admin cancel, cross-contract auth#1198

Merged
Emmyt24 merged 5 commits into
nova-launch01:mainfrom
Mozez155:feat/contract-supply-cap-quorum-admin-crossauth
May 28, 2026
Merged

feat(contract): supply cap, token-weighted quorum, two-step admin cancel, cross-contract auth#1198
Emmyt24 merged 5 commits into
nova-launch01:mainfrom
Mozez155:feat/contract-supply-cap-quorum-admin-crossauth

Conversation

@Mozez155

Copy link
Copy Markdown
Contributor

Summary

Implements four contract security and governance features.

#1139 — Supply cap enforcement

  • set_supply_cap() allows updating max_supply post-creation (must be ≥ current supply)
  • validate_max_supply in mint.rs and batch_settle in batch_operations.rs already enforce the cap atomically on every mint path
  • Tests cover creation-time validation, mint enforcement, batch cap, and get_remaining_mintable

#1140 — Token-weighted quorum

  • Replaced hardcoded TOTAL_ELIGIBLE = 10 in timelock.rs with the sum of all deployed token total_supply values
  • Falls back to vote count when no tokens are deployed (keeps existing tests green)
  • Quorum threshold remains configurable via update_governance_config
  • Tests: quorum-met succeeds, quorum-not-met fails, threshold configurable

#1141 — Two-step admin transfer cancel

  • Added cancel_admin(): current admin cancels a pending transfer, emits adm_cxl event
  • Existing propose_admin / accept_admin unchanged
  • Tests: cancel clears pending, unauthorized cancel rejected, cancel with no pending fails

#1142 — Cross-contract authorization

  • TrustedCaller(Address) DataKey added to storage
  • register_trusted_caller / revoke_trusted_caller (admin-only, emit tc_add / tc_rem)
  • assert_trusted_caller: validates caller is registered, emits cc_auth event; rejects spoofed callers with Unauthorized
  • Tests: register/assert, spoof rejected, revoke blocks access, unauthorized admin ops rejected

Verification

  • All changes compile cleanly (Rust/Soroban SDK 25.3.1)
  • Existing test modules preserved; new test modules added for each feature
  • No unrelated refactors

Closes #1139
Closes #1140
Closes #1141
Closes #1142

Mozez155 added 5 commits May 28, 2026 14:54
- 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
@drips-wave

drips-wave Bot commented May 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Emmyt24 Emmyt24 merged commit 66a9f80 into nova-launch01:main May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants