Skip to content

TokenInterface ​

balanceOf ​

solidity
function balanceOf(address) external view returns (uint256)

FluidVaultResolver ​

Fluid Vault protocol resolver Implements various view-only methods to give easy access to Vault protocol data. For vaults with Smart Col / Smart Debt from the Dex protocol, combine this data with Data fetched from the DexResolver e.g. via MultiCall to fetch Vault limits, shares exchange rates etc. at the Dex.

constructor ​

solidity
constructor(address factory_, address liquidityResolver_) public

getVaultAddress ​

solidity
function getVaultAddress(uint256 vaultId_) public view returns (address vault_)

Get the address of a vault.

Parameters ​

NameTypeDescription
vaultId_uint256The ID of the vault.

Return Values ​

NameTypeDescription
vault_addressThe address of the vault.

getVaultType ​

solidity
function getVaultType(address vault_) public view returns (uint256 vaultType_)

Get the type of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
vaultType_uint256The type of the vault. 0 if not a Fluid vault.

getVaultId ​

solidity
function getVaultId(address vault_) public view returns (uint256 id_)

Get the ID of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
id_uint256The ID of the vault.

getTokenConfig ​

solidity
function getTokenConfig(uint256 nftId_) public view returns (uint256)

Get the token configuration.

Parameters ​

NameTypeDescription
nftId_uint256The ID of the NFT.

Return Values ​

NameTypeDescription
[0]uint256The token configuration.

getVaultVariablesRaw ​

solidity
function getVaultVariablesRaw(address vault_) public view returns (uint256)

Get the raw variables of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
[0]uint256The raw variables of the vault.

getVaultVariables2Raw ​

solidity
function getVaultVariables2Raw(address vault_) public view returns (uint256)

Get the raw variables of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
[0]uint256The raw variables of the vault.

getAbsorbedLiquidityRaw ​

solidity
function getAbsorbedLiquidityRaw(address vault_) public view returns (uint256)

Get the absorbed liquidity of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
[0]uint256The absorbed liquidity of the vault.

getPositionDataRaw ​

solidity
function getPositionDataRaw(address vault_, uint256 positionId_) public view returns (uint256)

Get the position data of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
positionId_uint256The ID of the position.

Return Values ​

NameTypeDescription
[0]uint256The position data of the vault.

getTickDataRaw ​

solidity
function getTickDataRaw(address vault_, int256 tick_) public view returns (uint256)

Get the raw tick data of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
tick_int256The tick value.

Return Values ​

NameTypeDescription
[0]uint256The raw tick data of the vault.

getTickHasDebtRaw ​

solidity
function getTickHasDebtRaw(address vault_, int256 key_) public view returns (uint256)

Get the raw tick data of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
key_int256The tick key.

Return Values ​

NameTypeDescription
[0]uint256The raw tick data of the vault.

getTickIdDataRaw ​

solidity
function getTickIdDataRaw(address vault_, int256 tick_, uint256 id_) public view returns (uint256)

Get the raw tick data of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
tick_int256The tick value.
id_uint256The ID of the tick.

Return Values ​

NameTypeDescription
[0]uint256The raw tick data of the vault.

getBranchDataRaw ​

solidity
function getBranchDataRaw(address vault_, uint256 branch_) public view returns (uint256)

Get the raw branch data of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
branch_uint256The branch value.

Return Values ​

NameTypeDescription
[0]uint256The raw branch data of the vault.

getRateRaw ​

solidity
function getRateRaw(address vault_) public view returns (uint256)

Get the raw rate of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
[0]uint256The raw rate of the vault.

getRebalancer ​

solidity
function getRebalancer(address vault_) public view returns (address)

Get the rebalancer of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
[0]addressThe rebalancer of the vault.

getAbsorbedDustDebt ​

solidity
function getAbsorbedDustDebt(address vault_) public view returns (uint256)

Get the absorbed dust debt of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
[0]uint256The absorbed dust debt of the vault.

getDexFromAddress ​

solidity
function getDexFromAddress(address vault_) public view returns (address)

Get the DEX from address of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
[0]addressThe DEX from address of the vault.

getTotalVaults ​

solidity
function getTotalVaults() public view returns (uint256)

Get the total number of vaults.

Return Values ​

NameTypeDescription
[0]uint256The total number of vaults.

getAllVaultsAddresses ​

solidity
function getAllVaultsAddresses() public view returns (address[] vaults_)

Get the addresses of all the vaults.

Return Values ​

NameTypeDescription
vaults_address[]The addresses of all the vaults.

getContractForDeployerIndex ​

solidity
function getContractForDeployerIndex(address vault_, uint256 index_) public view returns (address)

Get the contract for deployer index of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
index_uint256The index of the deployer.

Return Values ​

NameTypeDescription
[0]addressThe contract for deployer index of the vault.

_getVaultConstants ​

solidity
function _getVaultConstants(address vault_, uint256 vaultType_) internal view returns (struct IFluidVault.ConstantViews constants_)

