Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Polished the grammar and typos #48

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ Coming soon

The Market entity has properties named `p2pSupplyInterestsImprovement` & `p2pBorrowInterestsImprovement` that are the improvement of the interests of the users that are matched on the P2P market compared to their equivalent position on the underlying pool.

For example, if Alice has $100 matched at a 1% yield per yer (0.5% on the underlying pool), after one year, the yield earned is $1, and it was about $0.5 on the pool
For example, if Alice has $100 matched at a 1% yield per year (0.5% on the underlying pool), after one year, the yield earned is $1, and it was about $0.5 on the pool

## TODO
- [ ] Add the Comp rewards for morpho-compound, since the protocol is redistributing comp rewards to users on pool
- [ ] Add data about the p2p matching, such as number of matches, matched value etc.
- [ ] Add Protocol Revenues. Not a problem for now since reserve factor is setted to 0.
- [ ] Add Protocol Revenues. Not a problem for now since reserve factor is set to 0.

## Documentation

Expand Down
26 changes: 13 additions & 13 deletions docs/morpho-aave-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,44 @@

### Supply only vs collateral

On morpho aave v3, there are 2 types of supply positions: supply only or supply as collateral.
On morpho Aave v3, there are 2 types of supply positions: supply only or supply as collateral.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On morpho Aave v3, there are 2 types of supply positions: supply only or supply as collateral.
On Morpho-AaveV3, there are 2 types of supply positions: supply only or supply as collateral.


A supply as collateral cannot be matched p2p with a borrower, but it permits to borrow against it.
A supply as collateral cannot be matched P2P with a borrower, but it permits to borrow against it.

In order to keep the previous subgraph working, we need to add a new parameter to the `supply` and `withdraw` function: `isCollateral`.

A supply only has the same behavior as a supply on morpho aave v2 or morpho compound: you have 2 scaled balances: `onPool` & `inP2P`
A supply only has the same behavior as a supply on morpho Aave v2 or morpho compound: you have 2 scaled balances: `onPool` & `inP2P`

A collateral supply is setting inP2P to 0 since you cannot be matched p2p.
A collateral supply sets inP2P to 0 since you cannot be matched P2P.

### Market fields

The market is defining new fields:
- `totalCollateralOnPool` is the total underlying on the pool representing collateral, updated as the same time as the `totalSupplyOnPool`.
- `totalCollateralOnPool` is the total underlying on the pool that represents collateral, updated as the same time as the `totalSupplyOnPool`.
- `_scaledPoolCollateral`, is the scaled amount of collateral on the pool.
-
- `_scaledSupplyOnPool` is representing the supply only on the underlying pool, waiting to be matched.
- `_scaledSupplyInP2P` is representing the supply only matched p2p.
- `_scaledSupplyInP2P` is representing the supply only matched P2P.

The scaled balance of the protocol is now represented by `_scaledSupplyOnPool` plus `_scaledSupplyInP2P` **and** `_scaledPoolCollateral`.


`totalSupplyOnPool` is the supply only on the underlying pool.

The `totalDepositBalanceUSD` is the total supply on pool, the total supply matched p2p, and the total collateral.
The `totalDepositBalanceUSD` is the total supply on pool, the total supply matched P2P, and the total collateral.

The idleSupply is a new field, representing the supply amount that is not generating yields due to a supply cap on aave v3.
The idleSupply is a new field, representing the supply amount that is not generating yields due to a supply cap on Aave v3.


For morpho aave v3 markets, the supply cap is not null.
For morpho Aave v3 markets, the supply cap is not null.

### General metrics

In order to compute the total on pool, in p2p or collateral, we are aggregating all the user scaled balances,
In order to compute the total on pool, in P2P or collateral, we are aggregating all the user scaled balances,
by splitting the collateral and the supply only. These metrics are really important since they cannot be retrieved on chain.

On morpho aave v2 or morpho compound, the supply on pool is the aToken balance of the protocol.
On morpho aave v3, the aToken balance is the supply only on pool **and** the collateral.
On morpho Aave v2 or morpho compound, the supply on pool is the aToken balance of the protocol.
On morpho Aave v3, the aToken balance is the supply only on pool **and** the collateral.

We can also implement new metrics to have more data of the history between collateral and supply only.
All the classic metrics are still available (`market.totalSupplyOnPool`), aggregating collateral and supply on pool for metrics related to the protocol balance on pool.
All the classic metrics are still available (`market.totalSupplyOnPool`), aggregating collateral and supply on pool for metrics related to the protocol balance on pool.