Skip to content

FluidVaultT1Resolver ​

Git Source

Inherits:Helpers

Fluid VaultT1 protocol resolver Implements various view-only methods to give easy access to Vault protocol data.

Functions ​

constructor ​

solidity
constructor(address factory_, address liquidityResolver_) Helpers(factory_, liquidityResolver_);

getVaultAddress ​

Get the address of a vault.

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

Parameters

NameTypeDescription
vaultId_uint256The ID of the vault.

Returns

NameTypeDescription
vault_addressThe address of the vault.

getVaultType ​

Get the type of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

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

getVaultId ​

Get the ID of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
id_uint256The ID of the vault.

getTokenConfig ​

Get the token configuration.

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

Parameters

NameTypeDescription
nftId_uint256The ID of the NFT.

Returns

NameTypeDescription
<none>uint256The token configuration.

getVaultVariablesRaw ​

Get the raw variables of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
<none>uint256The raw variables of the vault.

getVaultVariables2Raw ​

Get the raw variables of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
<none>uint256The raw variables of the vault.

getAbsorbedLiquidityRaw ​

Get the absorbed liquidity of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
<none>uint256The absorbed liquidity of the vault.

getPositionDataRaw ​

Get the position data of a vault.

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

Parameters

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

Returns

NameTypeDescription
<none>uint256The position data of the vault.

getTickDataRaw ​

Get the raw tick data of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.
tick_int256The tick value.

Returns

NameTypeDescription
<none>uint256The raw tick data of the vault.

getTickHasDebtRaw ​

Get the raw tick data of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.
key_int256The tick key.

Returns

NameTypeDescription
<none>uint256The raw tick data of the vault.

getTickIdDataRaw ​

Get the raw tick data of a vault.

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

Parameters

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

Returns

NameTypeDescription
<none>uint256The raw tick data of the vault.

getBranchDataRaw ​

Get the raw branch data of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.
branch_uint256The branch value.

Returns

NameTypeDescription
<none>uint256The raw branch data of the vault.

getRateRaw ​

Get the raw rate of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
<none>uint256The raw rate of the vault.

getRebalancer ​

Get the rebalancer of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
<none>addressThe rebalancer of the vault.

getAbsorbedDustDebt ​

Get the absorbed dust debt of a vault.

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

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
<none>uint256The absorbed dust debt of the vault.

getTotalVaults ​

Get the total number of vaults (incl. new vault types).

solidity
function getTotalVaults() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256The total number of vaults.

getAllVaultsAddresses ​

Get the addresses of all the vaults.

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

Returns

NameTypeDescription
vaults_address[]The addresses of all the vaults.

_getVaultConstants ​

Get the constants of a vault.

solidity
function _getVaultConstants(address vault_) internal view returns (IFluidVaultT1.ConstantViews memory constants_);

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
constants_IFluidVaultT1.ConstantViewsThe constants of the vault.

_getVaultConfig ​

Get the configuration of a vault.

solidity
function _getVaultConfig(address vault_) internal view returns (Configs memory configs_);

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
configs_ConfigsThe configuration of the vault.

_getExchangePricesAndRates ​

Get the exchange prices and rates of a vault.

solidity
function _getExchangePricesAndRates(
    address vault_,
    Configs memory configs_,
    uint256 liquiditySupplyRate_,
    uint256 liquidityBorrowRate_
) internal view returns (ExchangePricesAndRates memory exchangePricesAndRates_);

Parameters

NameTypeDescription
vault_addressThe address of the vault.
configs_ConfigsThe configuration of the vault.
liquiditySupplyRate_uint256The liquidity supply rate
liquidityBorrowRate_uint256The liquidity borrow rate

Returns

NameTypeDescription
exchangePricesAndRates_ExchangePricesAndRatesThe exchange prices and rates of the vault.

_getTotalSupplyAndBorrow ​

Get the total supply and borrow of a vault.

solidity
function _getTotalSupplyAndBorrow(
    address vault_,
    ExchangePricesAndRates memory exchangePricesAndRates_,
    IFluidVaultT1.ConstantViews memory constantsVariables_
) internal view returns (TotalSupplyAndBorrow memory totalSupplyAndBorrow_);

Parameters

NameTypeDescription
vault_addressThe address of the vault.
exchangePricesAndRates_ExchangePricesAndRatesThe exchange prices and rates of the vault.
constantsVariables_IFluidVaultT1.ConstantViewsThe constants and variables of the vault.

