feat(revenue-pool): add pausable circuit-breaker for distribute and batch_distribute#377
Merged
greatest0fallt1me merged 2 commits intoMay 28, 2026
Conversation
…atch_distribute Closes CalloraOrg#349 - Add PAUSED_KEY storage slot and require_not_paused() guard - pause(caller) / unpause(caller): admin-only, emit pause_set event - is_paused(): view, defaults to false - Gate distribute and batch_distribute behind require_not_paused - Admin rotation (set_admin/claim_admin) remains available while paused - Fix duplicate content in test.rs; add 14 pause-specific tests covering: is_paused default, toggle, events, non-admin panics, double-pause/unpause panics, distribute/batch_distribute blocked, works after unpause, admin rotation while paused
|
@Richardkingz2019 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
Closes #349
Adds a pause circuit-breaker to
RevenuePoolmirroring the vault's pattern.Changes
contracts/revenue_pool/src/lib.rsPAUSED_KEYconstant andrequire_not_paused()internal guardpause(caller)— admin-only; panics if already paused; emitspause_setwithtrueunpause(caller)— admin-only; panics if not paused; emitspause_setwithfalseis_paused()— view, defaults tofalsewhen key absentdistributeandbatch_distributenow callrequire_not_pausedbefore any logicset_admin/claim_admin) remains available while pausedcontracts/revenue_pool/src/test.rsis_paused_defaults_falsepause_and_unpause_toggle_statepause_emits_pause_set_true_eventunpause_emits_pause_set_false_eventpause_non_admin_panicsunpause_non_admin_panicspause_when_already_paused_panicsunpause_when_not_paused_panicsdistribute_blocked_when_pausedbatch_distribute_blocked_when_pauseddistribute_works_after_unpauseadmin_rotation_allowed_while_pauseddocs/interfaces/revenue_pool.jsonpause,unpause,is_pausedto the contract interfaceTest Results