Daniil Ogurtsov
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Dealing with Utilization in Lending Protocols This research article delves into an intriguing product direction in DeFi - P2P lending. We have examined this topic in detail through internal research and wish to share our findings. We will delve into why the industry shifted towards P2P lending and provide a comprehensive overview of the mechanics, using [Morpho](https://www.morpho.xyz/) as a prominent example of such projects. We also have [an article](https://mixbytes.io/blog/vulnerable-spots-of-lending-protocols) on the common vulnerabilities of lending protocols, which provides a general overview of how they work. ## Key obstacles of modern lending protocols A perfect lending protocol would aim to address three key obstacles: 1) High Utilization: Funds should not sit idle; 2) Flexibility: New borrowers and depositors should always come and leave; 3) Borrower-Lender Interest Alignment: Debt interest and APY should be aligned in a manner that benefits both borrowers and lenders, with minimal spread between rates. However, achieving all three of these goals simultaneously can be challenging in practice. ### The conflict between full utilization and flexibility Achieving full utilization can be challenging as it requires borrowers to take exactly as much liquidity as the lenders have provided. However, high utilization can result in low flexibility within the protocol, as new borrowers may face difficulties in obtaining debt, and current lenders may encounter obstacles when trying to exit their positions. ### The conflict between full utilization and low spread in rates For key users of lending protocols, only two metrics are critical - the debt interest rate for borrowers and the APY for lenders. The lending protocol itself algorithmically sets only the debt interest rate for borrowers. Additionally, all lending protocols employ their own Interest Rate Model, which determines the interest rate for borrowers. In most cases, this rate is variable, meaning that the interest rate on a borrower's debt fluctuates continuously. As a result, borrowers need to know the exact interest rate for their debt tomorrow, adding uncertainty to the borrowing process. ### The background of the spread Non-full utilization immediately affects the profitability of lenders. The concept is straightforward. To illustrate this, let's consider a scenario where lenders provided $100, but borrowers only took $50. After a year, borrowers are charged 20% interest on the debt, resulting in $10 in interest on the amount borrowed. However, this income is evenly distributed among all lenders, resulting in a total return of $110 on their initial investment of $100, or a 10% return. The 50% utilization created a spread between the rates for borrowers and lenders: 20% for borrowers and 10% for lenders. This difference in rates is purely mathematical and results in an obvious inefficiency. Reducing the spread would have satisfied both parties. For instance, if there were no spread and rates set at 15% for borrowers and lenders, it would be mutually beneficial. However, due to utilization constraints, achieving this mathematically is not possible. ### The compromise chosen by modern lending protocols Modern lending protocols have chosen to maintain some idle liquidity, typically 10-30%, to provide flexibility to new borrowers and lenders. As a trade-off, they accept the spread between rates. Generally, the debt interest rate should not be too high or too low. If it is too low, borrowers may take up all the liquidity, leaving none for new borrowers and hindering the project's core functionality. Additionally, a low rate would result in minimal APY for lenders. On the other hand, if the rate is set too high, borrowers may be unwilling to take on such an expensive debt. Thus, the interest rate must be set at a fair value based on market participants' activity, with utilization being a key measure of this activity. High utilization indicates increased borrower activity and demand for debt, which may justify a higher interest rate. The Interest Rate Model is used to automatically search for such a rate based on utilization, often represented by a common curve, as seen in the example provided by Aave in the graph: ![](https://i.imgur.com/gW8LAWj.png) Source: https://docs.aave.com/risk/liquidity-risk/borrow-interest-rate Typically, there is a current fair market rate on the curve where both borrowers and lenders are satisfied. At this point, in theory, borrowers do not take on new debt, and lenders do not provide additional liquidity to avoid diluting their APY. The purpose of this mechanism is to maintain some idle liquidity while ensuring that the spread between rates is not too large. Most existing lending protocols commonly follow this compromise, as it results from the impossibility of solving all conflicting tasks simultaneously. In the next section, we will explore new directions in the industry where this model may be changed. ## How else can we find a balance between these conflicting tasks? One alternative idea is P2P lending, which directly connects borrowers and lenders, with accrued interest on the debt going directly to the lender, based on the principal amount of the debt. In this case, full utilization is achieved by definition, as there is no pool where funds would sit idle. This idea was tested back in 2017, when Aave was known as ETHLend and originally offered this P2P lending model: - Potential borrowers could come to the platform, deposit collateral, and "apply" to borrow, specifying the terms of their debt. - Lenders could review such applications and provide liquidity to those borrowers whose terms they found attractive. However, this system was not atomic and required several transactions for the full transaction cycle, and it implied the absence of any matching mechanism, as everything happened manually. Such a model sacrificed a lot of flexibility. The P2P lending model did not find its market at that time, as the DeFi space was still narrow. New Peer-To-Pool models turned out to be more attractive, as anyone could instantly interact with the pool by depositing liquidity or borrowing. Flexibility was prioritized over ensuring a minimum spread between rates for lending protocols. Subsequently, ETHLend turned into Aave and adopted a new model already successfully tested at Compound. After that, the P2P lending model disappeared from the radar, but it remained tempting to reduce the spread between rates and overcome the obvious inefficiencies. Now, Morpho reintroduces this idea, and we will further explore how they have managed to create P2P lending and what nuances are involved. ## How Morpho achieves full utilization Morpho and ETHLend have some differences. From the user's perspective, the interactions with Morpho are similar to any other lending protocol. - Lenders can provide liquidity into the pool and withdraw it at their discretion. - Borrowers can access funds from the pool and repay the debt when they choose to. However, two extreme situations may arise. ### If there are more lenders than borrowers In theory, there may not be full utilization. However, the funds are not idle and are deposited into Compound/Aave. As a result, some lenders receive APY directly from the borrowers, achieving full utilization. Other lenders earn APY from Compound/Aave for supplying liquidity. ### If there are more borrowers than lenders In this case, some funds will be taken directly from the lenders, achieving full utilization for these lenders and borrowers. However, the remaining borrowers' collateral will be sent to Compound/Aave. Morpho will then transfer debt from Compound/Aave to borrowers. ### There are two important conclusions to be drawn 1) For P2P lending to operate, there must be a base lending protocol such as Compound or Aave, where excess liquidity can be deposited or missing liquidity can be borrowed from. Morpho is not a replacement for modern lending protocols; rather, it serves as an add-on to them. 2) In reality, full utilization is not achieved for all Morpho users. Users are divided into two groups. The first group experiences formal full utilization, while the second group has their interactions redirected to Compound/Aave. This can be illustrated using the example of Morpho's own numbers. ![](https://i.imgur.com/ZiHOcQG.png) Source: https://www.morpho.xyz/ At the time of writing, lenders have deposited $460M and borrowers have taken $220M. These numbers may not indicate full utilization. However, the lenders of $220 million did achieve full utilization as exactly $220 million was issued as debt. The remaining surplus of $240 million went to Compound/Aave, where funds earn interest rates and contribute to the utilization of these base protocols. ### How Morpho reduces the spread between rates Morpho has a unique approach to reducing the spread between rates. Some of its funds achieve full utilization, and Morpho calculates its own interest rate for these funds. This calculated interest rate is the average between the debt interest rate and APY for lenders obtained from the base lending protocols (although the actual formula is more complex, we will omit it for now). As a result, for borrowers on Morpho, the rate becomes lower, making debt cheaper, while for lenders, the rate becomes higher, resulting in a higher APY. This artificial nullification of the spread between rates is achieved only for the funds that are "matched" according to Morpho's Matching Engine, a smart contract that calculates the amount of such funds (we will discuss this in a separate section). However, it's important to note that unmatched funds are also present in Morpho, which are redirected to Compound/Aave. Morpho does not set special rates for these unmatched funds, and they are charged the current market rate of these lending protocols. Excess liquidity in Morpho accrues a lower yield, which is taken from Compound/Aave, while excess debt is subject to an increased interest rate, which is charged from Compound/Aave. ## Inspiration for improvement to other developers ### Matched rates are not socialized Let's illustrate this with an example of excess liquidity in Morpho. In Morpho, there is a distinct division of funds into two groups that earn different returns. One group earns a higher return, while the other group earns a lower return. There are no intermediate states, except for some users who may experience partial matching, dividing their funds into two groups. However, there is an unresolved issue of having a group of users who earn the same returns as Compound/Aave as they wait in a queue for matching with new borrowers. This creates inequality between the groups, a conscious design decision by Morpho. While a typical liquidity provider would prefer to be in the high-income group, achieving this in Morpho's implementation takes work. This issue is further compounded by the challenges associated with the Matching Engine. ### Matching Engine Morpho monitors the funds deposited/borrowed by different users and ranks them from the largest to the smallest based on their size. Users at the top of the list, which includes the largest lenders and borrowers, fall into the category with higher income. However, this approach has its problems, and the implementation of the Matching Engine still needs to be improved due to gas restrictions. It scans and sorts users each time, which may leave some users unsorted due to gas limitations. In addition, the implementation of the Matching Engine itself is not yet quite perfect due to gas restrictions. It scans and sorts users each time, and leaves some users unsorted due to gas restrictions. ![](https://i.imgur.com/tayf1Yz.png) Source: https://dune.com/morpholabs/morpho-aave-dashboard As a result, despite the excess liquidity in Morpho, not all borrowers can match with lenders, as seen in the provided graphs. Only a fraction of the borrowers were able to find matches, while the remaining funds were borrowed from Aave, even though there is a queue of lenders expected to match with them. ![](https://i.imgur.com/eiMnxWO.png) Source: https://dune.com/morpholabs/morpho-aave-dashboard ### The base protocol does not have to be a lending Since DeFi offers multiple sources of revenue, P2P lending protocols are not required to redirect excess liquidity to another lending protocol. Some implementations may deposit such liquidity in yield aggregators like Yearn, as seen with projects like [Sturdy](https://sturdy.finance/). This is also one of the ways to effectively utilize excess liquidity and increase capital utilization. ## Conclusion P2P lending protocols are gaining momentum in the industry, and in the future, we may see updates to Morpho itself, as well as new projects that aim to overcome its limitations. We hope that we have thoroughly addressed the issue of utilization in lending protocols and potentially highlighted an interesting niche for new developers. ## Related articles [Vulnerable Spots of Lending Protocols](https://mixbytes.io/blog/vulnerable-spots-of-lending-protocols) [Contact us Button] ## Who is MixBytes? [MixBytes](https://mixbytes.io/) is a team of expert blockchain auditors and security researchers specializing in providing comprehensive smart contract audits and technical advisory services for EVM-compatible and Substrate-based projects. Join us on [Twitter](https://twitter.com/MixBytes) to stay up-to-date with the latest industry trends and insights. ## Disclaimer The information contained in this Website is for educational and informational purposes only and shall not be understood or construed as financial or investment advice.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully