Deprecate balance storage in favor of share-based accounting model#222
Open
BernardOnuh wants to merge 1 commit into
Open
Deprecate balance storage in favor of share-based accounting model#222BernardOnuh wants to merge 1 commit into
BernardOnuh wants to merge 1 commit into
Conversation
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.
closes #195 - Add optional circuit breaker for large single withdrawals
Summary
This PR introduces an optional withdrawal circuit breaker that allows the protocol owner to limit the maximum amount withdrawable in a single transaction.
The feature is disabled by default (
0value) to preserve existing behaviour. When enabled, withdrawals exceeding the configured threshold are rejected before any state changes occur.Motivation
A compromised wallet, exploit, or abnormal market event could otherwise withdraw a significant percentage of protocol TVL in a single transaction.
The circuit breaker provides an additional risk-management layer while remaining fully configurable by protocol administrators.
Changes
New Configuration
max_withdrawal_per_txmax_withdrawal_per_ledger0(disabled)Withdrawal Protection
Applied checks to:
withdraw()withdraw_all()Access Control
Errors
Added withdrawal limit violation errors for clear failure reporting.
Testing
Added tests covering:
withdraw_all()respects limits.0) allows unrestricted withdrawals.Security Considerations
withdraw_all()cannot bypass restrictions.Acceptance Criteria
withdraw()andwithdraw_all().