Deeping into DeFi: Understanding Aave Protocol

arnau ramio
16 min readAug 31, 2020

Original Post (Spanish) = https://criptoblog.tutellus.com/entendiendo-aave-protocol/

After several posts where we commented on innovations related to the Aave protocol (such as the lending system through shared liquidity pools such as Compound or the arrival of loans without collateral known as “Flash-Loans”), we will finally take time to understand the Aave protocol.

In some way, this protocol represents the birth of the lending platforms of the crypto world. In 2017 with a project known as ETHLend, the current Aave team was working on the first decentralized protocol for P2P lending. The protocol basically allowed lenders to create a smart contract where they included the loan conditions, so that later a depositor would value the offer and decide to accept the lending contract and lend him what he requested. The lender had to deposit a guarantee, and according to Stani Kulechov, founder of ETHLend and Aave, it was difficult to make understood; Putting more collateral than you borrowed was confusing, why should you do it if you already have the money to look for?

The key is to understand the future value that a person gives to a certain asset: borrowing allows you not to lose your position that will allow you to benefit from asset revaluations in the future.

Despite making good progress and having successfully executed the LEND token ICO in 2017, where they raised more than $ 600,000 in Ether in exchange for 1,000,000,000 token of the existing 1.3 trillion, the frictions of P2P lending and the emergence of protocols as Compound, they caused ETHLend to return under the name of “Aave” in September 2018 with much to contribute to the decentralized lending ecosystem.

Six months after its launch, Aave has accumulated more than 70 million dollars in locks, being one of the fastest growing protocols we have seen. Although it is not surprising since the innovations they have contributed are incredible, and it is only fair that we dedicate a post to explore them.

AAVE PROTOCOL

Aave was born as a decentralized lending protocol through shared liquidity pools, which calculate the interest rates to borrow through supply and demand. Same as what we saw with Compound. However, the ambitious team wants to go a little further. They define Aave as a protocol for financial markets, with decentralized lending being the first of their markets. Currently, they already have two markets, although we will see this later.

As we have said, the main part of Aave at the moment focuses on its role to offer lending services. Similar to Compound, there are some depositors who make their assets available to offer them to third parties in exchange for an interest. This interest is calculated based on supply and demand, that is, the pool’s utilization ratio. If there are 10 million available and 9 million have been borrowed, the interest rate to be paid will surely be high, due to the high utilization ratio of the pool.

Lenders will have to block a collateral, higher than the value they are borrowing. In the event that this does not return your loans, or your collateral loses more value than allowed to be able to consider that your loan does not pose any risk, it will be liquidated to avoid losses in the protocol.

So far nothing has changed regarding Compound. But the Aave team knew that it could not compete with one of the most relevant protocols in the ecosystem without offering new services and differentiated value propositions, and it did not fall short.

LENDING FINANCIAL MARKET

Aave Token (aTokens)

Once you deposit assets in the Aave protocol, you receive in exchange a representation of the amount contributed through the aTokens. These, unlike Compound, do not show the interest generated by your deposited asset through the revaluation of the token, but by the increase in the number of tokens you have. That is, the aToken have a 1: 1 peg with the deposits contributed; If I put 100 Dai into the Dai lending pool, I receive 100 aDai in return. Dai are increasing every 15 seconds (each block of Ethereum) due to the interest generated, so the number of aTokens you have also increases.

Although it seems little, the innovation here is considerable. First, because the ease of use is much greater, since it is easy to know the amount that the aDai are representing thanks to your 1: 1 peg. Second, because the increase in the token number would mean that you receive transactions every 15 seconds, something not very viable due to the cost of gas. This is not really the case, since the token’s own smart contract has the function of consulting the interest generated and updating the aToken accounts integrated. The change has practically no cost, since it is integrated into the smart contract itself and not transactionally in the blockchain.

Something curious is also the impossibility of transferring 100% of the aTokens in a single transaction, since interest continues to be generated during the confirmation time, so you will always have (even if it is somewhat minimal) an amount of aTokens. Here you have the option of making 2 transfers or redeeming the tokens in Aave.

Number of assets

Something particular and worth noting about Aave is that it has 17 different assets with which to lend and borrow.

This is possible because each asset, before being available, follows a risk assessment process, where it is determined whether it is suitable to borrow in the form of collateral and the percentage that can be borrowed for every 100 tokens placed as collateral. That is, certain functionalities are granted to you based on your risk assessment. Let’s see it.

