Skip to content

Commit c8eb29c

Browse files
authored
Merge pull request #18 from VenusProtocol/edit-pool-registry-documentation
Edit pool registry documentation
2 parents 799de48 + 8cfb5ea commit c8eb29c

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

isolated-lending/pool-registry.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
# Pool Registry
22

33
## 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.
55

66
![Isolated Pools Diagram](../.gitbook/assets/isolated-pools.png)
77

88
## Details
99

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.
1111

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.
1313

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.
1415

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`.
1617

1718
### Pools
1819

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.
2121

2222
### Markets
23+
Isolated pools are composed of independent markets with specific assets and custom risk management configurations according to their markets.
2324

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)
2628

2729

2830
# Solidity API
@@ -90,6 +92,9 @@ function createRegistryPool(
9092

9193
Deploys a new venus pool and adds to the directory, by taking all the required inputs
9294

95+
{% hint style="info" %}
96+
Can only be called by the _owner_.
97+
{% endhint %}
9398

9499

95100
#### Parameters
@@ -127,7 +132,9 @@ function setPoolName(uint256 poolId, string calldata name)
127132

128133
Modify existing Venus pool name.
129134

130-
135+
{% hint style="info" %}
136+
Can be called by the _owner_ or _comptroller admin_.
137+
{% endhint %}
131138

132139
#### Parameters
133140

@@ -270,6 +277,10 @@ function addMarket(
270277

271278
Add a market to an existing venus pool.
272279

280+
{% hint style="info" %}
281+
Can only be called by the _owner_.
282+
{% endhint %}
283+
273284

274285
#### Parameters
275286

@@ -372,6 +383,10 @@ function updatePoolMetadata(uint256 poolId, VenusPoolMetaData memory _metadata)
372383

373384
Update metadata of an existing pool
374385

386+
{% hint style="info" %}
387+
Can only be called by the _owner_.
388+
{% endhint %}
389+
375390

376391
#### Parameters
377392

0 commit comments

Comments
 (0)