fTokenEIP2612Deposits
Inherits:fTokenActions
implements fTokens support for deposit / mint via EIP-2612 permit.
methods revert if underlying asset does not support EIP-2612.
Functions
depositWithSignatureEIP2612
deposit assets_
amount with EIP-2612 Permit2 signature for underlying asset approval.
IMPORTANT: This will revert if the underlying asset()
does not support EIP-2612.
reverts with fToken__MinAmountOut()
if minAmountOut_
of shares is not reached.
assets_
must at least be minDeposit()
amount; reverts fToken__DepositInsignificant()
if not.
function depositWithSignatureEIP2612(
uint256 assets_,
address receiver_,
uint256 minAmountOut_,
uint256 deadline_,
bytes calldata signature_
) external returns (uint256 shares_);
Parameters
Name | Type | Description |
---|---|---|
assets_ | uint256 | amount of assets to deposit |
receiver_ | address | receiver of minted fToken shares |
minAmountOut_ | uint256 | minimum accepted amount of shares minted |
deadline_ | uint256 | deadline for signature validity |
signature_ | bytes | packed signature of signing the EIP712 hash for EIP-2612 Permit |
Returns
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount of minted shares |
mintWithSignatureEIP2612
mint amount of shares_
with EIP-2612 Permit signature for underlying asset approval.
IMPORTANT: This will revert if the underlying asset()
does not support EIP-2612.
Signature should approve a little bit more than expected assets amount (previewMint()
) to avoid reverts.
shares_
must at least be minMint()
amount; reverts with fToken__DepositInsignificant()
if not.
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 mintWithSignatureEIP2612(
uint256 shares_,
address receiver_,
uint256 maxAssets_,
uint256 deadline_,
bytes calldata signature_
) external returns (uint256 assets_);
Parameters
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount of shares to mint |
receiver_ | address | receiver of minted fToken shares |
maxAssets_ | uint256 | maximum accepted amount of assets used as input to mint shares_ |
deadline_ | uint256 | deadline for signature validity |
signature_ | bytes | packed signature of signing the EIP712 hash for EIP-2612 Permit |
Returns
Name | Type | Description |
---|---|---|
assets_ | uint256 | deposited assets amount |