Emergency withdrawal guide (advanced)
If a user's request is not processed within the emergencyWithdrawalDelay period, the user can perform an emergency withdrawal.
Note! In this case, the user may receive less funds than entitled by the system, as this function only handles ERC20 tokens in the system.
Therefore, if the system has a base asset that is not represented as an ERC20 token, the corresponding portion of the funds will be lost by the user.
User instructions:
Determine smart contract address of the asset user is eligible to withdraw.
Call
emergencyWithdrawmethod using abi. Connect wallet to either of https://etherscan.io/,https://eth95.dev/, https://abi.ninja/ and sendemergencyWithdrawtx. Usage of any of the services is not an endorsment, be careful what you sign and do tx simulation beforehand. User needs to setminAmountsanddeadlineas input parameters. Here is detailed instruction forminAmounts. minAmountsequalsbaseTvl().amounts * withdrawalReqest.lpAmount / vault.totalSupply() - 1 Gwei.baseTvl()can be found in read method of the same vault contract.baseTvl()function returns two values in an array (for weth and for wsteth), you'll need to save that for step 3.Then find
totalSupply()in the vault contract and do the same.Along with your requested lp amount (can be obtained from withdrawalRequest) copy an array from baseTvl() and for each value from it make the followinh calculation:
baseTvl.amounts[i] * withdrawalReqest.lpAmount / vault.totalSupply() - 1 GweiPass the resulting array to emergencyWithdraw
minAmountsfield.
deadlineis unix timestamp + N minutes while withdrawal is valid. InputminAmountsarray anddeadlineinto emergencyWithdraw method and send tx.When your correct tx is confirmed on chain, you'll see ERC20 token from vault sent to your wallet.
Last updated