IFluidVault ​
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, // tick
uint256, // raw debt
uint256, // raw collateral
uint256, // branchID_
uint256 // branchData_
);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 payable 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 which deploys oracle
address supply; // either liquidity layer or DEX protocol
address borrow; // either liquidity layer or DEX protocol
Tokens supplyToken; // if smart collateral then address of token0 & token1 else just supply token address at token0 and token1 as empty
Tokens borrowToken; // if smart debt then address of token0 & token1 else just borrow token address at token0 and token1 as empty
uint256 vaultId;
uint256 vaultType;
bytes32 supplyExchangePriceSlot; // if smart collateral then slot is from DEX protocol else from liquidity layer
bytes32 borrowExchangePriceSlot; // if smart debt then slot is from DEX protocol else from liquidity layer
bytes32 userSupplySlot; // if smart collateral then slot is from DEX protocol else from liquidity layer
bytes32 userBorrowSlot; // if smart debt then slot is from DEX protocol else from liquidity layer
}
