yield farming – Finematics https://finematics.com decentralized finance education Thu, 24 Jun 2021 14:01:11 +0000 en-GB hourly 1 https://wordpress.org/?v=5.8.1 https://finematics.com/wp-content/uploads/2017/09/cropped-favicon-32x32.png yield farming – Finematics https://finematics.com 32 32 Bank Run in DeFi – Iron Finance Fiasco Explained https://finematics.com/bank-run-in-defi-iron-finance-explained/?utm_source=rss&utm_medium=rss&utm_campaign=bank-run-in-defi-iron-finance-explained&utm_source=rss&utm_medium=rss&utm_campaign=bank-run-in-defi-iron-finance-explained https://finematics.com/bank-run-in-defi-iron-finance-explained/#respond Thu, 24 Jun 2021 14:01:10 +0000 https://finematics.com/?p=1377

So what was the first large scale bank run in DeFi all about? Why is it so hard to create a working algorithmic stablecoin? And what can we learn from the IronFinance fiasco? You’ll find answers to these questions in this article. 

Algorithmic Stablecoins 

IronFinance initially launched on Binance Smart Chain in March 2021 and aimed at creating an ecosystem for a partially collateralized algorithmic stablecoin. 

As we know, building algorithmic stablecoins is hard. Most projects either completely fail or end up in a no man’s land by struggling to maintain their peg to the US Dollar. Because of this, building an algorithmic stablecoin has become one of the holy grails in DeFi. 

Achieving it would clearly revolutionize the DeFi space as we know it today. 

The current ecosystem relies heavily on stablecoins that come with major trade-offs. They maintain their peg to the US Dollar at the cost of either centralization or capital inefficiency. 

For example, the custody of USDC or USDT is fully centralized. On the flip side, stablecoins like DAI or RAI require a lot of collateral which makes them capital inefficient.  

IronFinance tried to address these problems by creating a partially collateralized stablecoin – IRON. 

IronFinance 

Despite a few hiccups along the road, such as short periods of time when IRON unpegged from USD or when ValueDeFi exploits affected some of the IronFinance users, the protocol kept marching forward. 

In retrospect, recovering from these issues most likely built a false level of confidence in the protocol design as its users thought they were dealing with a “battle-tested” project.

In May 2021 IronFinance expanded to Polygon and started gaining more and more traction. 

Total value locked in the protocol quickly went from millions to billions of dollars, surpassing 2 billion before the final collapse. The value of TITAN – protocol’s native token on Polygon – went from $10 to $64 just in the last week leading to the bank run. 

This parabolic growth was mostly driven by extremely high yield farming rewards and subsequent high demand for both the TITAN and the IRON tokens. Yield farmers were able to benefit from around 500% APR on stablecoin pairs: IRON/USDC and around 1700% APR on more volatile pairs like TITAN/MATIC.  

To add even more fuel to this parabolic growth, IronFinance was mentioned by a famous investor – Mark Cuban – in his blog post. This further legitimised the project and brought even more attention to it. 

On the 16th of June 2021, the protocol experienced a massive bank run that crashed the TITAN price to 0 and resulted in thousands of people experiencing major financial losses.

Before we start unfolding all of the events that led to the collapse of IronFinance, let’s try to understand how the protocol was built.

It’s worth noting that reviewing the design of projects, including the ones that failed, is important as it allows us to better understand what works and what doesn’t work in DeFi. It also makes it easier to assess new protocols that very often reuse a lot of elements of the already existing systems. 

Protocol Design 

The IronFinance protocol was designed around 3 types of tokens: 

  • Its own partially collateralized stablecoin – IRON that should maintain a soft peg to the US Dollar,
  • Its own token: TITAN on Polygon and STEEL on BSC, 
  • an established stablecoin used as collateral: USDC on Polygon and BUSD on BSC   

The combination of USDC and TITAN on Polygon or BUSD and STEEL on BSC was supposed to allow the protocol to decrease the amount of stablecoin collateral over time and in turn, making IRON partially collateralized leading to a greater capital efficiency. 

The protocol, although using different tokens on Polygon and BSC, worked in an analogous way on both platforms so in order to simplify this article going further I’m going to skip the BSC tokens BUSD and STEEL in the explanation. 

In order to achieve price stability of the IRON token, the protocol introduced a mechanism for minting and redeeming IRON that relied on market incentives and arbitrageurs. 

Whenever the price of the IRON token was less than $1, anyone could purchase it on the open market and redeem it for approximately $1 worth of value paid in a mix of USDC and TITAN. 

Whenever the price of the IRON token was greater than $1, anyone could mint new IRON tokens for approximately $1 worth of USDC and TITAN and sell the freshly minted IRON tokens on the open market, driving the price of IRON back to $1. 

To understand the process of minting and redeeming better, we have to introduce the concept of Target Collateral Ratio (TCR) and Effective Collateral Ratio (ECR). 

Target Collateral Ratio is used by the minting function to determine the ratio between USDC and TITAN required to mint IRON. 

As an example, let’s say the TCR is at 75%. In this case, 75% of collateral needed to mint IRON would come from USDC and 25% would come from TITAN. 

The protocol started at 100% TCR and gradually lowered the TCR over time. 

TCR can increase or decrease depending on the IRON price. On one hand, if the time-weighted average price of IRON is greater than $1, TCR is lowered. On the other hand, if the time-weighted average price of IRON is less than $1, the TCR is increased. 

