feat: add emergency admin operations with timelocks - #33
Open
Ebuka321 wants to merge 1 commit into
Open
Conversation
Contributor
|
@Ebuka321 resolve conflicts and make sure ci passes |
Implement stuck funds recovery and emergency admin operations for the betting and rewards contracts, matching the vault's existing safety mechanisms. Betting contract additions: - emergency_withdraw: 24h timelocked admin withdrawal for stuck funds - cancel_emergency_withdraw: cancel a pending emergency withdrawal - recover_token: recover accidentally sent tokens (non-tracked only) - set_admin: 48h timelocked admin transfer - cancel_set_admin: cancel a pending admin transfer - TrackedTokens storage to prevent recovering match settlement tokens - All emergency ops emit EmergencyAction event with reason hash Rewards contract additions: - set_admin: 48h timelocked admin transfer - cancel_set_admin: cancel a pending admin transfer - EmergencyAction event emission Core additions: - TimelockNotExpired, MismatchPendingData, TokenIsTracked error variants Closes Exquisitech#21
Ebuka321
force-pushed
the
feat/emergency-admin-operations
branch
from
July 20, 2026 14:07
642b399 to
cd23eb1
Compare
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.
Summary
emergency_withdraw,recover_token,set_admin)set_admin) to the rewards contractTimelockNotExpired,MismatchPendingData,TokenIsTracked) to the shared corePlatformErrorKey changes
Betting contract (
betting/src/lib.rs)emergency_withdraw(asset, to, amount)— 24h timelocked admin withdrawal for stuck fundscancel_emergency_withdraw(asset)— cancel a pending emergency withdrawalrecover_token(asset, to, amount)— recover accidentally sent tokens (only non-tracked tokens; tracked tokens used in registered matches are protected)set_admin(new_admin)— 48h timelocked admin transfercancel_set_admin()— cancel a pending admin transferTrackedTokensstorage tracks tokens registered viaregister_matchEmergencyActionevent with reason hashRewards contract (
rewards/src/lib.rs)set_admin(new_admin)— 48h timelocked admin transfercancel_set_admin()— cancel a pending admin transferEmergencyActionevent on completionCore (
core/src/lib.rs)TimelockNotExpired = 8— returned when a timelock has not yet elapsedMismatchPendingData = 9— returned when confirmation params don't match the pending requestTokenIsTracked = 10— returned when attempting to recover a token used in registered matchesTests
Closes #21