TokenInterface ​
balanceOf ​
function balanceOf(address) external view returns (uint256)
FluidVaultT1Resolver ​
Fluid VaultT1 protocol resolver ATTENTION: Use VaultResolver instead! This is just a temporary legacy-compatible resolver. Implements various view-only methods to give easy access to Vault protocol data.
constructor ​
constructor(address factory_, address liquidity_, address liquidityResolver_) public
getVaultAddress ​
function getVaultAddress(uint256 vaultId_) public view returns (address vault_)
Get the address of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vaultId_ | uint256 | The ID of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
getVaultType ​
function getVaultType(address vault_) public view returns (uint256 vaultType_)
Get the type of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
vaultType_ | uint256 | The type of the vault. 0 if not a Fluid vault. |
getVaultId ​
function getVaultId(address vault_) public view returns (uint256 id_)
Get the ID of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
id_ | uint256 | The ID of the vault. |
getTokenConfig ​
function getTokenConfig(uint256 nftId_) public view returns (uint256)
Get the token configuration.
Parameters ​
Name | Type | Description |
---|---|---|
nftId_ | uint256 | The ID of the NFT. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The token configuration. |
getVaultVariablesRaw ​
function getVaultVariablesRaw(address vault_) public view returns (uint256)
Get the raw variables of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The raw variables of the vault. |
getVaultVariables2Raw ​
function getVaultVariables2Raw(address vault_) public view returns (uint256)
Get the raw variables of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The raw variables of the vault. |
getAbsorbedLiquidityRaw ​
function getAbsorbedLiquidityRaw(address vault_) public view returns (uint256)
Get the absorbed liquidity of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The absorbed liquidity of the vault. |
getPositionDataRaw ​
function getPositionDataRaw(address vault_, uint256 positionId_) public view returns (uint256)
Get the position data of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
positionId_ | uint256 | The ID of the position. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The position data of the vault. |
getTickDataRaw ​
function getTickDataRaw(address vault_, int256 tick_) public view returns (uint256)
Get the raw tick data of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
tick_ | int256 | The tick value. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The raw tick data of the vault. |
getTickHasDebtRaw ​
function getTickHasDebtRaw(address vault_, int256 key_) public view returns (uint256)
Get the raw tick data of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
key_ | int256 | The tick key. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The raw tick data of the vault. |
getTickIdDataRaw ​
function getTickIdDataRaw(address vault_, int256 tick_, uint256 id_) public view returns (uint256)
Get the raw tick data of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
tick_ | int256 | The tick value. |
id_ | uint256 | The ID of the tick. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The raw tick data of the vault. |
getBranchDataRaw ​
function getBranchDataRaw(address vault_, uint256 branch_) public view returns (uint256)
Get the raw branch data of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
branch_ | uint256 | The branch value. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The raw branch data of the vault. |
getRateRaw ​
function getRateRaw(address vault_) public view returns (uint256)
Get the raw rate of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The raw rate of the vault. |
getRebalancer ​
function getRebalancer(address vault_) public view returns (address)
Get the rebalancer of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | address | The rebalancer of the vault. |
getAbsorbedDustDebt ​
function getAbsorbedDustDebt(address vault_) public view returns (uint256)
Get the absorbed dust debt of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The absorbed dust debt of the vault. |
getTotalVaults ​
function getTotalVaults() public view returns (uint256)
Get the total number of vaults (incl. new vault types).
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The total number of vaults. |
getAllVaultsAddresses ​
function getAllVaultsAddresses() public view returns (address[] vaults_)
Get the addresses of all the vaults.
Return Values ​
Name | Type | Description |
---|---|---|
vaults_ | address[] | The addresses of all the vaults. |
_getVaultConstants ​
function _getVaultConstants(address vault_) internal view returns (struct IFluidVaultT1.ConstantViews constants_)
Get the constants of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
constants_ | struct IFluidVaultT1.ConstantViews | The constants of the vault. |
_getVaultConfig ​
function _getVaultConfig(address vault_) internal view returns (struct Structs.Configs configs_)
Get the configuration of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
configs_ | struct Structs.Configs | The configuration of the vault. |
_getExchangePricesAndRates ​
function _getExchangePricesAndRates(address vault_, 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 ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
configs_ | struct Structs.Configs | The configuration of the vault. |
liquiditySupplyRate_ | uint256 | The liquidity supply rate |
liquidityBorrowRate_ | uint256 | The liquidity borrow rate |
Return Values ​
Name | Type | Description |
---|---|---|
exchangePricesAndRates_ | struct Structs.ExchangePricesAndRates | The exchange prices and rates of the vault. |
_getTotalSupplyAndBorrow ​
function _getTotalSupplyAndBorrow(address vault_, struct Structs.ExchangePricesAndRates exchangePricesAndRates_, struct IFluidVaultT1.ConstantViews constantsVariables_) internal view returns (struct Structs.TotalSupplyAndBorrow totalSupplyAndBorrow_)
Get the total supply and borrow of a vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
exchangePricesAndRates_ | struct Structs.ExchangePricesAndRates | The exchange prices and rates of the vault. |
constantsVariables_ | struct IFluidVaultT1.ConstantViews | The constants and variables of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
totalSupplyAndBorrow_ | struct Structs.TotalSupplyAndBorrow | The total supply and borrow of the vault. |
_getLimitsAndAvailability ​
function _getLimitsAndAvailability(struct Structs.ExchangePricesAndRates exchangePricesAndRates_, struct IFluidVaultT1.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 ​
Name | Type | Description |
---|---|---|
exchangePricesAndRates_ | struct Structs.ExchangePricesAndRates | Exchange prices and rates for the vault. |
constantsVariables_ | struct IFluidVaultT1.ConstantViews | Constants and variables for the vault. |
withdrawalGapConfig_ | uint256 | Configuration for the withdrawal gap. |
borrowLimit_ | uint256 | The borrow limit for the user. Only set if not smart debt. |
borrowLimitUtilization_ | uint256 | The utilization of the borrow limit. Only set if not smart debt. |
borrowableUntilLimit_ | uint256 | The limit until which borrowing is allowed. Only set if not smart debt. |
Return Values ​
Name | Type | Description |
---|---|---|
limitsAndAvailability_ | struct Structs.LimitsAndAvailability | The calculated limits and availability for the user's vault operations. |
getVaultState ​
function getVaultState(address vault_) public view returns (struct Structs.VaultState vaultState_)
Retrieves the state of a given vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault to retrieve the state for. |
Return Values ​
Name | Type | Description |
---|---|---|
vaultState_ | struct Structs.VaultState | The state of the vault, including top tick, current and total branches, total supply and borrow, total positions, and current branch state. |
getVaultEntireData ​
function getVaultEntireData(address vault_) public view returns (struct Structs.VaultEntireData vaultData_)
Retrieves the entire data for a given vault.
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault to retrieve the data for. |
Return Values ​
Name | Type | Description |
---|---|---|
vaultData_ | struct Structs.VaultEntireData | The entire data of the vault. |
getVaultsEntireData ​
function getVaultsEntireData(address[] vaults_) external view returns (struct Structs.VaultEntireData[] vaultsData_)
Retrieves the entire data for a list of vaults.
Parameters ​
Name | Type | Description |
---|---|---|
vaults_ | address[] | The list of vault addresses. |
Return Values ​
Name | Type | Description |
---|---|---|
vaultsData_ | struct Structs.VaultEntireData[] | An array of VaultEntireData structures containing the data for each vault. |
getVaultsEntireData ​
function getVaultsEntireData() external view returns (struct Structs.VaultEntireData[] vaultsData_)
Retrieves the entire data for all vaults.
Return Values ​
Name | Type | Description |
---|---|---|
vaultsData_ | struct Structs.VaultEntireData[] | An array of VaultEntireData structures containing the data for each vault. |
positionByNftId ​
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 ​
Name | Type | Description |
---|---|---|
nftId_ | uint256 | The NFT ID for which to retrieve the position data. |
Return Values ​
Name | Type | Description |
---|---|---|
userPosition_ | struct Structs.UserPosition | The UserPosition structure containing the position data. |
vaultData_ | struct Structs.VaultEntireData | The VaultEntireData structure containing the vault data. |
positionsNftIdOfUser ​
function positionsNftIdOfUser(address user_) public view returns (uint256[] nftIds_)
Returns an array of NFT IDs for all positions of a given user.
Parameters ​
Name | Type | Description |
---|---|---|
user_ | address | The address of the user for whom to fetch positions. |
Return Values ​
Name | Type | Description |
---|---|---|
nftIds_ | uint256[] | An array of NFT IDs representing the user's positions. |
vaultByNftId ​
function vaultByNftId(uint256 nftId_) public view returns (address vault_)
Returns the vault address associated with a given NFT ID.
Parameters ​
Name | Type | Description |
---|---|---|
nftId_ | uint256 | The NFT ID for which to fetch the vault address. |
Return Values ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault associated with the NFT ID. |
positionsByUser ​
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 ​
Name | Type | Description |
---|---|---|
user_ | address | The address of the user for whom to fetch positions and vault data. |
Return Values ​
Name | Type | Description |
---|---|---|
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 ​
function totalPositions() external view returns (uint256)
Returns the total number of positions across all users.
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The total number of positions. |
getVaultLiquidation ​
function getVaultLiquidation(address vault_, uint256 tokenInAmt_) public returns (struct Structs.LiquidationStruct liquidationData_)
fetches available liquidations
Parameters ​
Name | Type | Description |
---|---|---|
vault_ | address | address of vault for which to fetch |
tokenInAmt_ | uint256 | token in aka debt to payback, leave 0 to get max |
Return Values ​
Name | Type | Description |
---|---|---|
liquidationData_ | struct Structs.LiquidationStruct | liquidation related data. Check out structs.sol |
_decodeLiquidationResult ​
function _decodeLiquidationResult(bytes lowLevelData_) internal pure returns (uint256 amtIn_, uint256 amtOut_)
helper method to decode liquidation result revert data
getMultipleVaultsLiquidation ​
function getMultipleVaultsLiquidation(address[] vaults_, uint256[] tokensInAmt_) external returns (struct Structs.LiquidationStruct[] liquidationsData_)
Retrieves liquidation data for multiple vaults.
Parameters ​
Name | Type | Description |
---|---|---|
vaults_ | address[] | The array of vault addresses. |
tokensInAmt_ | uint256[] | The array of token amounts to liquidate. |
Return Values ​
Name | Type | Description |
---|---|---|
liquidationsData_ | struct Structs.LiquidationStruct[] | An array of LiquidationStruct containing the liquidation data for each vault. |
getAllVaultsLiquidation ​
function getAllVaultsLiquidation() external returns (struct Structs.LiquidationStruct[] liquidationsData_)
Retrieves liquidation data for all vaults.
Return Values ​
Name | Type | Description |
---|---|---|
liquidationsData_ | struct Structs.LiquidationStruct[] | An array of LiquidationStruct containing the liquidation data for all vaults. |
getVaultAbsorb ​
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 ​
Name | Type | Description |
---|---|---|
vault_ | address | The address of the vault. |
Return Values ​
Name | Type | Description |
---|---|---|
absorbData_ | struct Structs.AbsorbStruct | The AbsorbStruct containing the absorb data for the vault. |
getVaultsAbsorb ​
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 ​
Name | Type | Description |
---|---|---|
vaults_ | address[] | The array of vault addresses. |
Return Values ​
Name | Type | Description |
---|---|---|
absorbData_ | struct Structs.AbsorbStruct[] | An array of AbsorbStruct containing the absorb data for each vault. |
getVaultsAbsorb ​
function getVaultsAbsorb() public returns (struct Structs.AbsorbStruct[] absorbData_)
DEPRECATED, only works for vaults v1.0.0: Retrieves absorb data for all vaults.
Return Values ​
Name | Type | Description |
---|---|---|
absorbData_ | struct Structs.AbsorbStruct[] | An array of AbsorbStruct containing the absorb data for all vaults. |