Effective Collateral Ratio is used by the redeeming mechanism to determine the ratio between USDC and TITAN when redeeming IRON. ECR is calculated as current USDC collateral divided by the total IRON supply. 

If TCR is lower than ECR, the protocol has excess collateral. On the flip side, if TCR is higher than ECR it means the protocol is undercollateralized. 

As an example, if the ECR is at 75%, each time IRON is redeemed the user would get 75% of their collateral back in USDC and 25% in TITAN. 

What is important is that every time someone mints IRON the TITAN portion of collateral is burned. If someone redeems IRON, new TITAN tokens are minted.

As we can see, the whole mechanism, although a bit complicated, should work – at least in theory.  

Now, let’s see how the events leading to the collapse of IronFinance unfolded. 

Events Unfolding

Around 10 am UTC on 16th June 2021, the team behind the protocol noticed that a few larger liquidity providers a.k.a “whales” started removing liquidity from IRON/USDC and then started selling their TITAN to IRON. Instead of redeeming IRON, they sold it directly to USDC via liquidity pools. This caused the IRON price to unpeg from the value of the US Dollar. This in turn spooked the TITAN holders who started selling their TITAN causing the token price to drop from around $65 to $30 in approx 2 hours. The TITAN price later came back to $52 and IRON fully recovered its peg. 

This event, although quite severe, wasn’t that unusual considering that the protocol had a history of native tokens sharply dropping in value and IRON unpegging for a short period of time. 

Later on the same day, a few whales started selling again. This time it was different. The market panicked and users started redeeming IRON and selling their TITAN in masses. Because of the extremely quick and sharp drop in the TITAN price, the time-weighted price oracle used for reporting TITAN prices started reporting stale prices that were still higher than the actual market price of TITAN. 

This created a negative feedback loop as the price oracle was used to determine the number of TITAN tokens that have to be printed while redeeming IRON. 

Because IRON was trading off-peg at under $1, the users could buy IRON, for let’s say $0.90 and redeem it for $0.75 in USDC and $0.25 in TITAN and sell TITAN immediately. This situation created a death spiral for TITAN that drove its price to pretty much 0 as the lower the TITAN price was the more TITAN tokens would have to be printed to account for the correct amount of the redeemed capital. 

The TITAN price hitting almost 0 exposed another flaw in the protocol – users being unable to redeem their IRON tokens. This was later fixed by the team and users were able to recover around $0.75 worth of USDC collateral from their IRON tokens. 

Unfortunately, TITAN holders didn’t get away with “only” a 25% haircut and instead took heavy losses. This also included TITAN liquidity providers.

This is because when one token in a 50/50 liquidity pool goes to 0 the impermanent loss can reach pretty much 100%. Liquidity providers end up losing both tokens in the pool as the non-TITAN token is sold out for TITAN that keeps going lower and lower in value. 

This situation exposed a major flaw in the IronFinance mechanism that resulted in what we can call the first large scale bank run in DeFi.

Similarly to banks with fractional-reserve systems, where there are not enough funds to cover all depositors at any one time, the IronFinance protocol didn’t have enough collateral to cover all minted IRON. At least not when the TITAN token used as 25% of the overall collateral became worthless in a matter of minutes.   

The IronFinance fiasco also shows us why DeFi protocols shouldn’t fully rely on human coordination, especially when under certain circumstances incentives work against the protocol. In theory, if people just stopped selling TITAN for a short period of time, the system would recover as it had previously done in the past. In practice, most market participants are driven by making a profit and the arbitrage opportunity present in the protocol caused them to fully take advantage of this situation. This is also why all DeFi protocols should always account for the worst-case scenario. 

Lessons Learned 

As with most major protocol failures in DeFi, there are always some lessons to be learned.

In the case of IronFinance, there are a few important takeaways. 

First of all, we always have to consider what would happen to the protocol in the worst-case scenario. This usually involves one of the tokens used in the protocol sharply losing its value. 

What happens when the protocol stops expanding and starts contracting? What if the contraction is way quicker than expansion? 

Another important element of the protocol design that always has to be fully understood is the usage of price oracles. Could they report stale prices or get manipulated by flash loan attacks? If so, what basic protocol mechanisms rely on these oracles and how would they behave when the oracle is compromised. 

Next lesson, providing liquidity in a pool where at least 1 asset can drop to 0 means that we can lose pretty much all of our capital, even if the second token doesn’t lose any value. 

Another lesson, following celebrities and their investments might be risky. With great power comes great responsibility and unfortunately, even a single mention of a certain protocol or a token can cause people to invest in something they don’t fully understand – don’t be that person and always make sure you do your own due diligence. 

One good indicator of high-risk protocols is extremely high APR in yield farming. If something looks too good to be true there are usually some risks that have to be accounted for. 

Last but not least, building algorithmic stablecoins is hard. I hope one day we can see a fully functioning algorithmic stablecoin competing in size with USDT or USDC, but this will most likely take a bit of time and hundreds of failed attempts. If you want to become an early adopter of such a coin it’s great, but keep in mind that the numbers are not on your side. 

What’s Next

So what’s next when it comes to IronFinance and algorithmic stablecoins? 

At the moment, the team behind the protocol is planning on conducting an in-depth analysis of the situation, in order to understand the circumstances which led to such an outcome. 

It’s hard to say if the team behind IronFinance will decide to fix the shortcomings of the existing protocol and relaunch it. 

Historically, second versions of failed protocols usually don’t get nearly as much traction as their original versions. Yam Finance was a good example of such a protocol. 

