Label: complexity: high
Points: 200
Description
If a critical, unpatchable bug is discovered, there's currently no way for admin to recover all custodied funds to a safe address in an emergency — pause() only stops new activity, it doesn't move existing custody. This issue adds a last-resort emergency withdrawal, intentionally heavily gated.
Technical Context
Involves lib.rs — emergency_withdraw(env, admin, token: Address, destination: Address), requiring (a) the contract to already be paused, (b) a timelocked confirmation (reusing the timelock queue from issue #2 if implemented, or a standalone 7-day delay) before execution, transferring the full token balance from contract custody to destination. Emits a prominent emergency_withdrawal_executed event.
Acceptance Criteria
Label: complexity: high
Points: 200
Description
If a critical, unpatchable bug is discovered, there's currently no way for admin to recover all custodied funds to a safe address in an emergency —
pause()only stops new activity, it doesn't move existing custody. This issue adds a last-resort emergency withdrawal, intentionally heavily gated.Technical Context
Involves
lib.rs—emergency_withdraw(env, admin, token: Address, destination: Address), requiring (a) the contract to already be paused, (b) a timelocked confirmation (reusing the timelock queue from issue #2 if implemented, or a standalone 7-day delay) before execution, transferring the full token balance from contract custody todestination. Emits a prominentemergency_withdrawal_executedevent.Acceptance Criteria
pausedfirst — cannot be called on an active contractdestinationemergency_withdrawal_executedevent includes token, destination, and amount for maximum transparencycargo clippypasses with zero warnings