Function: deposit(uint256 amount, PurchasePermit permit, bytes permitSignature)
This function is used to deposit USDC into the vault. This action needs a valid PurchasePermit, which is signed by permitSigner.
Inputs
amountControl: Arbitrary
uint256.Constraints: Must be greater than zero.
Impact: Amount of USDC to deposit.
permitControl: Arbitrary
PurchasePermit.Constraints: Should be signed by
permitSignerand validated by_validatePurchasePermit.Impact: The
PurchasePermitto validate the eligibility of the user.
permitSignatureControl: Arbitrary bytes.
Constraints: Should be a valid signature of the permit.
Impact: Signature of the permit.
Branches and code coverage
Intended branches
Invoke
_validatePurchasePermitto validate the provided permit.Calculate the actual amount to deposit based on the remaining cap.
Update user and entity information if it is a new
entityID.Update total deposited amount and the user's deposit amount.
Transfer USDC from the user to the vault.
Emit the
Depositedevent.
Negative behavior
Revert if the amount is zero.
Revert if the total deposits have reached the cap.
Revert if the permit is not signed by
permitSigner.Revert if the permit is expired.
Revert if the permit is not valid (
forcedLockup).Revert if the permit is not valid (
isEligible).Revert if the sender is not the wallet of the permit.
Revert if the
entityIDis already bound to another wallet.Revert if the wallet is already bound to another
entityID.Revert if the actual amount is zero.