DeFi 101: A few concepts you need to understand before using the DeFi protocol
Editor's Note: This article comes fromDenglian Community, reprinted by Odaily with authorization.
Editor's Note: This article comes from
, reprinted by Odaily with authorization.
Defi projects exploded in 2019, and the total value locked increased by 137.23% in 2019 alone. Now, 1 out of every 37.12 ETH is locked in the Defi protocol. There are different categories of Defi agreements, such as lending agreements, stable coins, exchanges, security tokens, insurance platforms, etc. Since lending protocols such as Compound have received the most attention, we will focus on these platforms to fully understand their concepts, common patterns, and the risks of their use. Note that these concepts apply not only to loan agreements, but also to other classes of similar products, such as options agreements Opyn. We'll discuss these in a non-technical way to make it friendly for new users.
What is a lending agreement-Lending-Protocol-
Lending protocols are platforms that connect lenders and borrowers in a decentralized manner. On the one hand, it allows borrowers to borrow cryptocurrencies from the platform and pay interest, and on the other hand, it allows lenders to deposit cryptocurrencies to the platform to earn interest. Compared with bank savings accounts, Defi lending agreements can usually provide higher interest rates. For example, when this article was written (April 2020), Compound offered DAI lenders an annualized interest rate of 7.58%, while most banks’ deposit interest Very low, even negative interest rates.
But on the other hand, borrowers need to pay interest on their loans. At the time of writing this article, the annualized interest rate for lending DAI (a stable currency) from the Compound protocol is 8%, which is a very high interest rate .
So - basically P2P lending -
So, basically P2P lending?
No, these Defi lending agreements usually operate based on a pool of funds. For example, when you deposit DAI into Compound, the funds go to a pool rather than to a specific borrower, and similarly borrowers borrow from a pool rather than a specific lender. ). The advantages of this design are as follows:
The use of a fund pool allows the agreement to balance the supply and demand of funds through different incentives. For example, when there is less demand for borrowing, it can also affect the lender's interest rate.
Using a pool of funds allows the protocol to balance risk so that lenders do not have to be fully tied to borrowers.
Why would anyone pay such a high interest rate to borrow from a lending agreement-
Any reason is possible, but a common one is traders trading with leverage. Leverage is a very simple concept, basically borrowing money to invest. For example, I have a lot of BAT tokens and I believe it will rise, but I also want to buy some REP because I think REP will also rise, I don't want to buy REP by selling BAT, then I can use BAT as collateral (Collateral) from The Defi lending protocol lends some ETH, and then uses ETH to buy REP.
In this way, I can hold BAT and REP at the same time, and only need to bear the interest of borrowing Ethereum. If the price of REP rises, I can sell REP for Ether to repay the loan of the Defi protocol, and the remaining Ether is profit.
Collateral -Collateral-
Collateral is a fundamental concept in the financial industry, and it serves as a guarantee for borrowing money. If you fail to make the agreed repayments, your collateral will be used against crew debts. A simple example is a mortgage. When you take out a loan from a bank to buy a house, the house is used as collateral, and if you can't repay the loan, the bank will take your house (usually by auctioning it off).
The same is true in Defi, if you want to lend some assets from the Defi agreement, then you need to provide some assets as collateral to the agreement; if you cannot repay the loan, the agreement will not return the collateral. Since we are talking about decentralized finance, acceptable collateral is usually cryptographic assets.
Why do you need to overcollateralize-
Why do you need over-collateralization?
This is why most lending agreements require an overcollateralized loan, meaning you can only borrow a fraction of the value of the collateral (less than 100%). Defi agreements are often referred to as mortgage ratios, which are a common requirement to control the risk of the agreement. Now when you borrow an asset, you can only borrow up to 75% of the value of the collateral, which leaves a 15% buffer against changes in the price of the collateral.
Since the price sensitivity of each encrypted asset is different, different mortgage rates are usually set for different assets. For example, Compound refers to the mortgage rate as the collateral factor (Collateral Factor) and different assets set different values.
Protocol Tokens and Underlying Assets -underlying-assets-
It is common to see Defi protocols issuing their own tokens. For example, when you deposit to the Compound protocol, you will get cToken tokens, such as cEther, cDAI, etc. These Defi protocol tokens are usually standard ERC20 tokens, and they play an important role in the operation of the Defi protocol. In the Compound protocol, cEther and cDAI are used to represent your deposited Ether and DAI respectively, which are called underlying assets. These cTokens are like receipts issued to you by the Defi protocol, so that you can redeem deposits in the future. Another function is to track the interest on your savings. So if you transfer these cTokens receipts to others, others can redeem your underlying assets. So handle with care.
Another thing to note in Compound is that when you use deposits as collateral to lend other assets, the cToken you hold cannot be transferred. This is understandable, since it is used as collateral, your underlying assets are locked until the debt is paid off. If the cTokens can still be transferred at this time, there will be problems, because the recipients of the cTokens may not know that these cTokens have been mortgaged until they redeem the assets.
Price Oracle -Price-Oracle-
Price oracles are a common concept in Defi protocols. When the Defi protocol deals with different assets, it often needs to know the current prices of these assets. Simply put, the price oracle is used to provide asset prices to the Defi protocol. In the Defi ecology, the price oracle is a key component, but Defi users usually do not pay attention to the operating mechanism of the price oracle, but in fact, if the price oracle is not designed correctly, it may lead to a serious crisis. After all, if If asset prices are attacked, the entire Defi protocol will fail.
At present, most Defi protocols use their own price oracles. Before investing heavily in these protocols, it is necessary to explore these price oracles to understand how they process prices. However, Compound has released Open Oracle, which aims to provide an on-chain solution that takes different prices from trusted reporters and calculates the median price as the asset price. This is a great start for an industry standard solution that can replace the respective oracles in each Defi protocol, removing the risk of manipulating these price oracles.
How is interest calculated?
The concept of interest in Defi is the same as that in banks. There are generally two types of interest: simple interest and compound interest. However, the calculation of interest in Defi is more complicated, because Ethereum transactions need to rely on external triggers, and Defi protocols usually need to rely on user operations to calculate interest. For example, Compound calculates interest based on each block time, but it does not automatically complete the calculation in the background, but relies on user behavior (such as deposits, loans, liquidations, etc.) to trigger interest calculation. When triggered, the function will count how many blocks have passed since the last interest calculation and apply the latest interest on top of it. In other words, if no user action is taken, the protocol will not calculate interest.
Liquidation
Liquidation means: when the value of your collateral drops to close to the debt or even unable to support the debt, the Defi agreement will allow others to repay the debt (repay debt) in exchange for your collateral. For example, assuming that the price of 1 REP is equivalent to 1 BAT, and you deposit 1.5 BAT as collateral and lend 1 REP, then when the BAT price drops to 1.3 BAT = 1 REP, there is a risk for the Defi protocol, because if BAT continues to If it falls, the Defi protocol will be unable to repay the debt, so at this time the Defi protocol will allow others to exchange your collateral at a price of 1 REP = 1.3 BAT. Generally speaking, Defi protocols will provide rewards to liquidators in order to encourage timely liquidation, which is called **Liquidation Bonus** or Bonus. The purpose of the protocol is to ensure liquidation before the price changes too much, which could lead to the collapse of the protocol. It is worth noting that once the collateral price drops below the debt price, it is clear that the borrower will not repay their loan, which will make the agreement insolvency.
Is it possible to make money through liquidation?
Yes. Defi agreements usually provide incentives for liquidation loans to ensure the health of the agreement. As a liquidator, you can get a transaction that is better than the market price from the liquidation process. Therefore, technically speaking, by monitoring the Defi agreement, once a new liquidation opportunity appears Timely liquidation can be profitable. However, this process requires continuous monitoring of the Defi protocol and competition with other liquidators (usually robots) for liquidation opportunities. Also understand that the value of the collateral asset you are taking over is falling and may still be dangerous to own.
Common risks of Defi
The reason why Defi is hot is because it has many advantages, such as high returns, flexible entry and exit, decentralization, etc. However, these advantages certainly come with risks, which are worth discussing.
When asset prices fall, undercollateralization may cause the agreement to be insolvent -insolvency-
Financial products are often inherently risky, and mortgage lending is a common example, which renders the agreement insolvency when the value of the underlying asset falls below the value of the debt. This is especially risky for DeFi due to the high volatility of crypto assets. Although the protocol can limit risks and reduce losses as early as possible by limiting the types of supported assets, setting mortgage rates, strict monitoring of loans and quick liquidation, etc., it cannot completely eliminate these risks.
Our audit report on Compound outlines this risk.
Defi protocols usually rely on certain external conditions to operate, and they are very extensive, whether it is the supported ERC20 tokens or the acquisition of asset prices. Protocols typically have no control over these dependencies, meaning that if any of them are compromised, it will directly affect the protocols they run with. For example, Opyn relies on the Compound price oracle to obtain the price of Compound cToken. If the Compound price oracle fails, Opyn will not be able to update the prices of these assets, which may lead to the risk of undercollateralization.
Smart Contract Vulnerabilities
Smart Contract Vulnerabilitiesflash loanflash loan
in conclusion
details).