Result currency risk assessment

Each asset is rated, and based on this rating it has certain parameters when it comes to serving as collateral and the penalties it receives in case of being liquidated, generating as always an incentive system to reduce risk on the platform.

An example is USDT, which despite being able to deposit and generate interest or borrow, cannot be used as collateral, since Aave considers that its centralization is too high and therefore it is too risky to use it as collateral to borrow.

Liquidations

These risk parameters are also used to determine the health status of a loan. As in Compound, once the “Health Factor” is less than 1, the loan is susceptible to being liquidated by the liquidators, who receive an interest for their share. Depending on the risk of the asset, the penalty for being liquidated may increase, ranging between values ​​of 5% to 15%.

Something interesting about the Aave protocol is the integration into the platform itself of a settlement service, to give the protocol more balance. Thanks to this integration, anyone can pay off loans and receive “free money” for it. Of course, these opportunities are not usually available because the bots are responsible for liquidating any profitable loan at the moment it appears. There are people who are professionally dedicated to this. Now, in cases like Black Thursday, where we had huge amounts of liquidated loans due to the drop of more than 60% in the value of Ether, there were so many loans to liquidate that the liquidators couldn’t handle all of them, so anyone could take advantage of it. to obtain profitability. This is great as it increases the balance and security of the protocol.

The Flash-Loans (now we will see them) are not available to be used within the same protocol, to avoid risks and possible attacks. So even though they are usually used for operations of this type, they cannot be used to pay off loans within Aave. For this, flash-loans from other protocols such as dydx could be used.

Furthermore, as Aave is an open protocol, applications can be generated that integrate its functionalities. An example is a service that allows users to access Aave’s settlements without going through its platform: iliquidate.finance

Interest rate and InterestSwaps

Due to the constant update of the interest rate in each block generated in Ethereum (it works according to supply — demand), the price of the money that has been borrowed can vary over time. The more liquidity there is in the protocol, the less abrupt these changes will be, but it is true that in exceptional cases the interest rate can skyrocket.

For some, this risk is high, and they are willing to assume a higher but fixed interest rate over time. This means that when borrowing you have the option of paying a variable interest or a fixed interest over time, which despite varying, once chosen will remain at the price at which you took the loan.

This also creates some vulnerability in the protocol; Imagine that the variable interest is 2% and the fixed one is 5%, at this moment the profitability generated by the depositors is 1%. The fixed interest will only be maintained as long as 95% of the available funds are not borrowed or, if the interest generated by the depositors is greater than the fixed interest to be paid by the lenders. Since if this happened, there would be a bug in the system to deposit and borrow continuously, taking advantage of the fact that the interest generated is greater than the price to pay to borrow.

Insterest Swaps consist of making a loan swap fixed to variable or vice versa. This is usually an option to protect your loans in case of sudden increases in the variable interest of the platform over time.

Flash-Loans or loans without collateral

Flash loans are the great innovation that Aave presented at its launch. As incredible as it may seem, flash loans are loans without collateral. How? What you hear, you can borrow -for example- 7,500 Ethers without offering any collateral.

A flash-loan is a loan that you can request from the Aave protocol without the need to put anything as collateral, as long as the loan is paid back in full plus a 0.09% commission during that same transaction (during the block). On the other hand, if the loan is not returned during that same transaction, it is canceled, not being issued.

This financial product was not possible with the traditional system, but thanks to Blockchain and the possibility of reversing transactions before their confirmation, we can now use this type of loan. A way to democratize liquidity has been created, since everyone can access credit without the need for collateral.

This service is mainly used by developers who integrate this liquidity into their applications to offer services with them, which usually have the objective of generating money through arbitration or saving money by self-liquidating loans obtained.

An example is DefiSaver: these give you the option to liquidate your vault in Maker to recover your collateral by returning the amount to be returned through a flash-loan. Let’s take an example:

Imagine that you have deposited 100 Ethers in a Maker vault, and in return you have borrowed 10,000 Dai (50% of the value of the Ethers). This loan has no deadline, and you are using it to pay taxes avoiding selling your Ethers. After 3 months the price of Ether begins to drop sharply, and you find that you do not have enough Dai to repay the loan + interest, and that your vault could be liquidated, assuming a 13% penalty. With DefiSaver you can use a flash-loan of 10,000 Dai + the interest to be returned to Maker, get your 100 Ether, take 50 Ether in UniSwap, swap it for 10,000 Dai + the interest paid in Maker, and return that amount to Aave thus closing the flash-loan. (To learn more about MakerDAO here.)

