Aggregators are one of the latest innovations in DeFi which allow traders to tap deep liquidity and receive better order book pricing and interest rates by using smart contracts to leverage the best features across a number of different protocols.
One of the very first projects to bring the concept of aggregators to the cryptocurrency mainstream was the 1inch decentralized exchange (DEX).
The 1inch exchange splits orders across multiple other decentralized exchanges such as UniSwap, Kyber and Bancor via arbitrage bots in order to find the best price for a particular trade, all within the same transaction. As a result of this innovation, traders are able to place orders with minimal price slippage and secure the most favourable price for their trade.
During the very early days of DeFi, only a few lending platforms existed and users had limited tooling available to find the best yield on offer across those platforms.
Initially, users had to visit the websites of each platform to find out the interest rate on offer, over time the space matured and websites such as Loanscan.io provided a consolidated view of the latest interest rates across most platforms:
This however was very manual and time consuming - as a result, developers were keen on applying the same concepts that 1inch had pioneered in the lending space by automating the process through the use of smart contracts. As a result, the concept of Yield Aggregators was born and one such project which pioneered this concept was Yearn Finance.
In early 2020, the author of Yearn protocol – Andre Cronje, started looking into automating his strategy for choosing the highest paying lending protocol for his stable coins.
Before the first iteration of the protocol, Andre had to wake up every day and manually check which protocol pays the best APY on that day and consider moving his funds to that protocol. There were always a few options available at a time such as Compound, Aave, Fulcrum or dYdX. This manual work quickly became repetitive and boring, so Andre started coding the first version of the Yearn protocol to automate the whole process of choosing the most optimal strategy for his stable coins.
The main element of Yearn Finance is the Yearn protocol.
The Yearn protocol is a yield optimiser that focuses on maximising DeFi capabilities by automatically switching between different lending protocols in order to find the best interest rate available on the day and deploying funds to that protocol.
The Yearn protocol creates a pool for each stable coin.
By depositing a stable coin to a pool, the user receives their yTokens that are yield-bearing equivalents of the coin that was deposited.
- If an user deposits DAI
- The protocol issues yDAI.
- The DAI that is pooled together can then be moved between different lending protocols to always maximise the yield.
- If Aave offers a better yield on DAI than Compound
- The yearn protocol can decide to move all or some of the DAI to Aave.
- If an user wants to withdraw their initial DAI + accrued interest
- They can burn their yDAI and receive the underlying DAI.
The protocol checks if there is a better yield available at the time a user deposits or withdraws money from the pool, triggering a rebalance of the pool if necessary.
One thing that the protocol always assures is to never swap the initially deposited stable coin to a different stable coin, even if there is a higher yield available.
- If an user deposits DAI
- The protocol would never swap it to USDC, even if USDC has a higher yield.
This is because most users want to withdraw the same stable coins as they initially deposited.