feat(contracts): fee rounding, pause reasons, dual-approval emergency, storage registry#669
Merged
Merged
Conversation
…, storage registry
|
@miss-yusrah 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.
closes #639
closes #643
closes #647
closes #648
Summary
Implements four vault contract improvements for operator safety and auditability.
Task 1 — Deterministic fee rounding policy tests
fee_math.rswith floor-division fee policy (fee = amount * bps / 10_000)accrue_yieldnow usescalculate_protocol_fee()for consistent roundingTask 2 — Paused-state reason codes + query endpoint
PauseReasonenum (SecurityIncident, OracleFailure, LiquidityCrisis, Governance, Maintenance, Other)pause(reason)stores reason on-chain;unpause()clears itpause_reason() -> Option<PauseReason>Task 3 — Dual-approval for critical emergency actions
emergency.rswith two-approver flowset_emergency_approvers(primary, secondary)— admin configures distinct approverspropose_emergency_action(...)— primary initiates (Pause, Unpause, EmergencyDivest, ForceUpgrade)confirm_emergency_action(proposal_id)— secondary confirms and executesemergency_proposal(proposal_id)— query pending/executed proposalsTask 4 — Storage key namespace registry + collision checks
storage_registry.rswithStorageNamespaceand key catalogvalidate_registry_no_collisions()enforces unique (namespace, name) pairsstorage_key_registry()returns full registry + validity flagProxyDataKeykept separate from vaultDataKeyTest plan
fee_mathedge-case unit testsfeature_tests— pause reason, dual-approval pause, fee rounding integration, registry validitystorage_registrycollision testsemergencydistinct-approver testsevent_tests::test_pause_unpause_worksfor newpause(reason)signature