Cj_Blockchain

Posted on Dec 06, 2022Read on Mirror.xyz

Morpho-A semi DeFi P2P lending protocol

Morpho use a semi P2P lending pool to improve DeFi lending rate on Compound and Aave. By using a semi P2P lending pool, both lenders and borrowers can enjoy a favorable interest rate in the system. Morpho have potential to be a more popular defi lending aggregator in the future, which not only provide information about different platform lending rate, but also optimize the rate by maximize the capital utilizaiton rate.

1 Why build a semi-P2P lending pool

There is a huge interest rate gap between the Supply side and the Borrow side on AAVE and Compound, while the reserve factor is just 10%. The reason for the huge interest rate difference comes from the mismatch between the scale of the borrower and the lender. Supply is much larger than borrow, and the interest generated by borrower is evenly distributed to all supplies. The purpose of introducing a semi-P2P lending pool is to solve this mismatch of assets and match the borrowers and lenders. When no P2P pairing is formed, the funds will be deposited in the ordinary lending pool to enjoy pooled benefits. When the new lender and borrower was matched in the P2P pool, the funds withdrawn from Compound or AAVE, so that the deposit rate of the supply side increases, and the loan rate of the borrower side decreases. Both parties can obtain the optimal solution.

2 How to achieve

(1) Overview

First of all, there will be a P2P lending pool built on top of the ordinary lending pool such as Compound or AAVE. When users deposit funds in the P2P pool, the funds will be deposited into the ordinary lending pool through the P2P pool and enjoy the benefits in the ordinary lending pool (meaning that when the P2P lending is not matched successfully, the user can enjoy the loan income of the ordinary lending pool) When a Borrower enters the P2P pool, the funds deposited by the lender into the ordinary lending pool through the P2P pool will be withdrawn and paired with the Borrower. At this time, since the capital utilization rate of both parties is 100%, the supply side and the borrow side can enjoy a more favorable interest rate (supply rate is higher, borrow rate is lower)

(2) Specific implementation methods

1)Interest rate setting P2P Interest Rate Formula

Where a is a set constant in the range of [0,1]

2)P2P matching order

When Supply>Borrow in the P2P pool, for each newly entered borrower, its borrowing needs will be prioritized with the supplier with the largest share, and when the funds of the supplier with the largest share are matched, the second largest supplier will be matched, and so on.

When Borrow<Supply in the P2P pool (at this time, only part of borrowers can realize P2P lending, and the rest of the demand is met by the ordinary lending pool), for each newly entered supplier, its supply demand will be given priority to the current unsatisfied largest share Borrower. When the largest borrower funds are matched, match the second largest borrower funds, and so on.

3)Matching process

(1) supply process

The funds deposited by the user in the P2P pool will be deposited into the ordinary lending pool to enjoy the pooling earnings. At the same time, the P2P pool will obtain f token after depositing funds in the lending pool, and the f token will be held by the p2p pool.

(2) Borrow process

Borrower B enters the p2p lending pool and plans to lend 800 USDT. At this time, the P2P pool matches it with A. Burns A's 800fUSDT and takes out 800 USDT from the lending pool, and then lends the 800 USDT to B. (Note that B’s loan still requires collateral, and the mortgage process is consistent with the Supply process, so it is not shown in the figure)

(3) Exit process

Scenario 1: Supplier withdraws, when P2P-Supply pool is sufficient

When Supplier A finishes pairing with borrow B, if A wants to quit. At this time, find the current largest supplier C from the P2P pool, destroy the f token of Supplier C, withdraw the redeemed money and A's original money in the lending pool and return it to Supplier A. At this point, B's debt to A is transferred to B's debt to C. A completes the exit. Below is the balance sheet of each participant before and after the exit

Before Supplier A exits

After Supplier A exits

Scenario 2 :Supplier withdraws, when P2P-Supply pool has no other suppliers

It needs to be emphasized here that when Borrow B borrows through P2P, it still needs to over-collateralize the collateral, and its collateral is mortgaged in the ordinary lending pool. The money redeemed in the lending pool, so its debt occurs at the level of the P2P pool, and at the level of the ordinary lending pool, its debt is 0.

When Supplier A wants to withdraw, and there is only A in the P2P pool, use B's collateral in the ordinary lending pool to lend the amount owed by B in the P2P pool and return it to Supplier A. At this moment, Supplier A has completed the exit, while B is equivalent to completing a loan in the ordinary lending pool and exiting the P2P lending.

(5) Token incentives It should be noted that when the borrower and the lender complete the loan at the P2P layer , there is no lending exposure at the lending pool level, so they cannot obtain token distribution incentives. Therefore, for both borrowers and lenders, when token distribution incentives are greater than interest rate discounts, P2P lending will not be used for matching.

End

Now, morpho only have two semi P2P lending pool, AAVE and compound. it improves the capital efficiency of positions on lending pools by seamlessly matching lenders and borrowers peer-to-peer. In the future, Morpho may integrate more and more portocal and have potential to become a lending aggregate like what Gem do in the NFT trading industry.


                          

