Assessment reports>Beefy UniswapV3>Threat Model>withdraw

Function: withdraw(uint256 _shares, uint256 _minAmount0, uint256 _minAmount1)

Allows users to withdraw their shares from the vault.

Inputs

  • _shares

    • Control: Fully controlled by the user.

    • Constraints: Checked that the user has enough shares to withdraw.

    • Impact: The number of shares to be withdrawn.

  • _minAmount0

    • Control: The minimum amount of token0 that the user wants to receive with slippage.

    • Constraints: Checked that the resulting amount is greater than the minimum amount.

    • Impact: The minimum amount of token0 that the user wants to receive with slippage.

  • _minAmount1

    • Control: The minimum amount of token1 that the user wants to receive with slippage.

    • Constraints: Checked that the resulting amount is greater than the minimum amount.

    • Impact: The minimum amount of token1 that the user wants to receive with slippage.

Branches and code coverage

Intended branches

  • Assumes that the position of the vault does have enough liquidity to withdraw the shares.

  • Calculate the amount of tokens needed to be withdrawn for the burnt shares.

  • Should burn the shares from msg.sender.

  • Should transfer at least _minAmount0 of token0 and _minAmount1 of token1 to msg.sender.

Negative behavior

  • Should not allow the user to withdraw more shares than they have. This is enforced through burn, as the user must have the shares to burn them.

Zellic © 2024Back to top ↑