After the collapse of IronFinance, there is still a lot of capital sitting on the sideline looking for other high-risk opportunities. It will be interesting to see where this capital goes next. 

So what do you think about the IronFinance fiasco? Are you optimistic about the future of algorithmic stablecoins? 

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.

Finematics is also participating in Round 10 of Gitcoin Grants. If you’d like to support us, check out our grant here.

]]>
https://finematics.com/bank-run-in-defi-iron-finance-explained/feed/ 0
Is Yield Farming Dead? https://finematics.com/is-yield-farming-dead/?utm_source=rss&utm_medium=rss&utm_campaign=is-yield-farming-dead&utm_source=rss&utm_medium=rss&utm_campaign=is-yield-farming-dead https://finematics.com/is-yield-farming-dead/#respond Mon, 19 Oct 2020 19:39:27 +0000 https://finematics.com/?p=1042

So is Yield Farming dead? Are there any good farming opportunities left? And when are 1000% APYs coming back? We’ll answer all of these questions in this article. 

Yield Farming & Liquidity Mining

Before we jump into the main topic, let’s quickly recap what yield farming actually is. 

Yield Farming, in essence, is a way of trying to maximise a rate of return on capital by leveraging different DeFi protocols. Yield farmers try to chase the highest yield by switching between multiple different strategies. If the strategy doesn’t work anymore or if there is a better strategy available the yield farmers move their funds around. 

Liquidity mining plays a big role in yield farming to such an extent that sometimes these two concepts are used interchangeably. Liquidity mining is a process of distributing extra tokens to the users of a protocol, for example, Compound distributing COMP tokens to lenders and borrowers on their platform or Uniswap distributing UNI tokens to their liquidity providers. 

If you haven’t read it yet, I’d recommend reading my other article on Yield Farming to understand these concepts even better.

Where is the yield coming from? 

To answer our main questions, we have to first understand where the farming yield is coming from.

There are a few options where the yield can be generated in defi.

The first one is lending. You can lend your coins on platforms such as Compound or Aave and receive usually a single-digit APY on your assets. You can also use Yearn Finance to automate switching between lending protocols with the highest APY. 

The next one is providing liquidity to liquidity pools. You can supply your coins to platforms such as Uniswap, Balancer or Curve and start generating extra money by collecting fees on trades going through the pool. This usually also yields a single-digit APY on your assets. You also need to make sure you understand what impermanent loss is. 

Now, it’s time for the most lucrative way of generating a yield on your assets in decentralized finance – the previously mentioned liquidity mining. 

Liquidity mining is the biggest enabler of high yields in yield farming. This is because the extra tokens that are received can be instantly sold for profit, boosting the APYs. 

Let’s take Uniswap’s UNI token liquidity mining program as an example that currently yields 23% in their ETH-DAI liquidity pool. Yield farmers can supply their ETH and DAI to a liquidity pool and start receiving UNI tokens that can be later sold for, let’s say, ETH or a stable coin, greatly improving their APY generated from the liquidity pool fees. 

Liquidity mining was previously able to bring crazy high APYs. Even as high as 2500% in Sushi or Yam farming. 

So why was that even possible before? 

The answer is fairly simple – there was a high demand for the tokens that were being distributed.  

To illustrate this, let’s have a look at a quick example. 

Project A, a fork of another well-known project, creates a new token – token A and distributes it via liquidity mining. After the initial hype, people quickly realise that Project A doesn’t bring much value to the decentralized finance space and start selling their tokens A rapidly. 

If this happens the yield on Project A’s liquidity mining program collapses as the farmers can only sell their tokens for a very little amount of money. 

Project B, on the other hand, is a well-known project that just started its liquidity mining program by distributing token B. Token B is in demand as investors believe in a long term value proposition of Project B and they think that token B will appreciate in value over time.

In this case, high demand from investors is met with high supply caused by yield farmers selling their token B. 

Market Sentiment

On top of the viability of a project, a general market sentiment also plays a huge role. In a down-trending market, the demand for all the tokens decreases. This, of course, means less demand for the tokens that are being distributed by liquidity mining, hence lower APYs. 

So if liquidity mining requires a constant flow of new capital, you may ask a question – is this some kind of a ponzi scheme? 

Not really, liquidity mining just reacts to the natural supply and demand of the tokens, similarly to the token prices. 

Bear Market -> higher supply than demand -> lower prices -> lower yields 

Bull Market -> higher demand than supply -> higher prices -> higher yields 

On top of that, good projects may be reluctant to even start their liquidity mining programs when the market sentiment is negative, so there are fewer opportunities available. This is kind of similar to companies not doing their IPOs during a recession. 

Is Yield Farming Dead

Okay, so let’s answer our main question here – is yield farming dead? 

Probably, you already know the answer to this question by now. 

No, yield farming is not dead, it just goes through the same cycles as the whole crypto market. 

The fact that yield farming is not dead, doesn’t guarantee the craziness of farming food tokens with 1000% APY coming back. In fact, we can see new projects iterating on the concept of liquidity mining and trying to improve different aspects of it.

Most projects that want to distribute their tokens have to find an optimal way of doing so without flooding the market with tokens and causing a constant selling pressure. This is important even in an up-trending market.

One way of reducing the selling pressure is to introduce additional vesting of the newly distributed tokens. 

Opportunities Left 

So are there any opportunities left in a down-trending market? 