Thanks to a loan without collateral you have saved 12.75% of the 100 Ethers deposited in Maker, since DefiSaver adds a commission of 0.14% to 0.09% of Aave. Amazing.

We have another use case with CollateralSwap, which allows you, through a flash-loan, to change the collateral used in Maker. Let’s take the example above.

You have a loan of 10,000 Dai in Maker that you have obtained by collateralizing 100 Ether in a vault. Imagine that you foresee a fall in Ether and a revaluation of BAT; with CollateralSwap you can use a flash-loan to change the collateral you are using (Dai for BAT) in a single transaction, without the need for the Dai.

This is a transaction using CollateralSwap to change Maker’s collateral from Ether to USDC. Let’s analyze it:

  • Dai Flash-Loan to release collateral
  • You get the Ether back and swap it for USDC on UniSwap
  • You open another vault in Maker with USDC
  • You get the Dai back in the form of a loan
  • You return the borrowed Dai to Aave

Finally, I will comment on furucombo, a decentralized application still in Beta state that allows you to chain consecutive transactions, obtaining the first arbitration through a flash-loan of a user without having to develop and program anything.

For a more extensive and detailed explanation of flash-loans, here is an article by Miguel Caballero where these loans are treated individually. “Flash loans, DeFi 2.0 and killer-apps”.

Interest generated

Something curious about Aave is that it regularly offers better returns than other lending protocols with shared liquidity pools. This is due to the extra integrations of the protocol; In the first place, an amount of the loans are taken with a fixed interest, giving a greater return to the depositors, in addition to the 0.09% commission for generating flash-loan, where 70% is destined to the depositors, and 30 The remaining 80% is burned to promote the increase in the value of the LEND token and 20% is destined to developers who integrate flash-loans. As for the commissions of normal loans, these are used 80% to burn LEND tokens and the remaining 20% ​​percent for depositors, something that could change with decentralized governance through the native token.

An example of the effect of flash loans is seen in the interest generated by Ether depositors. An asset that theoretically should offer (comparing the asset in Compound) a return of 0.01% per year, is giving 0.16%. And of this 0.16%, approximately 0.1% was generated in a matter of days when many Maker’s CDPs tried to close using flash-loans, generating interest for all depositors.

2nd MARKET — UNISWAP LIQUIDITY TOKEN

As we mentioned at the beginning of the post, Aave is not limited to being a lending protocol but rather a financial markets’ protocol, where the option to deposit and borrow is only one of the available markets.

We have recently seen the second market introduced, which consists of using UniSwap’s liquidity tokens as collateral. If we review, UniSwap is a protocol to swap ERC20 tokens thanks to a pool between 2 tokens deposited by users, who receive interest through commissions for each Swap made. (See UniSwap here).

Until now, those who added liquidity to UniSwap pools received interest and a token that represented those assets called liquidity tokens so that later they could withdraw them or transfer them to a third party without having to remove the liquidity. With this Aave integration you can now use liquidity tokens as collateral and take out a loan. This market is more risky than the lending market due to the type of token used to collateralize, in addition to the fact that UniSwap has an intrinsic risk due to the rebalancing between the two tokens deposited in the pool.

This is why it is a new market, independent of the other. Users will be able to deposit their assets for the UniSwap tokens market or for the lending market. This means that we will see arbitrage opportunities within the same protocol, something that has not yet been seen.

Oracles

Another challenge for Aave is to ensure that prices reflect real-time market conditions. This entails taking into consideration and knowing the prices of the main decentralized and centralized platforms. This data is mainly off-chain so you need to make use of oracles to bring the data within the Blockchain.

Connecting data on-chain is not enough, since it needs to be incorporated using a framework that minimizes risk and promotes decentralization. This is surely the most critical information in the protocol, so it is necessary that the data be obtained in a secure and decentralized way.

In order to comply with these conditions, Aave has used Chainlink to offer this data to smart contracts. Chainlink is a decentralized network of oracles that provides smart contracts with secure and reliable access to data providers, APIs, and many other external data.

