Skip to content

feat(revenue-pool): add pausable circuit-breaker for distribute and batch_distribute#377

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
Richardkingz2019:feature/revenue-pool-pause
May 28, 2026
Merged

feat(revenue-pool): add pausable circuit-breaker for distribute and batch_distribute#377
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
Richardkingz2019:feature/revenue-pool-pause

Conversation

@Richardkingz2019
Copy link
Copy Markdown
Contributor

Summary

Closes #349

Adds a pause circuit-breaker to RevenuePool mirroring the vault's pattern.

Changes

contracts/revenue_pool/src/lib.rs

  • Added PAUSED_KEY constant and require_not_paused() internal guard
  • pause(caller) — admin-only; panics if already paused; emits pause_set with true
  • unpause(caller) — admin-only; panics if not paused; emits pause_set with false
  • is_paused() — view, defaults to false when key absent
  • distribute and batch_distribute now call require_not_paused before any logic
  • Admin rotation (set_admin/claim_admin) remains available while paused

contracts/revenue_pool/src/test.rs

  • Fixed duplicate module content (entire test module was duplicated)
  • Added 14 pause-specific tests:
    • is_paused_defaults_false
    • pause_and_unpause_toggle_state
    • pause_emits_pause_set_true_event
    • unpause_emits_pause_set_false_event
    • pause_non_admin_panics
    • unpause_non_admin_panics
    • pause_when_already_paused_panics
    • unpause_when_not_paused_panics
    • distribute_blocked_when_paused
    • batch_distribute_blocked_when_paused
    • distribute_works_after_unpause
    • admin_rotation_allowed_while_paused

docs/interfaces/revenue_pool.json

  • Added pause, unpause, is_paused to the contract interface

Test Results

test result: ok. 57 passed; 0 failed; 0 ignored

…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
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 27, 2026

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

Learn more about application limits

@greatest0fallt1me greatest0fallt1me merged commit 48f6aaa into CalloraOrg:main May 28, 2026
0 of 3 checks passed
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.

Revenue pool: add pausable circuit-breaker for distribute and batch_distribute

2 participants