Yes, there are still some good projects going through their liquidity mining program. The yield, although not as high as it used to be, can still be much higher than the yield generated by just lending your tokens. 

Uniswap’s UNI token liquidity mining program, with over $2B of total value locked, is probably the safest option at the moment. 

It offers between 12-24% APY, depending on the liquidity pool. 

SushiSwap still offers between 25% and as high as 400% APY, depending on the pool. 

Index Coop is another interesting example with 60% on ETH-DPI Uniswap LP tokens. DPI is a DeFi Pulse Index that represents 11 top defi tokens, so if you’re bullish on both ETH and DeFi this could be a good option for you. 

There is also a lot of other fairly popular, but more risky options such as Pickle, Core or Ampl. In these projects, the highest APY is usually generated by participating in a pool that requires holding their corresponding token, also known as Pool 2. The main risk here is impermanent loss, especially in a down-trending market. 

For example, although you can get 168% APY on the PICKLE/ETH pair, you are additionally exposed to the price of PICKLE. If the price of PICKLE starts going down, you’ll lose some your ETH because you are supplying liquidity to the 50/50 PICKLE/ETH Uniswap pool.

There are also some other interesting options available on layer 2 platforms, such as Honeyswap on xDai. In the future, I’d expect to see more and more liquidity mining programs being launched on layer 2 platforms, with the aim of attracting more users from the base Ethereum layer (layer 1). 

Of course, before participating in any of these yield farming options make sure you do your own due diligence, including assessing smart contract and admin key risks and making sure to understand the impact of impermanent loss on your supplied liquidity. 

So what do you think about the current state of yield farming and its future potential? And what are your favourite liquidity mining programs?

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.

]]>
https://finematics.com/is-yield-farming-dead/feed/ 0
What is a Vampire Attack? SushiSwap Saga Explained https://finematics.com/vampire-attack-sushiswap-explained/?utm_source=rss&utm_medium=rss&utm_campaign=vampire-attack-sushiswap-explained&utm_source=rss&utm_medium=rss&utm_campaign=vampire-attack-sushiswap-explained https://finematics.com/vampire-attack-sushiswap-explained/#respond Sat, 12 Sep 2020 20:42:40 +0000 https://finematics.com/?p=946

So what is a vampire attack? And how was SushiSwap able to use a vampire attack to  attract over $1B of liquidity in less than a week? You’ll find answers to these questions in this article.

Before we start, if you’re new to DeFi, you may want to read my other articles on liquidity pools and yield farming first as they cover a lot of basic concepts mentioned in this article.

First of all, let’s see how it all started.

SushiSwap

On the 28th of August in the midst of new DeFi projects popping up pretty much every day, a new project called SushiSwap launched. The project quickly gained more and more traction in the DeFi community as it aimed at directly competing with Uniswap by forking the project and siphoning out liquidity with a process later called a vampire attack. The main goal of the project was to create a community-governed automated market maker and fairly distribute its token – SUSHI.

The concept of a vampire attack, although quite simple, is quite ingenious in its nature as it creates very strong incentives for liquidity providers to migrate their liquidity to a new platform. 

Let’s see what a vampire attack is all about.

Vampire Attack

The first step of a vampire attack is to incentivise liquidity providers of another platform to stake their LP tokens, which represent supplied liquidity, to a new platform. 

In Sushi’s case, Uniswap’s liquidity providers were incentivised to stake their LP tokens on SushiSwap, so they could receive extra rewards paid in the SUSHI token. SushiSwap started with a quite aggressive emission schedule for the SUSHI token – 1,000 SUSHI per Ethereum block distributed to Uniswap’s liquidity providers across multiple different pools such as SNX-ETH, LEND-ETH, YFI-ETH, LINK-ETH. The idea of involving multiple strong defi communities had already been successfully used by Yam and was reused by SushiSwap. 

Once enough liquidity has been attracted to a protocol, the next step of the vampire attack is to migrate staked LP tokens to a new platform. By doing this, a new platform can use the migrated liquidity for their own automated market maker, stealing not only the liquidity but also trading volume and the users of the first platform. 

The liquidity is basically sucked out of the first platform and moved into the second platform, hence the name – vampire attack. 

When it came to Sushi, this is where Sushi’s MasterChef contract came into play. The MasterChef contract, once triggered, was able to migrate LP tokens from Uniswap to Sushiswap, basically stealing Uniswap’s liquidity. Once liquidity had been migrated it could be instantly used for trading on SushiSwap. 

To encourage liquidity providers to participate in the migration, some extra incentives were planned. First of all, the SUSHI liquidity mining program would continue after the migration but with a decreased emission (100 SUSHI per block). On top of that, people who decided to stake their SUSHI tokens instead of selling them would be getting a chunk of trading fees from SushiSwap. 

At the end of a successful vampire attack, a new protocol should in theory capture a significant amount of the original project’s liquidity, users and trading volume.

This is basically how the vampire attack was planned. In practice, there were quite a few unforeseen events happening along the way. Let’s see how the SushiSwap launch actually played out. 

Chef Nomi

SushiSwap, led by an anonymous creator ChefNomi, started attracting a lot of capital straight after the launch. Liquidity providers, attracted by high APYs of between +200-1000%, started moving more and more of their Uniswap’s LP tokens into SushiSwap. A few hours after launching, SushiSwap was reaching $150M in locked value. 

The initial problem of ChefNomi having an admin key to the migration contract was quickly resolved by transferring his admin power to a timelock contract, adding a 48-hour delay to trigger any admin functions. 