Get the constants of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
vaultType_uint256The type of the vault.

Return Values ​

NameTypeDescription
constants_struct IFluidVault.ConstantViewsThe constants of the vault.

_getVaultConfig ​

solidity
function _getVaultConfig(address vault_, uint256 vaultType_) internal view returns (struct Structs.Configs configs_)

Get the configuration of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
vaultType_uint256The type of the vault.

Return Values ​

NameTypeDescription
configs_struct Structs.ConfigsThe configuration of the vault.

_getExchangePricesAndRates ​

solidity
function _getExchangePricesAndRates(address vault_, uint256 vaultType_, struct Structs.Configs configs_, uint256 liquiditySupplyRate_, uint256 liquidityBorrowRate_) internal view returns (struct Structs.ExchangePricesAndRates exchangePricesAndRates_)

Get the exchange prices and rates of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
vaultType_uint256The type of the vault.
configs_struct Structs.ConfigsThe configuration of the vault.
liquiditySupplyRate_uint256The liquidity supply rate, only set in case of NOT smart collateral.
liquidityBorrowRate_uint256The liquidity borrow rate, only set in case of NOT smart debt.

Return Values ​

NameTypeDescription
exchangePricesAndRates_struct Structs.ExchangePricesAndRatesThe exchange prices and rates of the vault.

_getTotalSupplyAndBorrow ​

solidity
function _getTotalSupplyAndBorrow(address vault_, struct Structs.ExchangePricesAndRates exchangePricesAndRates_, struct IFluidVault.ConstantViews constantsVariables_) internal view returns (struct Structs.TotalSupplyAndBorrow totalSupplyAndBorrow_)

Get the total supply and borrow of a vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.
exchangePricesAndRates_struct Structs.ExchangePricesAndRatesThe exchange prices and rates of the vault.
constantsVariables_struct IFluidVault.ConstantViewsThe constants and variables of the vault.

Return Values ​

NameTypeDescription
totalSupplyAndBorrow_struct Structs.TotalSupplyAndBorrowThe total supply and borrow of the vault.

_getLimitsAndAvailability ​

solidity
function _getLimitsAndAvailability(struct Structs.ExchangePricesAndRates exchangePricesAndRates_, struct IFluidVault.ConstantViews constantsVariables_, uint256 withdrawalGapConfig_, uint256 borrowLimit_, uint256 borrowLimitUtilization_, uint256 borrowableUntilLimit_) internal view returns (struct Structs.LimitsAndAvailability limitsAndAvailability_)

Calculates limits and availability for a user's vault operations.

Parameters ​

NameTypeDescription
exchangePricesAndRates_struct Structs.ExchangePricesAndRatesExchange prices and rates for the vault.
constantsVariables_struct IFluidVault.ConstantViewsConstants and variables for the vault.
withdrawalGapConfig_uint256Configuration for the withdrawal gap.
borrowLimit_uint256The borrow limit for the user. Only set if not smart debt.
borrowLimitUtilization_uint256The utilization of the borrow limit. Only set if not smart debt.
borrowableUntilLimit_uint256The limit until which borrowing is allowed. Only set if not smart debt.

Return Values ​

NameTypeDescription
limitsAndAvailability_struct Structs.LimitsAndAvailabilityThe calculated limits and availability for the user's vault operations.

getVaultState ​

solidity
function getVaultState(address vault_) public view returns (struct Structs.VaultState vaultState_)

Retrieves the state of a given vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault to retrieve the state for.

Return Values ​

NameTypeDescription
vaultState_struct Structs.VaultStateThe state of the vault, including top tick, current and total branches, total supply and borrow, total positions, and current branch state.

getVaultEntireData ​

solidity
function getVaultEntireData(address vault_) public view returns (struct Structs.VaultEntireData vaultData_)

Retrieves the entire data for a given vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault to retrieve the data for.

Return Values ​

NameTypeDescription
vaultData_struct Structs.VaultEntireDataThe entire data of the vault.

getVaultsEntireData ​

solidity
function getVaultsEntireData(address[] vaults_) external view returns (struct Structs.VaultEntireData[] vaultsData_)

Retrieves the entire data for a list of vaults.

Parameters ​

NameTypeDescription
vaults_address[]The list of vault addresses.

Return Values ​

NameTypeDescription
vaultsData_struct Structs.VaultEntireData[]An array of VaultEntireData structures containing the data for each vault.

getVaultsEntireData ​

solidity
function getVaultsEntireData() external view returns (struct Structs.VaultEntireData[] vaultsData_)

Retrieves the entire data for all vaults.

Return Values ​

NameTypeDescription
vaultsData_struct Structs.VaultEntireData[]An array of VaultEntireData structures containing the data for each vault.

positionByNftId ​

solidity
function positionByNftId(uint256 nftId_) public view returns (struct Structs.UserPosition userPosition_, struct Structs.VaultEntireData vaultData_)

