|
1 | 1 | # Pool Registry
|
2 | 2 |
|
3 | 3 | ## Introduction
|
4 |
| -The pool registry maintains the isolated lending pools in the directory and can perform actions like creating and registering new isolated lending pools to the directory, adding new markets to existing pools, setting and updating the pool’s required metadata, and providing the getters methods to get an inside view of the pools. |
| 4 | +The pool registry maintains the isolated lending pools directory and performs actions like creating and registering new lending pools, adding new markets to existing pools, setting and updating the pool metadata, and providing getter methods to retrieve pool information. |
5 | 5 |
|
6 | 6 | 
|
7 | 7 |
|
8 | 8 | ## Details
|
9 | 9 |
|
10 |
| -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 has some getter methods to get the details of any existing pool like `getVTokenForAsset`, `getPoolsSupportedByAsset`, `updatePoolMetadata` etc. |
| 10 | +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`). Users can bookmark pools using the `bookmarkPool` method and get a list of the all bookmarked pools through the `getBookmarks` method. |
11 | 11 |
|
12 |
| -Pool Registry provides a pool id to each pool mapped with the pool's comptroller address. There is a mapping where the metadata is mapped to the comptroller address so it can be retrieved easily. PoolRegistry also supports additional functionality like, users can bookmark pools using the `bookmarkPool` method and get a list of the all bookmarked pools through the `getBookmarks` method. PoolRegistry also maps assets to the supported list so it will be easier to get all the pools which have the same asset listed in their markets, through `getPoolsSupportedByAsset` method. |
| 12 | +Pool metadata includes risk rating, category, logo url, and description. It is set by calling `updatePoolMetadata` and retrieved through `getVenusPoolMetadata`. Risk rating is determined off chain through risk analysis by Venus with the intention of helping users navigate pools based on their risk tolerance. |
13 | 13 |
|
| 14 | +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. |
14 | 15 |
|
15 |
| -Venus provides the risk rating for each isolated pool. Through this rating users can select the appropriate pool to allocate their assets. Risk rating is decided off-chain and set on-chain for each pool which is saved as the metadata detail of the pool. |
| 16 | +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`. |
16 | 17 |
|
17 | 18 | ### Pools
|
18 | 19 |
|
19 |
| -Isolated pools gives the ability to create an independent market with specific assets and custom risk management configurations. Pool Registry helps to create a new Isolated pool in the directory through createRegistryPool method. It will take the required fields as parameters like deployed comptroller address, price oracle address, and etc, then create a proxy for the comptroller and set the msg.sender as the admin of the comptroller, provide an ID to the pool and update all the other states of the Pool Registry to add the pool to the directory. |
20 |
| - |
| 20 | +PoolRegistry registers new isolated pools in the directory with the `createRegistryPool` method. It creates a proxy for the comptroller, sets the `msg.sender` as the `admin` of the comptroller and configuration values for the `closeFactor`, `liquidationIncentive`, `minLiquidatableCollateral`, and `priceOracle`, before adding the pool to the directory. More details on Pools can be found under the [Pool](../isolated-lending/pool.md) page. |
21 | 21 |
|
22 | 22 | ### Markets
|
| 23 | +Isolated pools are composed of independent markets with specific assets and custom risk management configurations according to their markets. |
23 | 24 |
|
24 |
| -To add a new market to a lending pool, the PoolRegistry first deploys the JumpRate or WhitePaperInterestRate factory as an interest rate model to calculate the interest for the borrowers and lenders according to the available liquidity of the protocol. The upgradable vToken is then deployed to handle all the transactions within the market, finally comptroller(pool) accept the market as listed in the pool through `_supportMarket` method, and all the internal states of the Pool Registry get updated. |
25 |
| -You can read more about interest rate models under [Protocol Math](../guides/protocol-math.md) |
| 25 | +To add a new market to a lending pool, the PoolRegistry first deploys the JumpRate or WhitePaperInterestRate factory as an interest rate model to calculate the interest for the borrowers and lenders according to the available liquidity of the protocol. You can read more about interest rate models under [Protocol Math](../guides/protocol-math.md). The upgradable vToken is then deployed to handle all the transactions within the market and finally the market is listed in the pool through `_supportMarket` method. |
| 26 | + |
| 27 | +Markets are covered in more detail under [VTokens](core-pool/vtokens.md) |
26 | 28 |
|
27 | 29 |
|
28 | 30 | # Solidity API
|
@@ -90,6 +92,9 @@ function createRegistryPool(
|
90 | 92 |
|
91 | 93 | Deploys a new venus pool and adds to the directory, by taking all the required inputs
|
92 | 94 |
|
| 95 | +{% hint style="info" %} |
| 96 | +Can only be called by the _owner_. |
| 97 | +{% endhint %} |
93 | 98 |
|
94 | 99 |
|
95 | 100 | #### Parameters
|
@@ -127,7 +132,9 @@ function setPoolName(uint256 poolId, string calldata name)
|
127 | 132 |
|
128 | 133 | Modify existing Venus pool name.
|
129 | 134 |
|
130 |
| - |
| 135 | +{% hint style="info" %} |
| 136 | +Can be called by the _owner_ or _comptroller admin_. |
| 137 | +{% endhint %} |
131 | 138 |
|
132 | 139 | #### Parameters
|
133 | 140 |
|
@@ -270,6 +277,10 @@ function addMarket(
|
270 | 277 |
|
271 | 278 | Add a market to an existing venus pool.
|
272 | 279 |
|
| 280 | +{% hint style="info" %} |
| 281 | +Can only be called by the _owner_. |
| 282 | +{% endhint %} |
| 283 | + |
273 | 284 |
|
274 | 285 | #### Parameters
|
275 | 286 |
|
@@ -372,6 +383,10 @@ function updatePoolMetadata(uint256 poolId, VenusPoolMetaData memory _metadata)
|
372 | 383 |
|
373 | 384 | Update metadata of an existing pool
|
374 | 385 |
|
| 386 | +{% hint style="info" %} |
| 387 | +Can only be called by the _owner_. |
| 388 | +{% endhint %} |
| 389 | + |
375 | 390 |
|
376 | 391 | #### Parameters
|
377 | 392 |
|
|
0 commit comments