DeFi Popularization丨Lending in DeFi and Comparison of Aave and Compound

DeFi Popularization丨Lending in DeFi and Comparison of Aave and Compound

Loading

How does DeFi lending work? How are the supply rate and the borrowing rate determined? And what is the main difference between the most popular lending protocols such as Compound and Aave? This article will answer these questions.

What is lending? Lending is one of the most important elements in any financial system. Most people are exposed to borrowing in their lives, such as student loans, car loans, or mortgage loans.

DeFi科普丨DeFi中的借贷及Aave、Compound的比较

Loan concept: Depositors provide funds to borrowers in exchange for interest on their deposits. Borrowers are willing to pay interest on the amount they borrowed in exchange for a fund that can be used immediately.

Traditionally, lending has been facilitated by financial institutions such as banks or peer-to-peer methods.

When it comes to short-term lending, the area of ​​traditional finance that specifically targets this part is called the money market. The currency market can provide a variety of tools, such as CDs (certificates of deposit), Repos (repurchase agreements), treasury bills, etc.

Encrypted lending In the field of cryptocurrency, lending can be done through DeFi protocols such as Aave or Compound, or CeFi companies such as BlockFi or Celsius.

DeFi科普丨DeFi中的借贷及Aave、Compound的比较

The operation of centralized finance is very similar to the operation of banks, so we sometimes refer to these companies as “crypto banks.” For example, BlockFi escrows deposited assets and lends them to institutional players such as market makers or hedge funds, or to other users of its platform. Although the centralized lending model works well, it is prone to the same problems as centralized crypto exchanges, mainly due to hacker attacks or other forms of negligence (bad debts, internal bad operations, etc.) that cause loss of customer deposits . The CeFi model basically violates one of the main value propositions of cryptocurrencies-self-custodial assets. Therefore, DeFi lending came into being.

Lending in DeFi DeFi lending allows users to become depositors or borrowers in a completely decentralized and permissionless manner, and they have 100% custody of their assets.

DeFi科普丨DeFi中的借贷及Aave、Compound的比较

DeFi lending is based on smart contracts running on an open blockchain (mainly Ethereum). This is why DeFi lending is the opposite of CeFi lending. Everyone can use it without providing personal information or trusting the fund custodian.

Aave and Compound are the two main lending agreements in DeFi. The working principle of these two agreements is to create a currency market for specific tokens, stablecoins, etc.

Users who want to become depositors can provide their tokens to specific currency markets and collect interest on the tokens based on the current APY.

The tokens provided by the depositor are sent to the smart contract for other users to borrow. In order to exchange deposit tokens, smart contracts issue other new tokens representing supply tokens and interest. These new tokens are called cTokens in Compound and aTokens in Aave. They can be exchanged back to basic tokens. . This mechanism will be discussed in depth later in this article.

It is worth mentioning that almost all loans in DeFi are currently over-collateralized. This means that if users want to borrow funds, they must provide tokens as collateral, and the value of these tokens is higher than the loan they actually want.

At this time, there may be a question. If tokens with a value higher than the actual loan amount must be provided, what is the point of a loan? Isn’t it enough to sell your tokens at the beginning?

Some of the reasons are that users do not want to sell their tokens, but they need funds to cover unexpected expenses; users want to avoid or delay the payment of capital gains tax on tokens; or use borrowed funds to increase their position. lever. So, is there a limit to how much money can be borrowed? Yes, the amount that can be borrowed mainly depends on 2 factors. First, how much money can be borrowed in a particular market. In an active market, this is usually not a problem.

DeFi科普丨DeFi中的借贷及Aave、Compound的比较

Second, the mortgage coefficient of tokens. The mortgage factor determines how much money can be borrowed according to the amount of collateral. For example, the mortgage coefficient of DAI and ETH on Compound is 75%. This means that the provided DAI or ETH can lend up to 75% of other tokens.

If the user decides to lend funds, the value of the loaned amount must always remain lower than the value of his collateral multiplied by his mortgage coefficient. If this condition is true, then there is no limit to the time the user can lend funds.

If the value of the collateral is lower than the required value, the user’s collateral will be liquidated so that the agreement can repay the loan amount.

The interest received by the depositor and the interest that the borrower must pay is determined by the ratio between the tokens supplied and borrowed in a particular market.

DeFi科普丨DeFi中的借贷及Aave、Compound的比较

