Function: withdraw(uint256 _shares, uint256 _minAmount0, uint256 _minAmount1)
Allows users to withdraw their shares from the vault.
Inputs
_sharesControl: Fully controlled by the user.
Constraints: Checked that the user has enough shares to withdraw.
Impact: The number of shares to be withdrawn.
_minAmount0Control: 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.
_minAmount1Control: 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
_minAmount0oftoken0and_minAmount1oftoken1tomsg.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.