Retrieves the position data for a given NFT ID and the corresponding vault data.

Parameters ​

NameTypeDescription
nftId_uint256The NFT ID for which to retrieve the position data.

Return Values ​

NameTypeDescription
userPosition_struct Structs.UserPositionThe UserPosition structure containing the position data.
vaultData_struct Structs.VaultEntireDataThe VaultEntireData structure containing the vault data.

positionsNftIdOfUser ​

solidity
function positionsNftIdOfUser(address user_) public view returns (uint256[] nftIds_)

Returns an array of NFT IDs for all positions of a given user.

Parameters ​

NameTypeDescription
user_addressThe address of the user for whom to fetch positions.

Return Values ​

NameTypeDescription
nftIds_uint256[]An array of NFT IDs representing the user's positions.

vaultByNftId ​

solidity
function vaultByNftId(uint256 nftId_) public view returns (address vault_)

Returns the vault address associated with a given NFT ID.

Parameters ​

NameTypeDescription
nftId_uint256The NFT ID for which to fetch the vault address.

Return Values ​

NameTypeDescription
vault_addressThe address of the vault associated with the NFT ID.

positionsByUser ​

solidity
function positionsByUser(address user_) external view returns (struct Structs.UserPosition[] userPositions_, struct Structs.VaultEntireData[] vaultsData_)

Fetches all positions and their corresponding vault data for a given user.

Parameters ​

NameTypeDescription
user_addressThe address of the user for whom to fetch positions and vault data.

Return Values ​

NameTypeDescription
userPositions_struct Structs.UserPosition[]An array of UserPosition structs representing the user's positions.
vaultsData_struct Structs.VaultEntireData[]An array of VaultEntireData structs representing the vault data for each position.

totalPositions ​

solidity
function totalPositions() external view returns (uint256)

Returns the total number of positions across all users.

Return Values ​

NameTypeDescription
[0]uint256The total number of positions.

getVaultLiquidation ​

solidity
function getVaultLiquidation(address vault_, uint256 tokenInAmt_) public returns (struct Structs.LiquidationStruct liquidationData_)

fetches available liquidations

Parameters ​

NameTypeDescription
vault_addressaddress of vault for which to fetch
tokenInAmt_uint256token in aka debt to payback, leave 0 to get max

Return Values ​

NameTypeDescription
liquidationData_struct Structs.LiquidationStructliquidation related data. Check out structs.sol

_decodeLiquidationResult ​

solidity
function _decodeLiquidationResult(bytes lowLevelData_) internal pure returns (uint256 amtIn_, uint256 amtOut_)

helper method to decode liquidation result revert data

getMultipleVaultsLiquidation ​

solidity
function getMultipleVaultsLiquidation(address[] vaults_, uint256[] tokensInAmt_) external returns (struct Structs.LiquidationStruct[] liquidationsData_)

Retrieves liquidation data for multiple vaults.

Parameters ​

NameTypeDescription
vaults_address[]The array of vault addresses.
tokensInAmt_uint256[]The array of token amounts to liquidate.

Return Values ​

NameTypeDescription
liquidationsData_struct Structs.LiquidationStruct[]An array of LiquidationStruct containing the liquidation data for each vault.

getAllVaultsLiquidation ​

solidity
function getAllVaultsLiquidation() external returns (struct Structs.LiquidationStruct[] liquidationsData_)

Retrieves liquidation data for all vaults.

Return Values ​

NameTypeDescription
liquidationsData_struct Structs.LiquidationStruct[]An array of LiquidationStruct containing the liquidation data for all vaults.

getVaultAbsorb ​

solidity
function getVaultAbsorb(address vault_) public returns (struct Structs.AbsorbStruct absorbData_)

DEPRECATED, only works for vaults v1.0.0: Retrieves absorb data for a single vault.

Parameters ​

NameTypeDescription
vault_addressThe address of the vault.

Return Values ​

NameTypeDescription
absorbData_struct Structs.AbsorbStructThe AbsorbStruct containing the absorb data for the vault.

getVaultsAbsorb ​

solidity
function getVaultsAbsorb(address[] vaults_) public returns (struct Structs.AbsorbStruct[] absorbData_)

DEPRECATED, only works for vaults v1.0.0: Retrieves absorb data for multiple vaults.

Parameters ​

NameTypeDescription
vaults_address[]The array of vault addresses.

Return Values ​

NameTypeDescription
absorbData_struct Structs.AbsorbStruct[]An array of AbsorbStruct containing the absorb data for each vault.

getVaultsAbsorb ​

solidity
function getVaultsAbsorb() public returns (struct Structs.AbsorbStruct[] absorbData_)

DEPRECATED, only works for vaults v1.0.0: Retrieves absorb data for all vaults.

Return Values ​

NameTypeDescription
absorbData_struct Structs.AbsorbStruct[]An array of AbsorbStruct containing the absorb data for all vaults.