fTokenPermit2Deposits

Git Source

Inherits:fTokenActions

implements fTokens support for deposit / mint via Permit2 signature.

Functions

depositWithSignature

deposit assets_ amount with Permit2 signature for underlying asset approval. reverts with fToken__MinAmountOut() if minAmountOut_ of shares is not reached. assets_ must at least be minDeposit() amount; reverts otherwise.

function depositWithSignature(
    uint256 assets_,
    address receiver_,
    uint256 minAmountOut_,
    IAllowanceTransfer.PermitSingle calldata permit_,
    bytes calldata signature_
) external nonReentrant returns (uint256 shares_);

Parameters

NameTypeDescription
assets_uint256amount of assets to deposit
receiver_addressreceiver of minted fToken shares
minAmountOut_uint256minimum accepted amount of shares minted
permit_IAllowanceTransfer.PermitSinglePermit2 permit message
signature_bytespacked signature of signing the EIP712 hash of permit_

Returns

NameTypeDescription
shares_uint256amount of minted shares

mintWithSignature

mint amount of shares_ with Permit2 signature for underlying asset approval. Signature should approve a little bit more than expected assets amount (previewMint()) to avoid reverts. shares_ must at least be minMint() amount; reverts otherwise. Note there might be tiny inaccuracies between requested shares_ and actually received shares amount. Recommended to use deposit() over mint because it is more gas efficient and less likely to revert.

function mintWithSignature(
    uint256 shares_,
    address receiver_,
    uint256 maxAssets_,
    IAllowanceTransfer.PermitSingle calldata permit_,
    bytes calldata signature_
) external nonReentrant returns (uint256 assets_);

Parameters

NameTypeDescription
shares_uint256amount of shares to mint
receiver_addressreceiver of minted fToken shares
maxAssets_uint256maximum accepted amount of assets used as input to mint shares_
permit_IAllowanceTransfer.PermitSinglePermit2 permit message
signature_bytespacked signature of signing the EIP712 hash of permit_

Returns

NameTypeDescription
assets_uint256deposited assets amount