Skip to content

VenusLens

The read only functions on the VenusLens contract provide a view into: - metadata of vToken - daily XVS rewards for an account - account balance for a single vToken - account balances for all vTokens in an account - underlying price of a vToken - underlying prices for a set of vTokens - get liquidity and shortfall of an account - get user’s vote history - get proposal details for a set of proposals - get account XVS balance, total votes, and delegated votes - get historical voting balance for a user - get pending XVS Rewards for an account

Blocks Per Day

uint256 BLOCKS_PER_DAY

Total actions available on VToken

uint256 VTOKEN_ACTIONS

struct VenusMarketState {
uint224 index;
uint32 block;
}
struct VTokenMetadata {
address vToken;
uint256 exchangeRateCurrent;
uint256 supplyRatePerBlock;
uint256 borrowRatePerBlock;
uint256 reserveFactorMantissa;
uint256 totalBorrows;
uint256 totalReserves;
uint256 totalSupply;
uint256 totalCash;
bool isListed;
uint256 collateralFactorMantissa;
address underlyingAssetAddress;
uint256 vTokenDecimals;
uint256 underlyingDecimals;
uint256 venusSupplySpeed;
uint256 venusBorrowSpeed;
uint256 dailySupplyXvs;
uint256 dailyBorrowXvs;
uint256 pausedActions;
}
struct VTokenBalances {
address vToken;
uint256 balanceOf;
uint256 borrowBalanceCurrent;
uint256 balanceOfUnderlying;
uint256 tokenBalance;
uint256 tokenAllowance;
}
struct VTokenUnderlyingPrice {
address vToken;
uint256 underlyingPrice;
}
struct AccountLimits {
contract VToken[] markets;
uint256 liquidity;
uint256 shortfall;
}
struct XVSBalanceMetadata {
uint256 balance;
uint256 votes;
address delegate;
}
struct XVSBalanceMetadataExt {
uint256 balance;
uint256 votes;
address delegate;
uint256 allocated;
}
struct VenusVotes {
uint256 blockNumber;
uint256 votes;
}
struct ClaimVenusLocalVariables {
uint256 totalRewards;
uint224 borrowIndex;
uint32 borrowBlock;
uint224 supplyIndex;
uint32 supplyBlock;
}
struct PendingReward {
address vTokenAddress;
uint256 amount;
}
struct RewardSummary {
address distributorAddress;
address rewardTokenAddress;
uint256 totalRewards;
struct VenusLens.PendingReward[] pendingRewards;
}

Holds full market information for a single vToken within a specific pool (excluding the Core Pool)


struct MarketData {
uint96 poolId;
string poolLabel;
address vToken;
bool isListed;
uint256 collateralFactor;
bool isVenus;
uint256 liquidationThreshold;
uint256 liquidationIncentive;
bool isBorrowAllowed;
}

Struct representing a pool (excluding the Core Pool) and its associated markets


struct PoolWithMarkets {
uint96 poolId;
string label;
struct VenusLens.MarketData[] markets;
}

Query the metadata of a vToken by its address

function vTokenMetadata(contract VToken vToken) public returns (struct VenusLens.VTokenMetadata)
NameTypeDescription
vTokencontract VTokenThe address of the vToken to fetch VTokenMetadata
NameTypeDescription
[0]struct VenusLens.VTokenMetadataVTokenMetadata struct with vToken supply and borrow information.

Get VTokenMetadata for an array of vToken addresses

function vTokenMetadataAll(contract VToken[] vTokens) external returns (struct VenusLens.VTokenMetadata[])
NameTypeDescription
vTokenscontract VToken[]Array of vToken addresses to fetch VTokenMetadata
NameTypeDescription
[0]struct VenusLens.VTokenMetadata[]Array of structs with vToken supply and borrow information.

Get amount of XVS distributed daily to an account

function getDailyXVS(address payable account, address comptrollerAddress) external returns (uint256)
NameTypeDescription
accountaddress payableAddress of account to fetch the daily XVS distribution
comptrollerAddressaddressAddress of the comptroller proxy
NameTypeDescription
[0]uint256Amount of XVS distributed daily to an account

Get the current vToken balance (outstanding borrows) for an account

function vTokenBalances(contract VToken vToken, address payable account) public returns (struct VenusLens.VTokenBalances)
NameTypeDescription
vTokencontract VTokenAddress of the token to check the balance of
accountaddress payableAccount address to fetch the balance of
NameTypeDescription
[0]struct VenusLens.VTokenBalancesVTokenBalances with token balance information

