fTokenNativeUnderlyingOverrides

Git Source

Inherits:fToken, IFTokenNativeUnderlying

overrides certain methods from the inherited fToken used as base contract to make them compatible with the native token being used as underlying.

State Variables

NATIVE_TOKEN_ADDRESS

address that is mapped to the chain native token at Liquidity

address public constant NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

Functions

_getLiquiditySlotLinksAsset

gets asset address for liquidity slot links, overridden to set native token address

function _getLiquiditySlotLinksAsset() internal view virtual override returns (address);

_getLiquidityUnderlyingBalance

Gets current Liquidity underlying token balance

function _getLiquidityUnderlyingBalance() internal view virtual override returns (uint256);

rescueFunds

sends any potentially stuck funds to Liquidity contract. Only callable by LendingFactory auths.

function rescueFunds(address token_) external virtual override(IFTokenAdmin, fTokenAdmin) nonReentrant;

rebalance

function rebalance()
    external
    payable
    virtual
    override(IFTokenAdmin, fTokenAdmin)
    nonReentrant
    returns (uint256 assets_);

_depositToLiquidity

Deposit assets_ amount of tokens to Liquidity

function _depositToLiquidity(uint256 assets_, bytes memory liquidityCallbackData_)
    internal
    virtual
    override
    returns (uint256 exchangePrice_);

Parameters

NameTypeDescription
assets_uint256The amount of tokens to deposit
liquidityCallbackData_bytescallback data passed to Liquidity for liquidityCallback

Returns

NameTypeDescription
exchangePrice_uint256liquidity exchange price for token

_executeDeposit

deposits assets_ into liquidity and mints shares for receiver_. Returns amount of sharesMinted_.

function _executeDeposit(uint256 assets_, address receiver_, bytes memory liquidityCallbackData_)
    internal
    virtual
    override
    returns (uint256 sharesMinted_);

_executeDepositNative

deposits msg.value amount of native token into liquidity and mints shares for receiver_. Returns amount of sharesMinted_.

function _executeDepositNative(address receiver_) internal virtual returns (uint256 sharesMinted_);

_withdrawFromLiquidity

Withdraw assets_ amount of tokens from Liquidity directly to receiver_

function _withdrawFromLiquidity(uint256 assets_, address receiver_)
    internal
    virtual
    override
    returns (uint256 exchangePrice_);

Parameters

NameTypeDescription
assets_uint256The amount of tokens to withdraw
receiver_addressthe receiver address of withdraw amount

Returns

NameTypeDescription
exchangePrice_uint256liquidity exchange price for token

_executeWithdraw

withdraws assets_ from liquidity to receiver_ and burns shares from owner_. Returns amount of sharesBurned_. requires nonReentrant! modifier on calling method otherwise ERC777s could reenter!

function _executeWithdraw(uint256 assets_, address receiver_, address owner_)
    internal
    virtual
    override
    returns (uint256 sharesBurned_);

_executeWithdrawNative

withdraws assets_ from liquidity to receiver_ and burns shares from owner_. Returns amount of sharesBurned_.

function _executeWithdrawNative(uint256 assets_, address receiver_, address owner_)
    internal
    virtual
    returns (uint256 sharesBurned_);