Although SushiSwap contracts were launched unaudited, the project attracted several audits from a few notable security companies. ChefNomi also decided to start governance of Sushi where SUSHI-ETH LP tokens could be used for voting. 

The yield farming craze continued. On the 1st of September, Binance announced the listing of SushiSwap and this resulted in the price of SUSHI going as high as $15. A couple of days later and we were talking about over $1B in locked value. On top of that, a couple of security audits were completed with no critical or high severity issues found. 

On the 4th of September, one of the biggest holders of SUSHI SBK, the CEO of FTX and Almeda Research, came out with a future proposal for migrating part of SushiSwap to a new trading platform Serum, built on the Solana blockchain. 

In the meantime, the community voted for an early migration from UniSwap to SushiSwap to incentivise liquidity providers with high token distribution for a few extra days after the migration. 

The next big unexpected event came from ChefNomi himself who sold his entire SUSHI stake, worth around $14M, for ETH on the 5th of September. This was possible because, although SushiSwap didn’t have a pre-mine or an initial team allocation, it had a dev fund where 10% of all the distributed tokens were allocated and which ChefNomi had access to. After the initial attempt to justify his decision as something good for the project, the community lost trust in ChefNomi who later decided to leave the project. 

This led to yet another unexpected event where ChefNomi basically transferred the control of the project to SBF, who decided to be a saviour of Sushi and provide even more incentives to the liquidity providers to stay for the migration with an extra 1 million of SUSHI tokens. On top of that, SBF initialised a transfer of the admin key to a multisig address. 

Migration

The migration of liquidity to the SushiSwap platform was carried out by SBF on the 9th of September. From the peak of $1.2B of locked value, around $840M was left for the migration. Everything went smoothly, with all of the remaining liquidity moved to SushiSwap, allowing trading of the tokens supported by the migration. 

Because of the early migration, there are still a few more days left with a high emission schedule of 1000 SUSHI per block. This will later drop to 100 per block, or even 50 per block if voted in by the community. It remains to be seen if the liquidity stays on SushiSwap after the high reward period is over.

Return of the Chef

Was that the end of unexpected events? Not really, time for yet another plot twist. On the 11th of August, 2 days after the migration, ChefNomi came back, returning $14M worth of ETH to the dev fund and apologising to the community.

Summary

SushiSwap is clearly one of the most polarising projects in the DeFi space. 

I believe that experiments like this are much needed in our nascent industry and they will strengthen the whole ecosystem and make it more resilient in the future.  

So what is your opinion on SushiSwap? Do you think it will keep some of the liquidity after the high reward period is over, becoming one of the standard AMMs in the space?

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.

]]>
https://finematics.com/vampire-attack-sushiswap-explained/feed/ 0
What are Yearn Vaults? ETH Vault Explained https://finematics.com/yearn-vaults-eth-vault-explained/?utm_source=rss&utm_medium=rss&utm_campaign=yearn-vaults-eth-vault-explained&utm_source=rss&utm_medium=rss&utm_campaign=yearn-vaults-eth-vault-explained https://finematics.com/yearn-vaults-eth-vault-explained/#respond Sat, 05 Sep 2020 11:46:57 +0000 https://finematics.com/?p=925

Introduction

So what are Yearn Vaults all about? Also, how does the ETH Vault work under the hood and how can it bring over 60% returns?  We’ll go through all of this in this article.

Yearn Vaults

Okay, one more thing before we start. If you’re new to the Yearn protocol or if you need a quick recap you can check my other article on Yearn and the YFI token here. 

Cool, let’s start with the Vaults. 

Yearn Vaults, in essence, are pools of funds with an associated strategy for maximising returns on the asset in the vault. Vault strategies are more active than just lending out coins like in the standard Yearn protocol. In fact, most vault strategies can do multiple things to maximise the returns. This can involve supplying collateral and borrowing other assets such as stable coins, providing liquidity and collecting trading fees or farming other tokens and selling them for profit. Each vault follows a strategy that is voted in by the Yearn community. 

Yearn Vaults were created as a direct response to yield farming and liquidity mining that made searching for the highest yield much more complex than just switching between different lending protocols. You can learn more about yield farming and liquidity mining here

Similarly to the standard Yearn protocol, when tokens are deposited to a vault the user receives their corresponding yTokens that can be redeemed for the underlying tokens.

One of the important rules when it comes to Vaults or Yearn protocol, in general, is the fact that you always withdraw the same asset that was initially deposited. So farmed tokens and accrued fees are sold for the main asset in the vault. The amount that is withdrawn is the initial amount that was put in, plus the pool yield that was earned, minus the fees. 

Not everything that is deposited into a vault is put in a strategy. The vaults differentiate between vault holdings and strategy holdings. Most of the funds are used by an active strategy, but there is also an idle amount that just sits in the vault.

When a user withdrawals from a vault, the funds first come from the idle portion of the vault and there is no withdrawal fee charged. If there are not enough funds in the idle portion of the vault to cover the withdrawal, the funds have to be withdrawn from the strategy which results in a 0.5% fee. 

On top of that, some profit-earning transactions will result in a 5% fee to subsidize the gas costs. For community-made strategies such as the ETH strategy, currently, 10% of this fee goes to the strategy creator. So creating new vault strategies can be a good opportunity for a skilled developer. 