Morpho是如何通过半借贷池来提高资金使用率的

Morpho是一个嵌套在Compound和AAVE上,利用半P2P借贷池来提高资金使用率从而使借贷双方都能获利的一个DEFI借贷平台,下面简单阐述一下Morpho是如何做到让借贷双方都能享受到最优解的。

一、为什么要做半P2P借贷池

当前的池化借贷中,Supply方和Borrow方是存在利差的,在reserve factor大多为10%的情况下,巨大利差的原因来自于借贷双方规模并不匹配。supply远大于borrow,borrower产生的利息被平均分摊到了所有的supply上。

而传统的P2P借贷,虽然解决了资金匹配的问题,但如果在市场上不活跃的时候,很容易出现资金空置的问题,资金出借方难以获得收益。

引入半P2P借贷池的目的就是为了解决这种资产的错配,将借贷双方匹配起来,当没有形成P2P配对时,资金存入普通借贷池中享受池化收益,当形成配对后将普通池中的资金取出在P2P池中配对,让supply方的存款利率上升,让borrow方的贷款利率下降,从而让双方都获得最优解

二、如何实现

(一)概览

首先会有一个P2P的借贷池搭建在普通的借贷池之上,当用户在P2P池中存入资金时,资金会通过P2P池被存入普通借贷池,享受普通借贷池中的收益(意味着当用户P2P借贷没有匹配成功时,用户可以享受普通借贷池的借贷收益) 当有Borrow方进入P2P池时,用户通过P2P池存入普通借贷池的资金会被提取出来与Borrow方配对。此时由于双方资金利用率为100%,supply方与borrow方可以享受更优惠的利率(supply更高,borrow更低)

(二)具体实现方式

1、利率设定

P2P利率公式

其中,a是设定的一个范围【0,1】的常数

2、P2P匹配顺序

当P2P池中Supply>Borrow时,针对每一个新进入的borrower,其借款需求会优先与份额最大的supply方,当份额最大的supply方资金被匹配完后,匹配第二大的,依次类推。 当P2P池中Borrow<Supply时(此时只有部分Borrower能够实现P2P借贷,其余需求被普通借贷池满足),针对每一个新进入的supplyer,其supply需求会优先与当前未被满足的份额最大的Borrower匹配,当最大的borrower资金被匹配完成后,匹配第二大的,依次类推。

3、匹配流程

(1)supply流程

用户存入P2P pool的资金会被存入普通lending pool享受池化收益,同时P2P pool在lending pool中存入资金后会获取ftoken, ftoken会被p2p Pool持有。

(2)Borrow流程

Borrower B 进入p2p借贷池,计划借出800USDT,此时P2P池将其与A配对,将A的800fUSDT销毁并从借贷池中取出800USDT,将这800USDT借给B。(注意B的借贷仍然需要抵押物,抵押流程与Supply流程一致,故未在图中画出)

(3)退出流程

情况一:Supplier退出,P2P-Supply池充足

当Supplier A 在完成与 borrow B的配对后,如果A想要退出。此时,从P2P池中找到当前最大的supplier C,将Supplier C的 f token销毁,将赎回的钱以及A原本在lending pool中的钱一起取出还给Supplier A。此时,B对A的债务转移成了B对C的债务。A完成了退出。下面是退出前后各个参与者的资产负债表

Supplier A 退出前

Supplier A 退出后

情况二:Supplier退出,P2P-Supply池无其他supplier

此处需要强调一点,Borrow B通过P2P借贷时,仍然需要超额抵押抵押物,其抵押物被抵押于普通借贷池中,但当进行P2P借贷时,其借到的钱,其实来源于A 从普通借贷池中赎回的钱,所以其债务发生于P2P池层面,在普通借贷池层面,其债务为0。 当Supplier A想要退出时,并且P2P池中只有A一个人,用B在普通借贷池中的抵押物,借出B在P2P池中所欠的金额归还给Supplier A。此刻,Supplier A完成了退出,而B则等价于在普通借贷池中完成了一次借贷,退出了P2P借贷。

(4)Token的激励

需要注意的是,当借贷双方在P2P层完成借贷时,在lending pool层面是没有借贷敞口的,因此也无法获得token distribution的激励。所以对于借贷双方来说,token distribution的激励大于利率优惠时,不会使用P2P借贷进行配对。

结语

目前,Morpho仅仅部署了Compound 和AAVE 两个借贷池,但已经获得了可观的TVL,区别于普通的聚合器,Morpho不仅能帮用户找到市场上最优的借贷利率,在此基础上还能够通过半P2P借贷池优化资金利用率来使借贷双方都活的利率最优解。如果继续发展下去, Morpho是有机会能成为用户们使用Defi借贷的最优先选择的聚合器的。

Reference

https://docs.morpho.xyz/start-here/homepage