Function: deposit(uint256 assets, address receiver)
This deposits assets to mint shares in the contract.
Inputs
assetsControl: Fully controlled.
Constraints: No constraints.
Impact: The amount of assets to deposit.
receiverControl: Fully controlled.
Constraints: No constraints.
Impact: The address to receive the minted shares.
Branches and code coverage (including function calls)
Intended branches
The function calculates the preview deposit amount from assets and ensures it is not zero.
The function transfers the assets from the caller to the contract.
The function mints shares for the receiver.
The function emits a
Depositevent.The function calls
afterDepositto perform any necessary postdeposit actions.
Negative behavior
The function reverts with
ZERO_SHARESif the calculated shares are zero.
Function call analysis
asset.safeTransferFrom(msg.sender, address(this), assets)What is controllable?
msg.senderandassets.If return value controllable, how is it used and how can it go wrong? This function call does not return a value.
What happens if it reverts, reenters, or does other unusual control flow? If the asset transfer fails, it will revert and the transaction will be rolled back.
_mint(receiver, shares)What is controllable?
receiverandshares.If return value controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters, or does other unusual control flow? If the minting of shares fails, it will revert and the transaction will be rolled back.
afterDeposit(assets, shares)What is controllable?
assetsandshares.If return value controllable, how is it used and how can it go wrong? N/A.
What happens if it reverts, reenters, or does other unusual control flow? If the
afterDepositfunction reverts, the entire function would revert.