PoolRegistry

PoolRegistry

The Isolated Pools architecture centers around the PoolRegistry contract. The PoolRegistry maintains a directory of isolated lending pools and can perform actions like creating and registering new pools, adding new markets to existing pools, setting and updating the pool's required metadata, and providing the getter methods to get information on the pools.

Isolated lending has three main components: PoolRegistry, pools, and markets. The PoolRegistry is responsible for managing pools. It can create new pools, update pool metadata and manage markets within pools. PoolRegistry contains getter methods to get the details of any existing pool like getVTokenForAsset and getPoolsSupportedByAsset. It also contains methods for updating pool metadata (updatePoolMetadata) and setting pool name (setPoolName).

The directory of pools is managed through two mappings: _poolByComptroller which is a hashmap with the comptroller address as the key and VenusPool as the value and _poolsByID which is an array of comptroller addresses. Individual pools can be accessed by calling getPoolByComptroller with the pool's comptroller address. _poolsByID is used to iterate through all of the pools.

PoolRegistry also contains a map of asset addresses called _supportedPools that maps to an array of assets suppored by each pool. This array of pools by asset is retrieved by calling getPoolsSupportedByAsset.

PoolRegistry registers new isolated pools in the directory with the createRegistryPool method. Isolated pools are composed of independent markets with specific assets and custom risk management configurations according to their markets.

Solidity API

struct AddMarketInput {
  contract VToken vToken;
  uint256 collateralFactor;
  uint256 liquidationThreshold;
  uint256 initialSupply;
  address vTokenReceiver;
  uint256 supplyCap;
  uint256 borrowCap;
}

metadata

Maps pool's comptroller address to metadata.

mapping(address => struct PoolRegistryInterface.VenusPoolMetaData) metadata

initialize

Initializes the deployer to owner

function initialize(address accessControlManager_) external

Parameters


addPool

Adds a new Venus pool to the directory

function addPool(string name, contract Comptroller comptroller, uint256 closeFactor, uint256 liquidationIncentive, uint256 minLiquidatableCollateral) external virtual returns (uint256 index)

Parameters

Return Values

❌ Errors

  • ZeroAddressNotAllowed is thrown when Comptroller address is zero

  • ZeroAddressNotAllowed is thrown when price oracle address is zero


addMarket

Add a market to an existing pool and then mint to provide initial supply

function addMarket(struct PoolRegistry.AddMarketInput input) external

Parameters

❌ Errors

  • ZeroAddressNotAllowed is thrown when vToken address is zero

  • ZeroAddressNotAllowed is thrown when vTokenReceiver address is zero


setPoolName

Modify existing Venus pool name

function setPoolName(address comptroller, string name) external

Parameters


updatePoolMetadata

Update metadata of an existing pool

function updatePoolMetadata(address comptroller, struct PoolRegistryInterface.VenusPoolMetaData metadata_) external

Parameters


getAllPools

Returns arrays of all Venus pools' data

function getAllPools() external view returns (struct PoolRegistryInterface.VenusPool[])

Return Values


getVTokenForAsset

Get the address of the VToken contract in the Pool where the underlying token is the provided asset

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

getPoolsSupportedByAsset

Get the addresss of the Pools supported that include a market for the provided asset

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

Last updated