- LearningDefi
- Posts
- ❈ ELI5: Decentralized Borrowing and Lending ❈
❈ ELI5: Decentralized Borrowing and Lending ❈
Explain Like I'm Five: Decentralized Borrowing and Lending
❈ Decentralized Borrowing and Lending ❈
After Decentralized Exchanges, one of the most foundational sets of DeFi applications is decentralized borrowing and lending protocols, which allow users to lend and borrow cryptocurrencies from a peer-to-peer network.
In this article, I’ll provide an overview of how decentralized borrowing and lending works, the differences between lending in traditional finance vs decentralized finance, and we’ll do a deeper dive into Aave, the most popular borrowing and lending protocol
What is Decentralized Borrowing and Lending?
Decentralized borrowing and lending is a financial service that allows users to lend and borrow cryptocurrency assets from a peer-to-peer network without the need for intermediaries such as banks or other financial institutions. Instead, users interact directly with the lending protocol, which matches lenders with borrowers and facilitates transactions through smart contracts.
In decentralized borrowing and lending the intermediaries (banks) are eliminated and the users themselves are the lenders to the borrowers.
How Does Decentralized Borrowing and Lending Work?
Decentralized borrowing and lending is made possible thanks to smart contracts that automatically execute transactions when specific conditions are met.
To participate in decentralized borrowing and lending, users must first deposit their cryptocurrency assets into a smart contract that acts as a borrowing pool. These pools act as a marketplace where lenders can supply their cryptocurrency assets and borrowers can request loans. When a user deposits an asset into this pool, they now have collateral available to borrow against.
Once a borrower requests a loan, the smart contract checks their “creditworthiness” by verifying their collateral and health score (we’ll talk about this in more detail later). The smart contract will only approve a loan if the borrower provides sufficient collateral to cover the loan's value.
If the borrower meets the collateral requirements, the smart contract will automatically transfer the loan amount to the borrower's wallet. The borrower then pays back the loan plus interest over a period. The interest paid is divided among the liquidity pool's lenders as a reward for supplying their assets.
Under vs Over-Collateralized Loans
When a borrower takes out a loan on a decentralized lending platform like Aave, they have to put up collateral to secure the loan. The value of the collateral has to be greater than the value of the loan, which is known as being over-collateralized. (The exact % over is derived from a formula and can differ between protocols depending on what factors they set.)
For example, if a borrower wants to take out a loan of 1,000 USDC, they may have to put up $1,500 worth of ETH as collateral. The excess collateral is meant to protect the lenders. If the value of the collateral is above 1,000 USDC than the borrower has an incentive to pay back their loan so they can get their collateral back. However, if the value of the collateral ever gets too close to the value of the borrowed assets, than the lenders have the ability to liquidate the loan by selling the collateral to cover the borrowed amount.
Let’s go over that mechanism with a quick example.
Borrowing Bob deposits $1,500 worth of ETH to use as collateral.
Borrowing Bob then borrows $1,000 USDC.
If the price of the ETH collateral drops to $1,400, then Borrowing Bob still has an incentive to pay back his loan so that he can get back his collateral. ($1,400 > $1,000).
However, if the value of the deposited ETH collateral dropped to $800. Borrowing Bob would have no real incentive to pay back his loan. His 1000 USDC are worth more than his collateral so it would make sense that he just leave the position open and never pay back to loan.
This is why decentralized borrowing and lending protocols have mechanisms to auto-liquidate loans as they approach certain thresholds.
As the value of ETH approached $1,000 than Borrowing Bob’s position would get liquidated. His ETH collateral would be sold off into USDC and returned to the lending pool, making sure that the lenders are repaid for their loan.
In contrast, under-collateralized loans are when the value of the collateral is less than the value of the loan. Think about things like mortgages, student loans, etc. This means that the borrower is not providing the full amount of what they’re borrowing as collateral for the loan. Under-collateralized loans are riskier for lenders as they may not be able to recover the full value of the loan if the borrower defaults. Therefore, decentralized lending platforms typically do not allow under-collateralized loans.
There are a few protocols experimenting with under-collateralized loans however none of them have achieved significant adoption.
Why Defi Uses Over-collateralized Loans?
Decentralized finance (DeFi) platforms such as Aave use over-collateralized loans as a way to minimize credit risk and ensure the safety of lenders' funds. Over-collateralization allows lenders to hold collateral worth more than the loan, which means that if the borrower defaults or the value of the collateral falls, the lender can liquidate the collateral and recover their funds.
On the other hand, banks are able to offer under-collateralized loans because they are subject to government regulations and have access to centralized credit rating systems, which allows them to assess a borrower's creditworthiness and ability to repay the loan. Banks can also diversify their lending portfolios across different types of loans, which helps to spread out the risk.
DeFi platforms, on the other hand, do not have the same level of regulatory oversight and don’t have access to traditional credit rating systems. As a result, they use over-collateralized loans as a way to reduce the risk of default and to ensure that they can recover their funds in the event of a default.
It's important to note that the specific collateralization requirements and terms of each DeFi lending platform may vary, and some platforms may offer more flexible collateralization ratios or alternative forms of creditworthiness assessment. However, the general trend in DeFi has been towards over-collateralized loans as a way to mitigate risk and ensure the safety of lender's funds.
Aave - A Popular Decentralized Lending Protocol
One of the most popular decentralized lending protocols is Aave. Aave allows users to deposit their cryptocurrency assets into a pool, earn interest on their deposits, and borrow cryptocurrency against their deposited assets.
How Aave Works
To use Aave, users deposit their cryptocurrency assets into a pool to earn interest. The interest earned is distributed among the pool's depositors as a reward for supplying their assets. Variable interest rates are based on the supply and demand of the assets in that specific pool.
When a user borrows cryptocurrency from Aave, they must provide collateral in the form of cryptocurrency assets that meet Aave's collateral requirements. The amount of cryptocurrency that can be borrowed depends on the value of the collateral provided, known as the loan-to-value (LTV) ratio.
If the value of the collateral drops below the minimum collateral ratio, as known as the liquidation threshold, the smart contract will allow that position to be liquidated. The liquidation process ensures that lenders are not exposed to too much risk and helps maintain the stability of the liquidity pool.
How to Use Aave
Let's say you have some Ethereum (ETH) that you would like to earn interest on. You could use Aave to lend your ETH to other users who need to borrow it, and earn interest on the amount you lend.
Here's how you would do it:
First, you would need to visit the Aave website and connect your wallet to the platform.
Once you've connected your wallet, you can select the amount of the specific asset you would like to lend.
After selecting your lending pool, you will need to confirm the transaction and wait for it to be processed on the blockchain.
Once your transaction has been processed, your ETH will be deposited into the lending pool, where it will be available for borrowers to borrow.
As borrowers borrow your ETH, you will earn interest on the amount you've lent.
When a user deposits an asset into Aave, they receive a corresponding amount of "aTokens," which represent the user's share of the lending pool for that asset. For example, if a user deposits 10 ETH into Aave's ETH vault, they would receive 10 aETH in return. These are very similar to the LP receipt tokens that a user receives when the deposit funds into a DEX liquidity pool.
If you decide you want to withdraw your ETH from the lending pool, you can do so at any time by visiting the Aave website and initiating a withdrawal transaction.
When you withdraw your ETH, you will also receive any accrued interest that you've earned while your ETH was in the lending pool.
That's it! By lending your ETH through Aave, you can earn interest on your cryptocurrency without having to actively manage your position. Of course, it's important to remember that when you’re interacting with smart contracts there is always risk of a smart contract exploit.
When you deposit assets into Aave those assets are isolated into separate vaults, which means that each asset has its own lending and borrowing pool. This is known as a "money market" model, where each asset operates as its own market with its own supply and demand dynamics. This also allows you to deposit Token A as collateral and earn a lending rate specific to that asset while also taking out a loan of Token B that has a total independent borrow rate, specific to Token B and it’s supply/demand within it’s pool.
By isolating assets in separate vaults, Aave is able to minimize the risk of cross-asset contamination in the event of a liquidity issue or market disruption. This approach also allows Aave to set asset-specific parameters, such as interest rates and collateral ratios, that are tailored to the unique characteristics of each asset.
How to borrow from Aave
Here's an example of how someone might use Aave to borrow funds:
Let's say you want to borrow some USDC, but you don't want to sell any of your existing holdings and trigger a taxable event. You could use Aave to borrow funds by providing collateral in the form of another cryptocurrency that you own.
To get started, you would need to visit the Aave website and connect your wallet to the platform.
Once you've connected your wallet, you can select the cryptocurrency you would like to borrow, and choose the borrowing pool you would like to participate in. Aave offers a variety of borrowing pools, each with different interest rates and collateral requirements.
We’ll use ETH in this example.
After selecting your borrowing pool, you will need to specify the amount of ETH you would like to deposit and use as collateral.
After providing collateral, you will be able to borrow X amount of any available assets. We’ll be borrowing USDC in this example.
Aave uses a loan-to-value (LTV) ratio to determine how much collateral you need to provide for a given loan amount. For example, if the LTV ratio is 50%, you would need to provide collateral worth twice the amount of the asset you are borrowing.
Right now, the max LTV for ETH is 82.5% and we had deposited $1,000 worth of ETH. That means we could borrow up to a max of $825. However, we probably don’t want to borrow up to the max amount as we could get liquidated if the price of ETH and we crossed the liquidation threshold (which is 85% for ETH).
The Liquidation threshold is the point at which a borrow position will be considered undercollateralized and subject to liquidation. For example, if a collateral has a liquidation threshold of 85%, it means that the position will be liquidated when the debt value is worth 85% of the collateral value.
So we select to borrow $200 in USDC to be safe and avoid liquidation.
Once you've specified your loan terms, you will need to confirm the transaction and wait for it to be processed.
This series will take a few transactions to complete. But as you go through the flow, the collateral you provided will be locked in the borrowing pool, and the borrowed cryptocurrency will be deposited into your wallet.
As you use the borrowed cryptocurrency, you will be incurring interest based on the interest rate for your borrowing pool.
Whenever you pay back your loan of USDC, your collateral will become available and you can withdraw it back into your wallet.
That's it! By using Aave to borrow funds, you can access cryptocurrency liquidity without having to sell any of your existing holdings.
Advanced Aave Topics
How Aave sets interest rates
Aave determines borrowing and lending interest rates using a dynamic interest rate model, which is designed to respond to changes in supply and demand for each asset in the protocol.
The Aave interest rate model uses a concept called the "utilization rate," which measures the percentage of funds in a given lending pool that are currently being used by borrowers. The utilization rate is used to calculate the interest rate for each lending pool, as follows:
When the utilization rate is low (i.e. there is an excess supply of funds), the interest rate for borrowing is low because there is less demand for funds, and the interest rate for lending is low because there is an excess supply of funds available for lending
When the utilization rate is high (i.e. there is high demand for funds), the interest rate for borrowing is high because there is high demand for funds, and the interest rate for lending is high because there is less supply of funds available for lending.
In addition to the utilization rate, Aave also takes into account other factors when determining interest rates, such as the volatility of the asset being borrowed or lent, and the overall risk profile of the lending pool.
It's important to note that interest rates in Aave can change frequently, based on changes in supply and demand for each asset in the protocol. Borrowers and lenders should be prepared to monitor interest rates and adjust their positions accordingly to optimize their returns.
Aave does have a fixed interest rate product but the mechanics of that go further than the scope of this introduction.
LTV Ratios
The LTV ratio represents the maximum borrowing power of specific collateral. For example, if the collateral has an LTV of 75%, the user can borrow up to 0.75 worth of ETH in the principal currency for every 1 ETH worth of collateral. Different assets have different LTV ratios, which reflect their perceived risk and volatility.
LTV ratios are set by Aave's governance process, which involves the community of AAVE token holders voting on proposed changes to the protocol. When considering changes to collateral ratios, the community takes into account a variety of factors, including:
Historical price volatility of the asset
Liquidity of the asset on decentralized exchanges
Overall risk profile of the asset
In general, assets that are perceived to be more risky or volatile are assigned higher collateral ratios, while assets that are considered to be less risky or volatile are assigned lower collateral ratios.
For example, at the time of writing, the Max LTV ratio for ETH on Aave is 80%, meaning that a borrower would need to provide collateral worth at least 1.25 times the value of the loan in order to borrow funds. The Max LTV for LINK, on the other hand, is 50%.
The reason for the different collateral ratios is that ETH is generally considered to be more volatile and risky than LINK. This means that LINK is more likely to experience large price swings that could lead to undercollateralization, while ETH is less likely to experience such swings.
It's important to note that collateral ratios on Aave can change over time, based on changes in the perceived risk and volatility of each asset. Borrowers and lenders should be prepared to monitor collateral ratios and adjust their positions accordingly to ensure that they remain within the acceptable limits.
Health Factor
The health factor is a metric used by Aave to ensure that borrowers maintain sufficient collateral to cover their outstanding loans. It's calculated by dividing the total value of the borrower's collateral by the value of their outstanding debt.
The health factor is a measure of the borrower's overall health, taking into account their outstanding loan balance, the value of their collateral, and the volatility of the assets they have deposited. It’s meant to be one score that can encapsulate the “health” of all loans a user has across any number of different asset types.
The formula for calculating the health factor is:
health factor = (value of collateral * liquidation threshold) / outstanding loan balance
The liquidation threshold is set by Aave and varies depending on the volatility of the asset being used as collateral.
If a borrower's health factor falls below a certain threshold, their position may be liquidated, and they will receive a liquidation penalty. The penalty is a percentage of the outstanding loan balance and is used to compensate liquidators for their efforts.
The health factor is an important metric for borrowers, as it determines the amount of collateral they must maintain to avoid liquidation. For example, if a borrower has a health factor of 2, they must maintain their position so that it stays above a health factor of 1.
Liquidation
A liquidation is a process that occurs when a borrower's health factor goes below 1 due to their collateral value not properly covering their loan/debt value. This might happen when the collateral decreases in value or the borrowed debt increases in value against each other. This collateral vs loan value ratio is shown in the health factor.
In a liquidation, up to 50% of a borrower's debt is repaid and that value and liquidation fee is taken from the collateral available, so after a liquidation that amount is liquidated from your debt is repaid.
Aave provides some good examples in its documentation.
Example 1
Bob deposits 10 ETH and borrows 5 ETH worth of DAI.
If Bob’s Health Factor drops below 1 his loan will be eligible for liquidation.
A liquidator can repay up to 50% of a single borrowed amount = 2.5 ETH worth of DAI.
In return, the liquidator can claim a single collateral which is ETH (5% bonus).
The liquidator claims 2.5 + 0.125 ETH (5%) for repaying 2.5 ETH worth of DAI.
Example 2
Bob deposits 5 ETH and 4 ETH worth of MATIC, and borrows 5 ETH worth of DAI
If Bob’s Health Factor drops below 1 his loan will be eligible for liquidation.
A liquidator can repay up to 50% of a single borrowed amount = 2.5 ETH worth of DAI.
In return, the liquidator can claim a single collateral, as the liquidation bonus is higher for MATIC (15%) than ETH (5%) the liquidator chooses to claim MATIC. The liquidator claims 2.5 + 0.375 ETH worth of MATIC for repaying 2.5 ETH worth of DAI.
Today, most of this process is automated thanks to programmed bots that will scout for these liquidabable positions and take action on them as soon as they become available.
Conclusion
Decentralized borrowing and lending protocols like Aave are revolutionizing the way people access and use financial services. By leveraging blockchain technology and smart contracts, these platforms allow users to borrow and lend funds in a trustless and transparent manner, without the need for intermediaries.
In this post, we've covered the basics of how decentralized borrowing and lending protocols work, including the role of collateral, the calculation of interest rates, the liquidation process, and the importance of the health factor. While the world of DeFi can be complex, with new platforms and innovations emerging every day, understanding the fundamental concepts is the first step towards participating in this ecosystem.
That’s all for today. As always - stay safe and stay yielding 🌾
-Andy