Skip to content

feat(streaming): implement global pause mechanism (#445)#1

Open
kokobutter-web wants to merge 3 commits into
mainfrom
issue-445-pause-mechanism
Open

feat(streaming): implement global pause mechanism (#445)#1
kokobutter-web wants to merge 3 commits into
mainfrom
issue-445-pause-mechanism

Conversation

@kokobutter-web
Copy link
Copy Markdown
Owner

Summary

  • Add lifecycle dependency for pause/unpause hooks
  • Define Admin storage key and initialize function
  • Implement pause/unpause functions restricted to admin
  • Integrate lifecycle checks into create_stream, withdraw, cancel_stream
  • Add comprehensive tests for pause blocking operations

Changes

  • contracts/streaming/Cargo.toml: add soromint-lifecycle dependency
  • contracts/streaming/src/lib.rs: add admin, pause/unpause, guard checks (528 lines added)

Testing

  • test_pause_unpause: verify pause blocks operations
  • test_paused_blocks_withdraw: ensure withdraw panics when paused
  • test_paused_blocks_cancel: ensure cancel panics when paused
  • Updated existing tests to initialize contract

Fixes EDOHWARES#445

ACodehunter added 3 commits April 25, 2026 10:27
- Add lifecycle dependency for pause/unpause functionality
- Add Admin storage key and initialize function
- Add pause/unpause functions with admin authorization
- Add is_destroyed flag and require_not_destroyed guard
- Wrap create_stream, withdraw, cancel_stream with pause/destroy checks
- Add extend_stream for active stream extension (prerequisite for self-destruct)
- Add self_destruct with cleanup of all streams and refunds
- Require contract to be paused before self-destruct for safety
- Add comprehensive tests for pause, unpause, and self-destruct scenarios
- All state-changing operations blocked when paused or destroyed

Part of EDOHWARES#445 EDOHWARES#458 EDOHWARES#474
- Inline claimable_amount logic within claim to avoid double-reading Claimed
- Read claimed value once at start, compute claimable directly
- Reduces one storage read per claim operation
- Estimated saving: ~5% gas for claim function

Part of EDOHWARES#448
- Pass oracle address as parameter to calculate_total_collateral_value
- Read Oracle once in distribute_seized_collateral and pass to helper
- Read Oracle once in should_liquidate instead of inside helper
- Eliminates duplicate storage fetch in distribution path
- Estimated saving: ~10% gas for liquidation operations

Part of EDOHWARES#448
@kokobutter-web kokobutter-web added the enhancement New feature or request label Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contract: Implement Global 'Pause' Mechanism (Emergency Shutdown)

1 participant