Skip to content

IFluidVault ​

Git Source

common Fluid vaults interface, some methods only available for vaults > T1 (type, simulateLiquidate, rebalance is different)

Functions ​

VAULT_ID ​

returns the vault id

solidity
function VAULT_ID() external view returns (uint256);

TYPE ​

returns the vault id

solidity
function TYPE() external view returns (uint256);

readFromStorage ​

reads uint256 data result_ from storage at a bytes32 storage slot_ key.

solidity
function readFromStorage(bytes32 slot_) external view returns (uint256 result_);

constantsView ​

returns all Vault constants

solidity
function constantsView() external view returns (ConstantViews memory constantsView_);

fetchLatestPosition ​

fetches the latest user position after a liquidation

solidity
function fetchLatestPosition(int256 positionTick_, uint256 positionTickId_, uint256 positionRawDebt_, uint256 tickData_)
    external
    view
    returns (int256, uint256, uint256, uint256, uint256);

updateExchangePrices ​

calculates the updated vault exchange prices

solidity
function updateExchangePrices(uint256 vaultVariables2_)
    external
    view
    returns (
        uint256 liqSupplyExPrice_,
        uint256 liqBorrowExPrice_,
        uint256 vaultSupplyExPrice_,
        uint256 vaultBorrowExPrice_
    );

updateExchangePricesOnStorage ​

calculates the updated vault exchange prices and writes them to storage

solidity
function updateExchangePricesOnStorage()
    external
    returns (
        uint256 liqSupplyExPrice_,
        uint256 liqBorrowExPrice_,
        uint256 vaultSupplyExPrice_,
        uint256 vaultBorrowExPrice_
    );

LIQUIDITY ​

returns the liquidity contract address

solidity
function LIQUIDITY() external view returns (address);

rebalance ​

solidity
function rebalance(int256 colToken0MinMax_, int256 colToken1MinMax_, int256 debtToken0MinMax_, int256 debtToken1MinMax_)
    external
    returns (int256 supplyAmt_, int256 borrowAmt_);

simulateLiquidate ​

reverts with FluidLiquidateResult

solidity
function simulateLiquidate(uint256 debtAmt_, bool absorb_) external;

Errors ​

FluidLiquidateResult ​

solidity
error FluidLiquidateResult(uint256 colLiquidated, uint256 debtLiquidated);

Structs ​

Tokens ​

solidity
struct Tokens {
    address token0;
    address token1;
}

ConstantViews ​

solidity
struct ConstantViews {
    address liquidity;
    address factory;
    address operateImplementation;
    address adminImplementation;
    address secondaryImplementation;
    address deployer;
    address supply;
    address borrow;
    Tokens supplyToken;
    Tokens borrowToken;
    uint256 vaultId;
    uint256 vaultType;
    bytes32 supplyExchangePriceSlot;
    bytes32 borrowExchangePriceSlot;
    bytes32 userSupplySlot;
    bytes32 userBorrowSlot;
}