Skip to content

*Title:** `feat(contracts): implement stuck funds recovery and emergency admin operations #24

Description

@Divineifed1

Description:
Safety mechanism to recover incorrectly sent tokens or handle edge cases where users lose funds due to platform bugs. Admin operations must be time-locked and transparent.

Key functions:

  • emergency_withdraw(env, asset, to, amount) — timelocked admin
  • recover_token(env, asset, to, amount) — for accidentally sent tokens
  • set_admin(env, new_admin) — admin transfer with delay

Acceptance criteria:

  • emergency_withdraw has 24-hour timelock (stored as pending_until)
  • recover_token only works for tokens not owned by the contract's intended logic
  • All emergency ops emit EmergencyAction event with reason hash
  • Admin transfer requires 48-hour confirmation period
  • Tests simulate timelock expiry and cancellation

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions