PoolLens

PoolLens

The PoolLens contract is designed to retrieve important information for each registered pool. A list of essential information for all pools within the lending protocol can be acquired through the function getAllPools(). Additionally, the following records can be looked up for specific pools and markets:

  • the vToken balance of a given user;

  • the pool data (oracle address, associated vToken, liquidation incentive, etc) of a pool via its associated comptroller address;

  • the vToken address in a pool for a given asset;

  • a list of all pools that support an asset;

  • the underlying asset price of a vToken;

  • the metadata (exchange/borrow/supply rate, total supply, collateral factor, etc) of any vToken.

Solidity API

struct PoolData {
  string name;
  address creator;
  address comptroller;
  uint256 blockPosted;
  uint256 timestampPosted;
  string category;
  string logoURL;
  string description;
  address priceOracle;
  uint256 closeFactor;
  uint256 liquidationIncentive;
  uint256 minLiquidatableCollateral;
  struct PoolLens.VTokenMetadata[] vTokens;
}
struct VTokenMetadata {
  address vToken;
  uint256 exchangeRateCurrent;
  uint256 supplyRatePerBlock;
  uint256 borrowRatePerBlock;
  uint256 reserveFactorMantissa;
  uint256 supplyCaps;
  uint256 borrowCaps;
  uint256 totalBorrows;
  uint256 totalReserves;
  uint256 totalSupply;
  uint256 totalCash;
  bool isListed;
  uint256 collateralFactorMantissa;
  address underlyingAssetAddress;
  uint256 vTokenDecimals;
  uint256 underlyingDecimals;
}
struct VTokenBalances {
  address vToken;
  uint256 balanceOf;
  uint256 borrowBalanceCurrent;
  uint256 balanceOfUnderlying;
  uint256 tokenBalance;
  uint256 tokenAllowance;
}
struct VTokenUnderlyingPrice {
  address vToken;
  uint256 underlyingPrice;
}
struct PendingReward {
  address vTokenAddress;
  uint256 amount;
}
struct RewardSummary {
  address distributorAddress;
  address rewardTokenAddress;
  uint256 totalRewards;
  struct PoolLens.PendingReward[] pendingRewards;
}
struct RewardTokenState {
  uint224 index;
  uint32 block;
  uint32 lastRewardingBlock;
}
struct BadDebt {
  address vTokenAddress;
  uint256 badDebtUsd;
}
struct BadDebtSummary {
  address comptroller;
  uint256 totalBadDebtUsd;
  struct PoolLens.BadDebt[] badDebts;
}

vTokenBalancesAll

Queries the user's supply/borrow balances in vTokens

function vTokenBalancesAll(contract VToken[] vTokens, address account) external returns (struct PoolLens.VTokenBalances[])

Parameters

Return Values


getAllPools

Queries all pools with addtional details for each of them

function getAllPools(address poolRegistryAddress) external view returns (struct PoolLens.PoolData[])

Parameters

Return Values


getPoolByComptroller

Queries the details of a pool identified by Comptroller address

function getPoolByComptroller(address poolRegistryAddress, address comptroller) external view returns (struct PoolLens.PoolData)

Parameters

Return Values


getVTokenForAsset

Returns vToken holding the specified underlying asset in the specified pool

function getVTokenForAsset(address poolRegistryAddress, address comptroller, address asset) external view returns (address)

Parameters

Return Values


getPoolsSupportedByAsset

Returns all pools that support the specified underlying asset

function getPoolsSupportedByAsset(address poolRegistryAddress, address asset) external view returns (address[])

Parameters

Return Values


vTokenUnderlyingPriceAll

Returns the price data for the underlying assets of the specified vTokens

function vTokenUnderlyingPriceAll(contract VToken[] vTokens) external view returns (struct PoolLens.VTokenUnderlyingPrice[])

Parameters

Return Values


getPendingRewards

Returns the pending rewards for a user for a given pool.

function getPendingRewards(address account, address comptrollerAddress) external view returns (struct PoolLens.RewardSummary[])

Parameters

Return Values


getPoolBadDebt

Returns a summary of a pool's bad debt broken down by market

function getPoolBadDebt(address comptrollerAddress) external view returns (struct PoolLens.BadDebtSummary)

Parameters

Return Values


vTokenBalances

Queries the user's supply/borrow balances in the specified vToken

function vTokenBalances(contract VToken vToken, address account) public returns (struct PoolLens.VTokenBalances)

Parameters

Return Values


getPoolDataFromVenusPool

Queries additional information for the pool

function getPoolDataFromVenusPool(address poolRegistryAddress, struct PoolRegistryInterface.VenusPool venusPool) public view returns (struct PoolLens.PoolData)

Parameters

Return Values


vTokenMetadata

Returns the metadata of VToken

function vTokenMetadata(contract VToken vToken) public view returns (struct PoolLens.VTokenMetadata)

Parameters

Return Values


vTokenMetadataAll

Returns the metadata of all VTokens

function vTokenMetadataAll(contract VToken[] vTokens) public view returns (struct PoolLens.VTokenMetadata[])

Parameters

Return Values


vTokenUnderlyingPrice

Returns the price data for the underlying asset of the specified vToken

function vTokenUnderlyingPrice(contract VToken vToken) public view returns (struct PoolLens.VTokenUnderlyingPrice)

Parameters

Return Values


Last updated