Get the current vToken balances (outstanding borrows) for all vTokens on an account

function vTokenBalancesAll(contract VToken[] vTokens, address payable account) external returns (struct VenusLens.VTokenBalances[])
NameTypeDescription
vTokenscontract VToken[]Addresses of the tokens to check the balance of
accountaddress payableAccount address to fetch the balance of
NameTypeDescription
[0]struct VenusLens.VTokenBalances[]VTokenBalances Array with token balance information

Get the price for the underlying asset of a vToken

function vTokenUnderlyingPrice(contract VToken vToken) public view returns (struct VenusLens.VTokenUnderlyingPrice)
NameTypeDescription
vTokencontract VTokenaddress of the vToken
NameTypeDescription
[0]struct VenusLens.VTokenUnderlyingPriceresponse struct with underlyingPrice info of vToken

Query the underlyingPrice of an array of vTokens

function vTokenUnderlyingPriceAll(contract VToken[] vTokens) external view returns (struct VenusLens.VTokenUnderlyingPrice[])
NameTypeDescription
vTokenscontract VToken[]Array of vToken addresses
NameTypeDescription
[0]struct VenusLens.VTokenUnderlyingPrice[]array of response structs with underlying price information of vTokens

Query the account liquidity and shortfall of an account

function getAccountLimits(contract ComptrollerInterface comptroller, address account) public view returns (struct VenusLens.AccountLimits)
NameTypeDescription
comptrollercontract ComptrollerInterfaceAddress of comptroller proxy
accountaddressAddress of the account to query
NameTypeDescription
[0]struct VenusLens.AccountLimitsStruct with markets user has entered, liquidity, and shortfall of the account

Query the XVSBalance info of an account

function getXVSBalanceMetadata(contract IXVS xvs, address account) external view returns (struct VenusLens.XVSBalanceMetadata)
NameTypeDescription
xvscontract IXVSXVS contract address
accountaddressAccount address
NameTypeDescription
[0]struct VenusLens.XVSBalanceMetadataStruct with XVS balance and voter details

Query the XVSBalance extended info of an account

function getXVSBalanceMetadataExt(contract IXVS xvs, contract ComptrollerInterface comptroller, address account) external returns (struct VenusLens.XVSBalanceMetadataExt)
NameTypeDescription
xvscontract IXVSXVS contract address
comptrollercontract ComptrollerInterfaceComptroller proxy contract address
accountaddressAccount address
NameTypeDescription
[0]struct VenusLens.XVSBalanceMetadataExtStruct with XVS balance and voter details and XVS allocation

Query the voting power for an account at a specific list of block numbers

function getVenusVotes(contract IXVS xvs, address account, uint32[] blockNumbers) external view returns (struct VenusLens.VenusVotes[])
NameTypeDescription
xvscontract IXVSXVS contract address
accountaddressAddress of the account
blockNumbersuint32[]Array of blocks to query
NameTypeDescription
[0]struct VenusLens.VenusVotes[]Array of VenusVotes structs with block number and vote count

Calculate the total XVS tokens pending and accrued by a user account

function pendingRewards(address holder, contract ComptrollerInterface comptroller) external view returns (struct VenusLens.RewardSummary)
NameTypeDescription
holderaddressAccount to query pending XVS
comptrollercontract ComptrollerInterfaceAddress of the comptroller
NameTypeDescription
[0]struct VenusLens.RewardSummaryReward object contraining the totalRewards and pending rewards for each market

Returns all pools (excluding the Core Pool) along with their associated market data

function getAllPoolsData(contract ComptrollerInterface comptroller) external view returns (struct VenusLens.PoolWithMarkets[] poolsData)
NameTypeDescription
comptrollercontract ComptrollerInterfaceThe Comptroller contract to query
NameTypeDescription
poolsDatastruct VenusLens.PoolWithMarkets[]An array of PoolWithMarkets structs, each containing pool info and its markets

Retrieves full market data for all vTokens in a specific pool (excluding the Core Pool)

function getMarketsDataByPool(uint96 poolId, contract ComptrollerInterface comptroller) public view returns (struct VenusLens.MarketData[] result)
NameTypeDescription
poolIduint96The pool ID to fetch data for
comptrollercontract ComptrollerInterfaceThe address of the Comptroller contract
NameTypeDescription
resultstruct VenusLens.MarketData[]An array of MarketData structs containing detailed market info for the given pool
  • PoolDoesNotExist Reverts if the given pool ID does not exist
  • InvalidOperationForCorePool Reverts if called on the Core Pool (poolId = 0)