Welcome to the Aave V4 dive-in episode 1, this is gonna be a long journey so fasten your seatbelts ⬇️
The idea is to start sharing knowledge around the basic concepts of Aave V4 with the community while we are exploring and building them, to gather feedback and pave the road for the next major protocol upgrade 🔥
I already posted a write-up a few months ago regarding Aave V4 in the context of the Vision proposal, if you missed it here is the link - it's a recommended read to have a more Holistic view of Aave V4 before diving into this series
Let's dive into the motivations first: what drove the initial design, started over a year ago, and the development process started this summer, is the same spirit that led the development of the previous versions - increase the capital efficiency, reduce risk, and improve UX.
The philosophy around Aave has been and continues to be the same - While extremely important, risk management cannot come at expense of capital efficiency and UX. Protocols that excessively focus on risk have a hard time scaling due to capital segregation and UX constraints.
V3 is great at that, but i am convinced we can do better - hence V4. After releasing V3 i was convinced we wouldn't have a V4 - i thought the protocol had everything that was needed, and thanks to the upgradeability, could handle any possible future feature.
While this is somewhat true, as proven by the successful protocol upgrades by @bgdlabs and the various initiatives by @chaoslabs_ , @AaveChan, @tokenlogic and @karpatkey (sry if i am missing someone) some fundamental design decisions cannot be changed and require a new iteration.
It's also important to recognize that the defi space is evolving; new asset categories are being moved onchain at unprecedented speed and new classes of derivatives are created every day. This accelerates the need for an even more refined, modular and efficient version of Aave.
The improvements start all the way down to the architecture - Aave V4 moves away from the monolithic, standalone-market oriented design of Aave V3 to a more flexible and completely modular approach - following a common design concept usually referred as hub-spoke architecture.
Liquidity hub acts as the center of mass of the protocol: It's a single, generalized and simplified contract that acts a "liquidity bucket"; Spokes are individual entities that register into the Liquidity Hub, draw and return liquidity to it.
Whenever liquidity is returned, Spokes pay a base interest (determined by an interest rate strategy at the Hub level) and a risk premium, defined per collateral, that determines how much borrowers are gonna pay on top of the base rate, depending on their collateral composition.
I am not going to focus on the concept of liquidity premiums in this first write-up as it's probably the most game changing feature of the protocol and deserves a full on thread (probably next week). But let's go a bit more in depth with the architectural improvements ⬇️
As visible from the image above, a Liquidity Hub can have an unspecified number of Spokes, each one contributing to the total outstanding debt and to the interest generated. Liquidity Hub manages the basic accounting (total liquidity vs available), the interest rates, the caps and the interest accrual.
Aave V4 will not support any tokenization natively, although tokenization vaults built on top will be available at launch. This gives users the capability to choose whether or not they like tokenization and simplifies the core architecture dramatically.
Compared to previous versions, a Liquidity Hub references assets (called Reserves in previous versions) not through their address but through an id. This allows for listing the same asset multiple times within the same Hub, which does have a variety of potential benefits.
While acting as central component of the system, there can be multiple Liquidity Hubs in parallel with different spokes registered - and they can be interconnected! (more on this later)
So what's a Spoke? A Spoke is a generic module that can register into a hub and that is allowed to draw (borrow) liquidity from it. The nature of the spoke is aspecific and can be anything - crypto based, RWA based, DEX LPs based (😏) and so on.
This opens up to a variety of possibilities and configurations that were simply impossible before - for example, a Spoke can implement a basic, crypto collateralized borrow strategy. Another one can implement an RWA collateralization strategy. And so on.
This will also allow greater simplification. For example, eMode will not exist in V4. Every eMode category is simply going to be a separated Spoke with the subset of assets and a risk configuration equivalent to the corresponding V3 eMode category. This simplifies the protocol and reduces code complexity. The additional UX burden of having to interact with different contracts can be easily abstracted at the frontend level.
Did i mention that a Spoke can also be another Liquidity Hub? Say that the Aave DAO decides to implement a new "market" (which is a new Hub with at least one Spoke in V4 terms) with a different risk profile. In V3, there is always the problem of bootstrapping the market to begin with.
How great would it be if, while there is no liquidity available, users of the new "market" would be allowed to borrow from the main market, up to a certain ceiling? This would allow the DAO to bootstrap a new market while managing risk, and enable users to start using the new market immediately.
At the same time, this allows yield seekers to differentiate their liquidity positions, and optimize the risk reward according to their risk profile. What else is cool you ask? There will not be isolation mode in V4. Isolated assets will be simply be on a new Hub/Spoke pair, with less liquid collaterals /
which get access to the main Hub up to a certain debt ceiling. This marries perfectly with Premiums - given the higher risk profile of these assets, they will require higher borrow rates from borrowers, which will be either redirected to the main Hub, or to the isolated one once lenders start supplying in there.
This also means that, as a lender, i will be able to lend against riskier collaterals if i am looking for higher yields, organically, without the need for incentives. Having the cake and eating it too.
Aaaand we reached the end of this pilot episode - there is much more to talk about tho and the next ones are gonna be even spicier! Hit that follow button if you don't want to miss them 👈
• • •
Missing some Tweet in this thread? You can try to
force a refresh
So the large crv short was completely cleared up, liquidations worked quite well but given the size of the position, 2.68M CRV (around 1.3M $ at current price) were left as bad debt.
It's well within the tolerance margin and can easily be covered. A 🧵
First of all, the bad; of course leaving bad debt is never pleasant. It is a small amount and still a fraction of the tvl of the protocol. The governance has many means to cover it without incurring in any liquidity problem. But, it's a (relatively cheap) lesson 🔽
It means that something didn't work properly in the risk management procedures. Unfortunately in prolonged market downturns, assets that were liquid and top tier might become higher and higher risk, and parameters should be adjusted accordingly.
1. if the spread blows out, worst case scenario the market gets a good arbitrage opportunity to buy stETH for cheap. sETH is perfectly fine and the temporary spread would easily be arbitraged. I would say there would be massive bids below 0.8
2. Aave would be most likely fine even in the worst of the scenarios. Spread caused by temporary depeg is unlikely to cause any insolvency long term.Any bad debt would become collateralized again once the peg restores (and the staking APY works in favor of making positions safer)
3. I doubt it would have any ripple effect on the market. The amount looks big but it's really nothing that can't be absorbed on the eth pair, considering also that eth would need to be purchased to liquidate
Aave V3 is by far the most advanced liquidity protocol in terms of features, security, and scalability - nothing else even comes close. Now it's time to consolidate the leadership - a few ideas worth building on top ⬇️🧵
- Tokenized high leverage forex: Use eMode to allow up to 50x long/shorts on EUR and USD. Build up positions using flashloans, tokenize the position to make it liquid
- Tokenized derivatives staking; As above, but using staking derivatives (similar to what @Instadapp and @DeFiSaver are doing). Tokenize it to make the position liquid, trade it or use it as collateral while earning leveraged yield
The hardest part of learning solidity and smart contract development is not the language, the assembly, or the optimizations. It's understanding that any choice you make, any mistake can have unforeseen, potentially devastating consequences. ⬇️
Blockchain is an extremely adversarial environment and smart contract development should be treated as mission critical software. I spent quite a lot of time reading and studying the software development guidelines by @NASA and other who focus on mission critical applications. /
The language itself is relatively easy - think of a subset of Java with EVM specific constructs and constraints. If you are just getting started in development, i wouldnt honestly focus immediately on solidity - learn another language, experiment, /
A not-so-flashy, super cool feature of Aave V3 - repay using aTokens⬇️
In liquidity protocols like Aave or @compoundfinance, there is currently no protection against possible censorship by centralized entities controlling certain assets. This means that in the event the protocol smart contracts would be blacklisted, by, say, USDC /
suppliers and borrowers of USDC wouldn't be able to interact with the protocol anymore, therefore no possibility to withdraw for the suppliers, and no possibility to repay their position for borrowers. Their collateral would be locked in the protocol, possibly forever.
Takeaways from a quick dive into the @Uniswap V3 smart contracts: ⬇️
Overall architectural complexity is up a notch compared to uniswap V1/V2. Expected given the additional features and the different approach in managing liquidity.
Optimizations are way more extreme, again sign that the additional architectural complexity requires much more resources. Technically speaking, uniswap V3 is a different beast compared to V2.