Surely the most efficient way is to obtain the data directly on-chain. The new version of UniSwap, for example, offers the option of using the swap protocol to provide real-time and on-chain price data. Despite the clear improvement of this service for the DeFi ecosystem in general at the moment the risk assumed is too high, and perhaps we will see the prices of version 2 adopted as an on-chain oracle later on. Without going any further, we have seen protocols being attacked and millions of dollars lost for using Kyber as a price oracle. The attackers modified the price offered by Kyber adding stress to the liquidity pool, and just then they attacked the protocol. It is also true that the new version of UniSwap offers improvements to avoid this type of manipulation.

LEND TOKEN

One of the elements that fascinates me the most about the Aave protocol is undoubtedly the native LEND token. It has functionalities and tokenomics that can serve as an example for the entire DeFi ecosystem. As we have commented on several occasions, the governance of a protocol is the most crucial part, because if a protocol has 1 billion blocked and the governance attack has a cost of 500 million, we have a big problem.

This is why the token must have a tokenomics model that encourages its holders to hold it in order to benefit from future revaluations. This way you prevent them from wanting to get rid of it, causing continuous price drops. In these cases we see that governance is centralized and that the cost of attack is decreasing, when it should grow in parallel with the growth of the protocol.

LEND was launched in 2017 through an ICO, where approximately 78% of the available tokens were sold (1 trillion of the 1.3 trillion available). With the creation of Aave, this token has acquired new functionalities. First of all, using the token on the platform gives you certain benefits such as reduced commissions, in addition to being able to be used as a guarantee and using the platform’s commissions to burn LEND tokens.

Now the LEND token will become the governance token of the protocol, so the management and decisions about the protocol will no longer be made by the team but by the LEND token holders. As we have seen, governance is the cornerstone of the protocols, and Aave has been able to give the token enough functionalities to make it the heart of the system and can absorb part of the value of the platform.

The LEND token can be deposited in a smart contract and serve as security for the platform’s funds. It will work as a second layer of defense in case the guarantees are not sufficient to face the debts generated within the protocol. In exchange, in case of generating new tokens as happened in Maker, in order to recover the funds lost during Black Thursday, these will be received by the depositors of the guarantee as a reward for providing security to the protocol and will receive part of the protocol commissions, which They will no longer be used solely for token burning. These commissions will come from all the markets available in Aave, from the lending to the collateral with UniSwap, and a future market of loans collateralized with SetTokens.

Somehow Aave is creating a security layer with a functionality very similar to the secure protocols like NexusMutual. For providing security to the system you receive incentives, allowing a win-win relationship for the protocol.

The last layer of security will be the so-called “backstop” that allows users to deposit assets to serve as a guarantee of the protocol with stable assets or ether, without having to be LEND.

(ADDED INFORMATION) Since the day of the post, Aave Protocol has published a detailed version of the tokenomics of their gobernance token. This version counts with a token migration with a 100:1 ratio from LEND to AAVE, added functionalities for gobernance and a roadmap gobernance. They have also included a new feature on the platform that allows P2P credit delegation with off-chain contracts between participants.

You can check the Avvenomics here and the credit delegation system here.

CONCLUSION

Not even 6 months ago, Aave’s DeFi protocol was launched and in this short time it has become one of the leading projects, both for its innovative contributions (eg flash-loans) and the continuous and constant improvements that are being added.

One of the key points is the transparency they offer about the data and functionalities of the protocol. Although not being it would be absurd since everything is public and reviewable (the magic of being open source), they work to make this transparency even more visible. Here, for example, you can see all the real-time data of the protocol, together with the statistics of each asset.

In no time Aave has become Compound’s main threat. This tweet quite surprised me at the time:

At the time of the tweet, Aave still had a native token (LEND) with highly improvable tokenomics, and it had also not announced the new UniSwap financial market. Even at that time some were already clear:

Without a doubt something to keep in mind is the “less captured by VC’s” part. Compound was financed mainly by private rounds, which makes the token much less distributed, quite the opposite of the Aave token. In general, the tokens captured by VC’s tend to take time to appear and revalue due to their lack of liquidity. LEND represents a great threat in this regard, its wide distribution that the interactions with the token are much better.

Without a doubt I hope the best for Aave, not only because of the team behind, always attentive and eager to improve to offer DeFi to a traditional financial system that needs it, but also for all the innovations that they are bringing to the ecosystem.

For more information about Aave and how it works, we will cover this and much more in our Blockchain Master and DeFi Bootcamp.

REFERENCES

--

--

arnau ramio

Blockchain-Business Developer & DeFi Manager. Co-Founder & COO at Themar Solutions and Co-Founder of Learningheroes.com