Skip to content

Latest commit

 

History

History
364 lines (259 loc) · 7.6 KB

File metadata and controls

364 lines (259 loc) · 7.6 KB

Solidity API

LendingPoolLens

Provides utility functions to view the state of LendingPools

PoolStats

struct PoolStats {
  address pool;
  address asset;
  uint8 decimals;
  string characterization;
  uint256 supplied;
  uint256 suppliedValue;
  uint256 borrowed;
  uint256 borrowedValue;
  uint256 baseSupplyAPY;
  uint256 maxSupplyAPY;
  uint256 baseBorrowAPY;
  uint256 maxBorrowAPY;
  uint256 dailyRewards;
  uint256 rewardsAPY;
  uint256 utilization;
  uint256 totalReserveShares;
  uint256 tvl;
  address[] collaterals;
}

AggregateStats

struct AggregateStats {
  uint256 totalSuppliedValue;
  uint256 totalBorrowedValue;
  uint256 totalAvailableValue;
  uint256 totalFeesPaid;
  uint256 numberOfVaults;
  uint256 tvl;
}

PoolCollateralInfo

struct PoolCollateralInfo {
  address collateral;
  uint8 decimals;
  uint256 amountDeposited;
  uint256 value;
  uint256 ltv;
  uint256 lltv;
  uint256 liqPenalty;
  uint256 liqBonus;
}

LendingPoolInfo

struct LendingPoolInfo {
  uint256 assetOraclePrice;
  uint256 interestFeePercentage;
  uint256 liquidationThreshold;
  uint256 liquidationPenalty;
}

AccountCollateralDeposited

struct AccountCollateralDeposited {
  address token;
  uint8 decimals;
  uint256 amount;
  uint256 value;
}

AccountInfo

struct AccountInfo {
  uint256 walletAssetBalance;
  uint256 supplied;
  uint256 borrowed;
  uint8 decimals;
  uint256 healthFactor;
  uint256 totalCollateralValue;
  struct LendingPoolLens.AccountCollateralDeposited[] collateralDeposited;
}

MarketInfo

struct MarketInfo {
  int256 oraclePrice;
  uint256 oraclePriceDecimals;
  uint256 interestFee;
  uint256 supplyCap;
  uint256 liquidity;
  uint256 utilization;
  uint256 liquidationThreshold;
  uint256 liquidationPenalty;
}

PoolRegistered

event PoolRegistered(address pool, address caller)

PoolUnregistered

event PoolUnregistered(address pool, address caller)

NotRegistered

error NotRegistered(address pool)

Revert is unregistering pool that is not registered.

ZeroAddress

error ZeroAddress()

Reverts if zero addrss provided

registry

contract IAddressRegistry registry

constructor

constructor(address _registry) public

registeredPools

function registeredPools() external view returns (address[])

Returns a list of all the registered pools

Return Values

Name Type Description
[0] address[] pools The addresses of all registered pools

activePools

function activePools() external view returns (address[])

Returns a list of all the active pools

Return Values

Name Type Description
[0] address[] pools The addresses of all active pools

getAggregateStats

function getAggregateStats(bool onlyActive) external view returns (struct LendingPoolLens.AggregateStats)

Returns the combined stats for all pools monitored by lens.

Return Values

Name Type Description
[0] struct LendingPoolLens.AggregateStats aggregateStats The aggregated stats of the all registred pools

getPoolStatsList

function getPoolStatsList(address[] pools) external view returns (struct LendingPoolLens.PoolStats[])

Returns various metrics of specified pools.

Returns an array of PoolStats objects. Reverts with NotRegistered(pool) error if a pool in the list is not registered.

Parameters

Name Type Description
pools address[] The list of pools to return stats for.

Return Values

Name Type Description
[0] struct LendingPoolLens.PoolStats[] poolStats An array of PoolStats objects, containing the stats for specified pools.

getPoolStats

function getPoolStats(address poolAddress) public view returns (struct LendingPoolLens.PoolStats)

Regturns the metrics of a specified pool.

Reverts with `NotRegistered(address) error if the pool address is not registered.

Parameters

Name Type Description
poolAddress address The address of the pool to return stats for

Return Values

Name Type Description
[0] struct LendingPoolLens.PoolStats poolStats The PoolStats object containing the stats for specified pool.

getPoolAccountInfo

function getPoolAccountInfo(address poolAddress, address account) external view returns (struct LendingPoolLens.AccountInfo)

Returns information about a given account in a specified pool.

Parameters

Name Type Description
poolAddress address The pool to return account info for.
account address The account to return info about.

Return Values

Name Type Description
[0] struct LendingPoolLens.AccountInfo info An AccountInfo obect about account position in the pool.

getAccountFreeCollateralInPool

function getAccountFreeCollateralInPool(address poolAddress, address account, address token) external view returns (uint256)

Returns the free collateral in pool

Parameters

Name Type Description
poolAddress address address of pool
account address The account to check for.
token address The collateral token to check.

Return Values

Name Type Description
[0] uint256 The amount of specified collateral token that is free for withdrawal.

getPoolCollateral

function getPoolCollateral(address poolAddress) external view returns (struct LendingPoolLens.PoolCollateralInfo[])

Returns information about colalteral in the pool

Parameters

Name Type Description
poolAddress address The pool to return collateral info for.

Return Values

Name Type Description
[0] struct LendingPoolLens.PoolCollateralInfo[] info The PoolCollateralInfo about collateral in the specified pool.

getMarketInfo

function getMarketInfo(address poolAddress) external view returns (struct LendingPoolLens.MarketInfo)

Returns market information about the pool

Parameters

Name Type Description
poolAddress address The pool to return market info for.

Return Values

Name Type Description
[0] struct LendingPoolLens.MarketInfo info The MarketInfo about collateral in the specified pool.

poolDailyRewards

function poolDailyRewards(address) public pure returns (uint256)

Returns the amount of token emissions a given pool receives daily. //

Return Values

Name Type Description
[0] uint256 rewards pool receives in a day.

poolRewardRate

function poolRewardRate(address) public pure returns (uint256)

Returns the reward rate (APY) a pool receives. //

Return Values

Name Type Description
[0] uint256 The reward rate a pool receives.

getPrice

function getPrice(address pool, address asset) public view returns (int256)

version

function version() external pure returns (uint16)

returns the version of the lens