Fees that don’t go to the strategy creator end up in a dedicated treasury contract. If the money in the treasury contract exceeds the $500k threshold, everything over that amount is redirected to the governance staking contract. 

There are currently multiple Yearn Vaults available such as stable coin vaults: DAI, TUSD, USDC, USDT; Curve LP vaults: y, busd, sbtc; Non-stable assets: LINK, YFI, ETH.

ETH Vault

Now, let’s have a look at the Yearn ETH Vault (yETH) to understand the concept of Vault strategies better. 

As we mentioned earlier, a strategy for each Vault is chosen by the community. We’re focusing on the current running strategy for the yETH vault that may and will most likely change over time. 

In the current strategy after a user deposits ETH into the Vault, the ETH is put into a MakerDAO lending platform as collateral. By supplying ETH collateral to MakerDAO the ETH strategy can borrow DAI at 200% collateralization ratio, creating a collateralised debt position (CDP). This means that if 100 ETH was put into the MakerDAO with $500 per ETH, the strategy could borrow up to $25,000 DAI.

Borrowed DAI is then put into the Yearn DAI Vault that uses a strategy that deposits DAI to Curve’s Y pool that is a pool with stable coins consisting of DAI, USDC, USDT and TUSD. Now, because of the current liquidity mining program of the Curve’s CRV token, providing liquidity to the Curve’s pools and locking LP tokens in the Curve Gauge result in getting rewarded with extra CRV tokens, on top of standard trading fees generated by just supplying liquidity to a pool. 

The ETH strategy then periodically sells CRV tokens for ETH and uses the accrued trading fees from the Y liquidity pool to accrue even more interest.

These steps all put together can, at the moment, result in high returns of around 60% on your ETH deposited to the yETH Vault. 

Two days after launching, the yETH Vault had already reached 370,000 ETH locked in the Vault and it became the largest CDPs on MakerDAO. Further deposits to the yETH vault were also temporarily halted to balance between best profits and best risk adjustment.

yETH Vault has a great potential of sucking in more and more ETH and becoming pretty much a black hole for ETH. This should, in theory, increase the price of ETH as more and more ETH is taken out of circulation. 

Is that 60% in the yETH Vault sustainable? Probably not, it all depends on the current liquidity mining programs available. If there are no more programs, like CURVE’s CRV one, available or rather there is no interest in the programs so the farmed tokens are not worth anything, the return on the Vault would go down, most likely to a single-digit or low double-digit APY. 

One of the most important benefits of using Vaults is automating your yield farming. 

Yield farming can be a pretty time-consuming and expensive activity, so if you’re not willing to spend hours searching for the best yield farming opportunity, spend hundreds of dollars in gas fees to move funds around and keep monitoring your collateralization ratio, it is probably better to rely on the Vaults.

Risks

This all sounds pretty cool, but let’s not forget about potential risks. 

Besides our standard DeFi risks such as smart contract bugs and stable coins losing their peg to the dollar, the ETH deposited as collateral on MakerDAO is susceptible to liquidation if the collateralization ratio falls below 150%. 

In our previous example, if the ETH price drops below $375 the collateralization ratio would drop below 150%. If this happens the ETH Vault would have 1 hour to bring the collateralization ratio back to over 150%. The reason for this is that MakerDAO’s Oracle Security Module (OSM) gives the CDP owners 1 hour to put more collateral in before being liquidated. The ETH Vault is directly integrated with this module, so it can react to changes in price ahead of time by bringing back the collateralization ratio to around 200% every time the ETH price drops.

Summary

Yearn Vaults are clearly one of the most interesting new developments in the DeFi space, but like with pretty much everything else in DeFi, before deciding to use a particular protocol always make sure to understand the associated risks. 

So what do you think about Yearn Vaults and the ETH Vault in particular? Do you think it will suck up a lot of circulating ETH causing the price to go up?

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.

]]>
https://finematics.com/yearn-vaults-eth-vault-explained/feed/ 0
Yearn Finance And YFI Token Explained https://finematics.com/yearn-finance-and-yfi-explained/?utm_source=rss&utm_medium=rss&utm_campaign=yearn-finance-and-yfi-explained&utm_source=rss&utm_medium=rss&utm_campaign=yearn-finance-and-yfi-explained https://finematics.com/yearn-finance-and-yfi-explained/#respond Mon, 31 Aug 2020 13:06:54 +0000 https://finematics.com/?p=914

Introduction

Confused about how Yearn Finance works? And what is the YFI token all about? You’ll find out all of this and more in this article.

Yearn

Okay, let’s start with what Yearn Finance is all about. 

The main element of Yearn Finance is the Yearn protocol. The Yearn protocol, in essence, is a yield optimiser that focuses on maximising DeFi capabilities by automatically switching between different lending protocols. 

Before we explain the mechanism of the protocol itself let’s see how Yearn came into existence. 

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.

Mechanics of Yearn

The protocol, in essence, 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. For example, if a 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. For instance, 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. 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. 

If a user wants to withdraw their initial DAI + accrued interest they can burn their yDAI and receive the underlying DAI. 

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. So for example, if a 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.

Further Development

After the initial version of the protocol was completed, Andre decided to open it up to more people who were also interested in automating their yield strategies. From the protocol’s perspective, adding more funds to the pool was beneficial as there were more opportunities for triggering rebalances with more deposits and withdrawals taking place. 

After the initial warm welcome by the community, Andre started working on improving the protocol itself. As the money in the pools started growing, some of the previously obvious strategies like moving coins into the highest paying lending protocol stopped working. Now, the protocol had to also anticipate what would happen to the APY if a large amount of funds are moved in, so it would have to also optimise splitting funds between different protocols and choose the most optimal solution. 

At this point, Andre also started working with Curve on the yCRV liquidity pool. yCRV pool contains the following yTokens: yDAI, yUSDC, yUSDT, yTUSD, making it easy to swap between the yTokens without unwrapping them into their underlying tokens.

By depositing stable coins to the yCRV pool, the users can earn trading fees for providing liquidity on top of getting a return on their yield-bearing yTokens.

Liquidity Mining

Up to this point, finding out what the best APY on a given stable coin was fairly easy. This changed dramatically with the introduction of liquidity mining with Compound’s COMP token distribution as a prime example. 

The COMP token distribution was also pretty much the time when all the yield farming hype started. If you need a recap on yield farming and liquidity mining, you can check out this article here

COMP farming basically changed the whole landscape of finding the best yield and checking the APY of a deposit was no longer sufficient. To find out the actual yield, you’d have to add up all the extra tokens that were being distributed. Finding the best strategies became more and more complex. 

With all the yield farming craze going on, Andre, together with the yEarn community, started working on another idea – Vaults. yEarn Vaults, in essence, are pools of funds with an associated strategy for maximising returns on the asset in the vault. Vaults strategies are more active than just lending out coins. In fact, most vault strategies can do multiple things to maximise the returns, such as farming other tokens and selling them for profit, providing liquidity or borrowing stable coins. Each vault follows a strategy that is voted in by the yEarn community. 

The full explanation of Vault’s mechanism is outside of the scope of this article, but I’ll write another one that focuses just on this super interesting topic, so make sure you subscribe to this channel to stay in the loop. 

YFI Token

Now, let’s talk about the yearn’s token – YFI.

To further decentralize the yearn protocol and allow other people to make meaningful decisions on the future of the protocol, Andre decided to distribute a governance token to the yearn community. 

The token distribution was focused on having a fair launch and rewarding the yearn community. 

To ensure a fair launch, the YFI token had no pre-mine, no VCs allocation and even no team reward. All the tokens were distributed to the users of the protocol. 

A 9-day long token distribution started with allocating 10,000 YFI tokens to the liquidity providers of the yCRV pool. The LPs had to stake their yCRV LP tokens to receive YFI rewards. Shortly after, 2 more Balancer pools were added, with 10,000 tokens each, totalling 30,000 YFI tokens. 

Regardless of a disclaimer that the YFI token has zero financial value, the money started flowing into the incentivized pools, topping $600M in locked value. Also, the YFI token itself started rapidly appreciating in value. This created additional risk as the author of the protocol was in control of the governance admin key, before the governance went live. This key could potentially be used to create more YFI tokens which would result in collapsing the price of YFI. This was quickly fixed by changing the single admin key to a multisig key, requiring multiple signers from the defi/yearn community. 

The YFI token, as designed, is extensively used in the yearn governance to decide on the future of the protocol with one of the most active and loyal communities in the whole defi space. There is also a lot of speculation on the potential future revenue from the YFI tokens that fuels the price appreciation. The YFI token increased in value from around $6 when it started trading, to over $30,000 per token less than 2 months later. Pretty much a parabolic run. 

Other Services

Although the yearn protocol, and most recently the vaults, are at the core of the yearn.finance ecosystem, there are also other services such as yswap, ytrade, yborrow and yinsure, that are outside of the scope of this video. You can look them up by checking some of the links I’ll put in the description box below.

Summary

Yearn is clearly one of the most interesting protocols in the DeFi space, but like with pretty much everything else in DeFi, before deciding to use a particular protocol always make sure to understand the associated risks. 

So what do you think about Yearn and YFI token? Did you manage to participate in their initial token distribution?

If you enjoyed reading this article you can also check out Finematics on Youtube and Twitter.

]]>
https://finematics.com/yearn-finance-and-yfi-explained/feed/ 0
What Is Yield Farming? DeFi Explained https://finematics.com/yield-farming-explained/?utm_source=rss&utm_medium=rss&utm_campaign=yield-farming-explained&utm_source=rss&utm_medium=rss&utm_campaign=yield-farming-explained https://finematics.com/yield-farming-explained/#respond Sat, 11 Jul 2020 19:04:32 +0000 https://finematics.com/?p=731

Intro

Yield Farming is now one of the hottest topics in decentralized finance and there is a high chance you may have already heard something about insane returns that some of the yield farmers are making. So what is yield farming? How did it all start? What are some of the examples of yield farming? And also what are the risks involved? We’ll be going through all of this in this article.

But before we start, if you’re new to DeFi you may want to read my introduction to decentralized finance article first.

Yield Farming

Okay, so what is yield farming actually all about?

Yield Farming, in essence, is a way of trying to maximise a rate of return on capital by leveraging different DeFi protocols.

Yield farmers try to chase the highest yield by switching between multiple different strategies. The most profitable strategies usually involve at least a few DeFi protocols like Compound, Curve, Synthetix, Uniswap or Balancer. If the strategy doesn’t work anymore or if there is a better strategy available the yield farmers move their funds around. They may, for example, move the funds between different protocols or they may swap some of their coins to other ones that are currently generating more yield. In our yield farming world, this procedure is sometimes called crop rotation.

To compare it to traditional finance, you can imagine people trying to find the best saving account with the highest APY. APY stands for annualised percentage yield and it’s a common way of comparing rates of return on your money across different products. It’s also a common way of expressing the returns of different yield farming strategies.

Speaking about APY, it’s common to see traditional saving accounts having around 0.1% APY and anything above 3% is pretty much unheard of these days. When it comes to yield farming, the returns can be pretty insane with some of the strategies bringing as much as 100% APY. So how is that possible and where is a catch?

There are 3 main elements that make such returns possible: liquidity mining, leverage and risk. Let’s cover all of them before we jump into some common strategies.

Liquidity Mining

Liquidity mining is a process of distributing tokens to the users of a protocol.

One of the first DeFi projects that introduced liquidity mining was Synthetix that started rewarding users who helped with adding liquidity to the sETH/ETH pool on Uniswap with SNX tokens.

Liquidity mining creates additional incentives for yield farmers as the token rewards are added on top of the yield that is already generated by using a certain protocol. Depending on the protocol, these incentives may be so strong that farmers may actually be willing to lose on their initial capital just to get more rewards in the distributed tokens which makes their overall strategy highly profitable.

A good example of this was the liquidity mining of COMP tokens introduced by Compound that was initially giving higher rewards to the users who were borrowing assets with the highest APY. This incentivised farmers to start borrowing these assets as the value of minted COMP tokens was compensating them for the high borrow rates they had to pay.

COMP liquidity mining got super popular and was pretty much a catalyst for a wider spread of yield farming.

Leverage

Besides liquidity mining, leverage is another element that makes ultra-high returns possible. Leverage is a strategy of using borrowed money to increase the potential return of an investment.

In our yield farming world, farmers can deposit their coins as collateral to one of the lending protocols and borrow other coins. Now they can use the borrowed coins as further collateral and borrow even more coins. By repeating the whole procedure farmers can leverage their initial capital a few times over and start generating even greater returns on their initial capital.

Risks

The last missing element of double or triple-digit APYs is the high risk that farmers are willing to take.

The first one is related to the previous thing that we just discussed – leverage. All the loans that farmers are taking are overcollateralized and supplied collateral is susceptible for liquidation if the collateralization ratio drops below a certain threshold.

Besides the liquidation risk, we have our standard smart contract risks like bugs, platform changes, admin keys and systemic risks, for example, Ether sharply losing its value. On top of that, we have a few new attack vectors specific to DeFi, for example, attacks that aim at draining certain liquidity pools.

All of these risks put together are yet another reason why yield farming returns are so lucrative. It’s a high risk, high reward game.

Farming Strategies

Yield farming strategies are sets of steps that aim at generating a high yield on the capital. These steps usually involve at least one of the following elements: lending, borrowing, supplying capital to liquidity pools or staking LP tokens. Before we look at them one by one, if you already made it this far hit the like button and don’t forget to subscribe to my channel for more DeFi content.

Lending and borrowing. A fairly simple way of getting APY on your capital. Farmers can for example supply stable coins such as DAI or USDC on one of the lending platforms and start getting a return on their capital. Liquidity mining and leverage can supercharge that. For example, farmers can get rewarded with extra COMP tokens for lending and borrowing on Compound. They can also borrow funds with their collateral to buy even more coins. This comes of course with a risk of potential liquidations.

Supplying capital to liquidity pools. Yield farmers can supply coins to one of the liquidity pools in protocols like Uniswap, Balancer or Curve and get rewarded with fees that are charged for swapping different tokens. Again, liquidity mining can supercharge this, so for example by supplying coins to certain liquidity pools, farmers are rewarded with extra tokens. Balancer is a good example of a protocol that rewards liquidity pool suppliers with extra BAL tokens increasing their APY.

Staking LP tokens. Some protocols incentivise users even further by allowing them to stake their liquidity provider or LP tokens that represent their participation in a liquidity pool. As an example, Synthetix, REN and Curve got into a partnership where users can provide wBTC, sBTC and renBTC to the Curve BTC liquidity pool and receive Curve LP tokens as a reward. These tokens can be staked on Synthetix Mintr where farmers can be further rewarded in CRV, BAL, SNX and REN tokens. Yeah I know that is getting quite complicated and we’ll write another article to explain how liquidity pools actually work.

Some of these strategies can also be combined so yield farmers can maximise their returns even further.

It’s worth keeping in mind that yield farming strategies can become obsolete very quickly by for example protocol or incentive changes and something that may be super profitable right now may not be profitable at all the next day, so it’s important to keep an eye on the running strategies and rotate crops if necessary.

Summary

I hope that now you know a little bit more about yield farming.

It’s worth remembering that yield farming is a completely new thing and it’s far from being a fully efficient market, so there is plenty of opportunities that can bring a substantially better return on our capital than what we can find in traditional finance or even centralized crypto finance. This comes of course with certain risks, some of them we may not even be aware of yet.

Although yield farming has a good potential for increasing user adoption and attracting more people to use DeFi protocols it can also make life harder for normal users who may not be interested in yield farming. For example, users may see borrow rates on Compound changing dramatically and they may not be aware of all the intricacies of different COMP token distribution strategies.

As yield farming can get quite complicated, there are some tools that facilitate calculating how profitable different strategies are, I’ll put some links in the description box below.

So what are some of your favourite yield farming strategies? And what kind of topic would you like to hear about next? Comment down below.

If you like this article don’t forget to subscribe to Finematics Youtube channel.

]]>
https://finematics.com/yield-farming-explained/feed/ 0