Function: deposit(uint256 amount)
This allows a user to deposit funds into the vault.
Inputs
amountControl: Fully controlled by the caller.
Constraints: Checked that the user can afford the deposit.
Impact: The amount of funds to be deposited.
Branches and code coverage
Intended branches
Check that
msg.valuematchesamountin the case of a native deposit.Ensure that
msg.valueis zero in the case of an ERC-20 deposit.Ensure that the strategy is not paused.
Deposit the native tokens as WETH.
Transfer the ERC-20 tokens in the case of an ERC-20 deposit.
Mint the adequate amount of shares to the user.
Update the
costSharePriceof the user.Call the
earnfunction so that the vault can earn yield on the freshly deposited funds.
Negative behavior
Should not allow the user to deposit more than they can afford.