Defi introduction: Aave

in CryptoDog4 years ago

image.png

In the past, P2P generally refers to the form of person to person lending. This kind of lending has three roles: borrower, depositor, and intermediary platform. The borrower publishes the loan information on the intermediary platform, the intermediary reviews the information and the depositor lends funds to the borrower. Compared with traditional bank deposits and loans, P2P generally has the following characteristics:

  • The borrower is unsecured
  • The depositor’s funds are directly transferred to the borrower, and there is no fund pool
  • Forming transactions through the Internet's pending orders and taking orders, the efficiency is much higher than that of banks

Since the borrower is unsecured (but an intermediary is often required to review the borrower’s asset level, such as real estate, cars, etc.), depositors need to take great risks, and ordinary intermediary platforms are often unable to perform due diligence on the borrower . The loan products in Defi such as Aave and Compound are generally person to pool. This is similar to a bank. Depositors first give money to the bank, and then the bank lends to the borrower. To borrow in Defi, there must be a sufficient amount of collateral. Although all require collateral, the valuation cost of Defi's collateral is very low, and banks often find professional institutions to value the mortgagor's assets.

In Aave, the depositor deposits coins in the Pool, such as depositing 100 ETH, then the depositor has the ability to borrow other assets from the Pool. Aave will limit the ratio of borrowing, such as depositing 100 ETH can borrow up to 50 ETH worth of other assets. Aave will also set the liquidation ratio, for example, when the borrowed assets rise to 80 ETH, it will face the risk of liquidation. The whole process is similar to borrowing renminbi from the bank to mortgage the real estate. The difference is that it takes a longer time for the bank to value the real estate and then lend you money. If the real estate depreciates, the bank needs to auction the real estate for a longer time. In Defi projects such as decentralized lending such as Aave, collateral valuation and auction collateral are generally instantaneous, which not only improves the lending efficiency of borrowers, but also improves the protection of depositors.

Architecture

image.png
User depositing assets to LendingPool will get the corresponding aToken, for example, depositing DAI can get aDAI. AToken is an interest-bearing asset. As time grows, the deposit income on aToken will increase and its net value will also increase. When the user deposits 100 DAI when the net value of aToken is 1, he will get 100 aToken, and when the net value of aToken grows to 1.2, he will get 120 DAI when redeeming 100 aToken. After the user has a full mortgage or credit, he can lend assets from LendingPool, and will receive the corresponding dToken (Debt token) while lending the assets. Similar to aToken, dToken also has a net value. For example, if you lend 100 DAI when the net value of dToken is 1, you will receive 100 dToken. As time grows, dToken will accumulate interest on borrowing. When the net value of dToken grows to 1.2, you will be repaid. Destroying 100 dTokens requires repayment of 120 DAI to LendingPool.

Asset prices in Aave are provided by Oracle, fixed borrowing rates are also provided by Rate Oracle, and some control parameters in the system such as active and freeze are set by the Configrator contract.

Liquidation

Two lines are set for each asset in Aave: ltv (loan to value) and liquidityThreshold, ltv<liquidityThreshold. ltv refers to the borrowing capacity of assets, and liquidityThreshold refers to the ability of assets to guarantee debt. For example, if the deposit value is 100 eth, the ltv is 30%, and the liquidityThreshold is 60%, you can only lend a debt worth 30 eth at most. If the debt increases with the price change, then when the value of the debt reaches 60 eth Deposits of such assets will be liquidated.

Users can deposit a variety of assets in Aave, or borrow a variety of assets. The deposited assets can be used as a guarantee for the debt. If there is no guarantee, the debt will not be affected even when the debt is liquidated. This is equivalent Yu made a protection for the deposit. The debt can be liquidated only when the ratio of the total debt to the total guaranteed assets exceeds the liquidation line, and each liquidation can only liquidate one kind of guaranteed deposit assets.

At the time of liquidation, up to 50% of the debtor's debt can be liquidated, and the variable interest rate loans will be liquidated first, and then the fixed interest rate loans will be liquidated. Liquidation can get a certain reward. Each asset in Aave has a liquidationBonus attribute, such as liquidationBonus=105%. Liquidation of debt worth 100 ETH will get collateral assets worth 105 ETH, and the liquidation income is 5%.

image.png

safe question

Every Defi project faces a variety of security issues. For Aave's business, there are some specific security issues that need to be considered:

Is it possible to deposit low-value assets and lend high-value assets? The low value is related to Oracle's quotation. For example, the price of UNI in the off-chain market is 100DAI, and if Oracle's quotation is 1000DAI in Aave, then depositing UNI can lend out assets that are much higher than the actual value. This kind of quotation risk is there, but Aave adopts a double insurance mechanism for the quotation. First, the quotation is provided by Chainlink. If there is a problem with the Chainlink quotation, the price will be provided by the oracle provided by Aave itself.

Can I deposit low-liquidity assets? If you can, you can increase the price of a junk currency at will, and then deposit this junk currency to lend out assets with good liquidity. The assets that can be used as deposits in Aave are not open-ended. Aave's governance organization controls which assets can enter LendingPool. The LTV of different assets is different, and the LTV of assets with high liquidity is higher.

Can the interest rate be controlled so that the interest rate for borrowing certain assets is extremely low? The borrowing rate is related to the asset utilization rate. The lower the asset utilization rate, the lower the borrowing rate. To artificially lower the asset utilization rate, a large amount of assets must be deposited. For example, the current deposit of the asset DAI is 1000 DAI, deposited by Alice, and the fair borrowing interest rate in the market is 5%. At this time, if Bob deposits 1 million DAI and then borrows 1,000 DAI, the borrowing interest rate will be very low due to the extremely low asset utilization rate (0.1%), so Bob can use funds far below 5% The cost of using these 1,000 DAI will harm the interests of the depositor (Alice) in front of it. In Aave, this problem of large households infringing on the interests of small households is taken into account. The solution is that Bob can borrow DAI, but Bob must lend more DAI than his deposit, that is, either not borrow or borrow more than 1 million DAI.

Will there be a problem that the borrowing interest rate is lower than the deposit interest rate? It is possible that fixed interest rates follow the market, and every new fixed-rate loan generated can reflect the fair value of asset borrowing rates in the current market. However, if the fixed interest rate in the early stage was relatively low and the demand for borrowing assets later increased and the interest rate of deposits rose, it may appear that the current deposit interest rate is higher than the fixed lending rate in the early days. Under normal circumstances, this is allowed. After all, the loan interest rate is fixed, and it is impossible to change the interest rate of the user's fixed-rate loan casually. Only when the asset utilization rate exceeds 95% and the deposit interest rate is less than 40% of the maximum variable lending rate, the early borrowings with low interest rates will be readjusted to the fixed lending rate, which is also a kind of Aave's benefit to depositors. protection.

Can the variable lending rate be raised to make the variable lending rate loan under-guaranteed, and then profitable by liquidating the debt? It is theoretically possible, especially after the return on assets exceeds Uo, the growth rate will be much faster, but it takes time to accumulate interest for the debt to reach the liquidation line. Interest is still required to raise interest rates, and the return on debt liquidation is not particularly high, so the implementation of this attack needs to be effective for specific users with high debt ratios.