Emergency Withdrawal
Emergency Withdraw is a direct exit path for credited WeedChef staking principal.
#What the function does
The contract reads the user’s credited principal and stored locked rewards, reduces pool totals, clears the user record, returns nonzero staking principal, updates referral stake state, and emits an emergency-withdrawal event. It does not update the pool or run the normal reward settlement first.
#Allocation accounting blocker
The emergency path reduces the pool's total credited stake before any pool checkpoint. The next update can divide the full elapsed pool reward by the smaller stake balance and over-credit remaining users. If the exit empties the pool, it can also change the active allocation denominator before the global checkpoint and redistribute historical pool allocation.
#Optional Rewarder blocker
The emergency path also does not call the optional pool Rewarder with a zero stake. That Rewarder can keep accounting the exited user's stale stake and may continue to accrue or pay optional rewards.
#What you give up
Stored locked rewards are removed from total locked accounting and are not transferred. Any unsettled pending base rewards accrued since the last pool and user settlement are also lost because the emergency path skips those updates. It does not call the referral-reward hook. Treat it as a principal-first escape hatch.
The event’s forfeitedRewards field only reports the stored locked-reward amount. It does not include unsettled pending base rewards, so the event alone understates the total economic reward forfeiture.
#Available during pauses
Emergency withdrawal is not gated by the deposit-pause or rewards-pause flags. Foundry tests cover returning principal while both flags are enabled. This test evidence is not an independent audit.
#Other position types
The WeedChef emergency function returns the ERC-20 staking token it holds. Direct v3 NFTs use the v3 staker’s unstake and withdraw flow. Vault shares must later be redeemed through the vault to receive underlying tokens.
#When to consider it
- A normal farm interaction is failing while the principal exit still works.
- Rewards are less important than removing the supported staking asset promptly.
- You understand both categories of forfeited reward and the asset you will receive.
- The verified contract and transaction data match the intended farm.
#Current phase
No farm is deployed or funded, so there is no current emergency-withdrawal transaction to submit. The public interface keeps all write actions disabled during pre-launch.
