IFToken
Inherits: IERC4626, IFTokenAdmin
Functions
minDeposit
returns minimum amount required for deposit (rounded up)
function minDeposit() external view returns (uint256);
getData
returns config, rewards and exchange prices data in a single view method.
function getData()
external
view
returns (
IFluidLiquidity liquidity_,
IFluidLendingFactory lendingFactory_,
IFluidLendingRewardsRateModel lendingRewardsRateModel_,
IAllowanceTransfer permit2_,
address rebalancer_,
bool rewardsActive_,
uint256 liquidityBalance_,
uint256 liquidityExchangePrice_,
uint256 tokenExchangePrice_
);
Returns
Name | Type | Description |
---|---|---|
liquidity_ | IFluidLiquidity | address of the Liquidity contract. |
lendingFactory_ | IFluidLendingFactory | address of the Lending factory contract. |
lendingRewardsRateModel_ | IFluidLendingRewardsRateModel | address of the rewards rate model contract. changeable by LendingFactory auths. |
permit2_ | IAllowanceTransfer | address of the Permit2 contract used for deposits / mint with signature |
rebalancer_ | address | address of the rebalancer allowed to execute rebalance() |
rewardsActive_ | bool | true if rewards are currently active |
liquidityBalance_ | uint256 | current Liquidity supply balance of address(this) for the underyling asset |
liquidityExchangePrice_ | uint256 | (updated) exchange price for the underlying assset in the liquidity protocol (without rewards) |
tokenExchangePrice_ | uint256 | (updated) exchange price between fToken and the underlying assset (with rewards) |
liquidityCallback
transfers amount_
of token_
to liquidity. Only callable by liquidity contract.
this callback is used to optimize gas consumption (reducing necessary token transfers).
function liquidityCallback(address token_, uint256 amount_, bytes calldata data_) external;
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 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 |
permit_ | IAllowanceTransfer.PermitSingle | Permit2 permit message |
signature_ | bytes | packed signature of signing the EIP712 hash of permit_ |
Returns
Name | Type | Description |
---|---|---|
shares_ | uint256 | amount 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 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_ |
permit_ | IAllowanceTransfer.PermitSingle | Permit2 permit message |
signature_ | bytes | packed signature of signing the EIP712 hash of permit_ |
Returns
Name | Type | Description |
---|---|---|
assets_ | uint256 | deposited assets amount |