Function: deposit(uint256 _amount0, uint256 _amount1, uint256 _minShares)
Allows user to deposit in the vault and receive shares.
Inputs
_amount0
Control: Fully controlled by the user.
Constraints: None. Basically checked that
msg.sender
affords the deposit.Impact: The amount of token0 to deposit.
_amount1
Control: Fully controlled by the user.
Constraints: None. Basically checked that
msg.sender
affords the deposit.Impact: The amount of token1 to deposit.
_minShares
Control: Fully controlled by the user.
Constraints: None. Checked that the user receives enough shares.
Impact: The minimum amount of shares that the user wants to receive with slippage.
Branches and code coverage
Intended branches
Should transfer the
_amount0
and_amount1
from the user to the strategy.Should mint the user the correct amount of shares.
Ensure that the user receives enough shares (i.e.,
shares > _minShares
).Calculate the correct amount of shares to mint based on the amount of tokens deposited.
Should mint some minimum amount of shares on the first-ever deposit. This is against the first-depositor bug.
Negative behavior
Should not allow the user to deposit zero tokens. Currently not enforced.
Should not allow the user to deposit more than they have.
Should not allow the user to deposit someone else's tokens.
Should not allow the user to deposit inflationary tokens.