The interest paid by the borrower is the interest earned by the depositor, so in a specific market, the APY for borrowing is higher than the APY for deposits.

The interest APY is calculated based on the Ethereum block. The calculation of APY for each block means that the interest rate provided by DeFi lending is variable, and the lending needs of a specific token may vary greatly.

This is also one of the biggest differences between Compound and Aave. Although both agreements provide a variable APY for deposits and loans, Aave also provides a stable APY for loans. The stable APY is fixed in the short term, but can be changed in the long term to adapt to changes in the supply-demand ratio between tokens.

On the basis of stable APY, Aave also provides lightning loans, users can borrow funds in a very short period of time (a transaction on Ethereum) without the need for pre-mortgage. In order to better understand how the DeFi loan agreement works, let us dive into an example.

How the DeFi loan agreement works

Let us take a closer look at the mechanism of Compound and cTokens.

A user deposits 10 ETH into Compound. In exchange for 10 ETH, Compound will issue cTokens, in this case cETH.

DeFi科普丨DeFi中的借贷及Aave、Compound的比较

How many cETH tokens will users receive? It depends on the current exchange rate of the ETH market. When a new market is created, the exchange rate between cTokens and the base token is set to 0.02. This is an arbitrary number, but we can assume that the initial exchange rate of each market is 0.02, which can only increase with each Ethereum block.

If the user provided 10 ETH when the market was just created, they will receive 10/0.02=500 cETH. After the ETH market has been running for a period of time, we can assume that this exchange rate is already relatively high, for example, 0.021.

This means that the user will receive 10/0.021=~476.19 cETH. If users decide to redeem their ETH immediately, they should receive roughly the same amount as when they deposited it, which is about 10 ETH.

The user’s cETH is just another ERC20 token. The main difference between it and the general ERC20 token is that cETH must be used to redeem ETH from Compound; most importantly, cETH has been accumulating interest even though it was removed from the original wallet that initiated the deposit. Send to another wallet.

As each new Ethereum block comes out, the exchange rate will increase. The increase depends on the deposit APY, and APY is determined by the ratio of deposit/borrowing funds.

In the example just now, suppose that the exchange rate from cETH to ETH increases by 0.000000002 with each block. Assuming that the rate of increase remains the same for a month, we can easily calculate the interest that can be obtained during this period.

Assuming there are 4 blocks per minute on average: 0.0000000002*4*60*24*30=0.00003456, add this number to the previous exchange rate: 0.021+0.00003456=0.02103456.

If users decide to redeem ETH, they will receive 476.19*0.0213456=~10.0165 ETH. Therefore, the user earned 0.0165 ETH in one month, which is about 0.16% ETH return. It is worth noting that the amount of cETH received by the user has not changed, but the exchange rate changes have caused the user to exchange more ETH than originally deposited.

DeFi科普丨DeFi中的借贷及Aave、Compound的比较

Aave uses a similar model, where every block will accumulate interest. The main difference is that the value of aToken is linked to the value of the base token at a ratio of 1:1. Interest is directly distributed to aToken holders by continuously increasing the wallet balance, and aToken holders can also decide to transfer the interest payment to another Ethereum address.

In terms of borrowing, users lock their own cToken or aToken as collateral and borrow other tokens. Collateral can earn interest, but when used as collateral, users cannot redeem or transfer them.

The loanable amount is determined by the mortgage coefficient of the provided asset. There are smart contracts that can view all the collateral in the user’s account and calculate how much money can be safely lent without being liquidated immediately. To determine the value of the collateral, Compound uses its own price feedback mechanism-obtaining prices from several highly liquid exchanges. Aave relies on Chainlink and will return to its own price source when necessary.

If users decide to repay the loan amount and unlock their collateral, they must also repay the accrued interest on their borrowed assets. The amount of accrued interest is determined by the borrowing APY and will also automatically increase with each Ethereum block.

Although the risk of DeFi lending is much lower than that of CeFi, it also has its own risks.

DeFi科普丨DeFi中的借贷及Aave、Compound的比较

Mainly the emerging smart contract risks and the rapidly changing APY. For example, in the last upsurge of yield breeding, the APY of BAT token loans rose to more than 40%. This may cause users to be liquidated because they do not track Compound interest rates on a daily basis.

So what do you think of DeFi lending? Which platform is your favorite?