Skip to content

fTokenNativeUnderlyingHelpers ​

Git Source

Small native-token helpers reused by the permissioned native fToken without inheriting production fToken.

Constants ​

NATIVE_TOKEN_ADDRESS ​

solidity
address public constant NATIVE_TOKEN_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE

Functions ​

_getLiquiditySlotLinksAssetNative ​

solidity
function _getLiquiditySlotLinksAssetNative() internal pure returns (address);

_getLiquidityUnderlyingBalanceNative ​

solidity
function _getLiquidityUnderlyingBalanceNative(IFluidLiquidity liquidity_) internal view returns (uint256);

_rescueFundsNative ​

solidity
function _rescueFundsNative(address token_, IFluidLiquidity liquidity_) internal;

_depositToLiquidityNative ​

solidity
function _depositToLiquidityNative(IFluidLiquidity liquidity_, uint256 assets_, bytes memory liquidityCallbackData_)
    internal
    returns (uint256 exchangePrice_);

_prepareWrappedNativeDeposit ​

solidity
function _prepareWrappedNativeDeposit(
    IAllowanceTransfer permit2_,
    IERC20 asset_,
    uint256 assets_,
    bytes memory liquidityCallbackData_
) internal;

_withdrawFromLiquidityNative ​

solidity
function _withdrawFromLiquidityNative(IFluidLiquidity liquidity_, uint256 assets_, address receiver_)
    internal
    returns (uint256 exchangePrice_);

_finalizeWrappedNativeWithdraw ​

solidity
function _finalizeWrappedNativeWithdraw(IERC20 asset_, uint256 assets_, address receiver_) internal;

_rebalanceNative ​

shared native rebalance math: caps assetsNeeded_ at msgValue_, refunds any excess to caller_, and deposits the resolved amount into Liquidity. Returns resolved assets_ + new liquidity exchange price.

solidity
function _rebalanceNative(IFluidLiquidity liquidity_, uint256 assetsNeeded_, uint256 msgValue_, address caller_)
    internal
    returns (uint256 assets_, uint256 liquidityExchangePrice_);

_rebalanceNativeBidirectional ​

Bidirectional native rebalance shared by production and permissioned native fTokens. Rewards: deposit native to Liquidity up to msgValue_. Fees: withdraw excess Liquidity to rebalancer_.

solidity
function _rebalanceNativeBidirectional(
    IFluidLiquidity liquidity_,
    uint256 totalAssets_,
    uint256 liquidityBalance_,
    uint256 msgValue_,
    address caller_,
    address rebalancer_,
    uint256 liquidityExchangePriceIfUnchanged_
) internal returns (uint256 assets_, uint256 liquidityExchangePrice_, int256 signedAssets_);

Returns

NameTypeDescription
assets_uint256absolute amount moved (0 if no-op)
liquidityExchangePrice_uint256Liquidity exchange price after the operate (or unchanged if no-op)
signedAssets_int256LogRebalance payload: +deposit/rewards, -withdraw/fees, 0 no-op