Assessment reports>WOOFI Stake>Threat Model>instantWithdraw

Function: instantWithdraw(uint256 amount)

This allows a user to instantly withdraw from the SuperChargerVault.

Inputs

  • amount

    • Control: Fully controlled.

    • Constraints: User needs to afford amount tokens in terms of the shares that are to be burned.

    • Impact: The amount of tokens to withdraw.

Branches and code coverage

Intended branches

  • Accrue interest in the lending manager.

  • Calculate the amount of assets to withdraw.

  • Check if the instant withdraw cap is reached.

  • If the caller is not the owner of the funds, spend the allowance of the owner.

  • Burn the shares of the owner.

  • Withdraw the reserve shares.

  • Calculate the fees and deduct them from the withdrawn amount — also, transfer the fees to the treasury.

  • Transfer the remaining amount to the owner.

  • Update the instant withdraw amount by adding the withdrawn amount.

Negative behavior

  • Should not allow withdrawing more than the cap.

  • Should not allow withdrawing if the user cannot afford the shares. Enforced through _burn.

Zellic © 2024Back to top ↑