Returns

NameTypeDescription
totalSupplyAndBorrow_TotalSupplyAndBorrowThe total supply and borrow of the vault.

_getLimitsAndAvailability ​

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

solidity
function _getLimitsAndAvailability(
    ExchangePricesAndRates memory exchangePricesAndRates_,
    IFluidVaultT1.ConstantViews memory constantsVariables_,
    uint256 withdrawalGapConfig_,
    uint256 borrowLimit_,
    uint256 borrowLimitUtilization_,
    uint256 borrowableUntilLimit_
) internal view returns (LimitsAndAvailability memory limitsAndAvailability_);

Parameters

NameTypeDescription
exchangePricesAndRates_ExchangePricesAndRatesExchange prices and rates for the vault.
constantsVariables_IFluidVaultT1.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.

Returns

NameTypeDescription
limitsAndAvailability_LimitsAndAvailabilityThe calculated limits and availability for the user's vault operations.

getVaultState ​

Retrieves the state of a given vault.

solidity
function getVaultState(address vault_) public view returns (VaultState memory vaultState_);

Parameters

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

Returns

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

getVaultEntireData ​

Retrieves the entire data for a given vault.

solidity
function getVaultEntireData(address vault_) public view returns (VaultEntireData memory vaultData_);

Parameters

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

Returns

NameTypeDescription
vaultData_VaultEntireDataThe entire data of the vault.

getVaultsEntireData ​

Retrieves the entire data for a list of vaults.

solidity
function getVaultsEntireData(address[] memory vaults_) external view returns (VaultEntireData[] memory vaultsData_);

Parameters

NameTypeDescription
vaults_address[]The list of vault addresses.

Returns

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

getVaultsEntireData ​

Retrieves the entire data for all vaults.

solidity
function getVaultsEntireData() external view returns (VaultEntireData[] memory vaultsData_);

Returns

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

positionByNftId ​

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

solidity
function positionByNftId(uint256 nftId_)
    public
    view
    returns (UserPosition memory userPosition_, VaultEntireData memory vaultData_);

Parameters

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

Returns

NameTypeDescription
userPosition_UserPositionThe UserPosition structure containing the position data.
vaultData_VaultEntireDataThe VaultEntireData structure containing the vault data.

positionsNftIdOfUser ​

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

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

Parameters

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

Returns

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

vaultByNftId ​

Returns the vault address associated with a given NFT ID.

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

Parameters

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

Returns

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

positionsByUser ​

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

solidity
function positionsByUser(address user_)
    external
    view
    returns (UserPosition[] memory userPositions_, VaultEntireData[] memory vaultsData_);

Parameters

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

Returns

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

totalPositions ​

Returns the total number of positions across all users.

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

Returns

NameTypeDescription
<none>uint256The total number of positions.

getVaultLiquidation ​

fetches available liquidations

solidity
function getVaultLiquidation(address vault_, uint256 tokenInAmt_)
    public
    returns (LiquidationStruct memory liquidationData_);

Parameters

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

Returns

NameTypeDescription
liquidationData_LiquidationStructliquidation related data. Check out structs.sol

_decodeLiquidationResult ​

helper method to decode liquidation result revert data

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

getMultipleVaultsLiquidation ​

Retrieves liquidation data for multiple vaults.

solidity
function getMultipleVaultsLiquidation(address[] memory vaults_, uint256[] memory tokensInAmt_)
    external
    returns (LiquidationStruct[] memory liquidationsData_);

Parameters

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

Returns

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

getAllVaultsLiquidation ​

Retrieves liquidation data for all vaults.

solidity
function getAllVaultsLiquidation() external returns (LiquidationStruct[] memory liquidationsData_);

Returns

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

getVaultAbsorb ​

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

solidity
function getVaultAbsorb(address vault_) public returns (AbsorbStruct memory absorbData_);

Parameters

NameTypeDescription
vault_addressThe address of the vault.

Returns

NameTypeDescription
absorbData_AbsorbStructThe AbsorbStruct containing the absorb data for the vault.

getVaultsAbsorb ​

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

solidity
function getVaultsAbsorb(address[] memory vaults_) public returns (AbsorbStruct[] memory absorbData_);

Parameters

NameTypeDescription
vaults_address[]The array of vault addresses.

Returns

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

getVaultsAbsorb ​

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

solidity
function getVaultsAbsorb() public returns (AbsorbStruct[] memory absorbData_);

Returns

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