feat: implement treasury stream cancellation and recovery#958
Open
web3nova wants to merge 1 commit into
Open
Conversation
- Add cancel_stream: deterministic cancellation with partial claim support - Add emergency_stop: full refund regardless of vesting progress - Emit StreamCancelled and EmergencyStop events for all actions - Add 5 comprehensive test cases covering edge cases - Ensure claimable and refundable amounts are always deterministic Acceptance Criteria ✅: - Treasury supports cancellation/emergency stop semantics - Remaining amounts are deterministic (claimed + refunded = original) - Events emitted for all actions - Tests cover partial-claim and cancellation edge cases Fixes Pulsefy#859
|
@web3nova 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.
🔄 Treasury Stream Cancellation & Recovery Rules
Closes #859
📋 Description
Implements safe cancellation and recovery mechanisms for active treasury streams on testnet. This addresses the need for stream administrators to cancel allocations with deterministic refund calculations and emergency stop capabilities.
✨ Features
cancel_stream(admin, beneficiary)(claimed_amount, refunded_amount)StreamCancelledevent with full contextemergency_stop(admin, beneficiary, reason)EmergencyStopevent with reason string✅ Acceptance Criteria
🧪 Test Coverage
5 comprehensive test cases:
test_cancel_stream_partial_claim
test_cancel_stream_immediate
test_cancel_stream_after_full_vesting
test_emergency_stop_full_refund
test_cancel_nonexistent_stream
🔒 Security Considerations
📊 Determinism Guarantees
For any stream state at time T: