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

  • amount

    • Control: Arbitrary uint256.

    • Constraints: Must be greater than zero.

    • Impact: Amount of USDC to deposit.

  • permit

    • Control: Arbitrary PurchasePermit.

    • Constraints: Should be signed by permitSigner and validated by _validatePurchasePermit.

    • Impact: The PurchasePermit to validate the eligibility of the user.

  • permitSignature

    • Control: Arbitrary bytes.

    • Constraints: Should be a valid signature of the permit.

    • Impact: Signature of the permit.

Branches and code coverage

Intended branches

  • Invoke _validatePurchasePermit to 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 Deposited event.

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 entityID is already bound to another wallet.

  • Revert if the wallet is already bound to another entityID.

  • Revert if the actual amount is zero.

Zellic © 2025Back to top ↑