DeFi: Exploring the Ecosystem around Yield Farming

Breaking down components fuelling yield farming and the rapidly growing DeFi space

DeFi: Ethereum’s emerging flagship use case

The terms decentralised finance and yield farming have been aggressively thrown around social media and the Cryptocurrency press as of late in an attempt to capitalise on the buzz and interest of the community. These terms encompass a range of protocols that have launched on the Ethereum mainnet, in the form of smart contracts, that allow token holders to take part in various activities in an attempt to generate more tokens and increase their holdings. One can think of these smart contracts as financial instruments that token holders can take part in, and generate rewards in return.

These financial instruments have become quite sophisticated — they provide a level of automation and ability to move assets around protocols based on which protocol can offer the best returns. The most popular suite of tools to do this currently is with Yearn Finance, a relatively new library of smart contracts that aim to maximise the profit of token holders by automatically moving their tokens around protocols to generate the most revenue possible.

One can think of Yearn Finance as a DeFi orchestrator. It’s value proposition lies in its ability to leverage the growing DeFi ecosystem on Ethereum and automatically convert, split, distribute and deposit tokens in order to generate commissions and rewards in the form of liquidity commissions and governance token mining. These concepts and more will be covered throughout this piece to provide the reader a well-rounded overview of what yield farming is, and some of the popular protocols hosted by Ethereum to make it happen.

By the end of this article, it should be clear to the reader how Yearn Finance leverages DeFi protocols to increase a token holder’s yield on their returns, as well as its relevance in the DeFi space.

The Underlying DeFi Value Propositions

Before jumping into specific protocols, it is important to understand how a token holder can increase the yield of their tokens. Here are the main methods of doing so today.

Providing liquidity to decentralised exchanges

One way to generate a passive token income is by providing liquidity to decentralised exchanges for particular token pairs (such as WBTCETH), whereby the depositor provides the equivalent value of both tokens in that particular pool, and will receive a share of the pool’s exchange fee that is charged with each token swap.

Trading fees vary between exchanges; as examples, Uniswap’s free is currently 0.3%, whereas Aave charges 0.10–0.20% in trade value.

To learn more about Uniswap, check out my piece outlining the exchange’s inner workings: Uniswap V2: Everything New with the Decentralised Exchange.

The decentralised exchange liquidity pool model

Providing liquidity can now be done with protools ranging from Aave, Compound, Curve Finance and Uniswap. Each come with their own token pools, strengths and drawbacks. Pool size and demand fluctuate over time, making it hard to project how much you will earn over the medium to long term.

This is a problem that Yearn Finance is attempting to solve, to an extent, by ensuring that a token holder’s funds are always distributed to pools that reward the highest value.

Staking liquidity tokens / UNI use case

Upon providing liquidity, decentralised exchanges in-turn provide you “LP Tokens”, or liquidity tokens, to prove that you own that stake within the pool. Protocols are now allowing these tokens to be staked (deposited into another smart contract) in exchange for more tokens, often in the form of the governance token of the protocol in question.

LP tokens are simply another ERC20 token received in exchange for depositing tokens into a liquidity pool. These tokens prove your share in the pool, and are needed to withdraw your tokens from the pool. But it has become common practice for LP tokens to also be deposited into other pools, mainly as a way to distribute governance tokens.

A good use case for staking LP tokens is that of distributing a particular protocol’s governance token. A great example of this is with Uniswap, where they launched a governance token in the form of the UNI token designed to be used for voting on potential governance proposals to improve the platform.

As a way to distribute the token, the Uniswap devs set aside 5,000,000 tokens for a select few liquidity pools (5 million tokens per pool), whereby users can stake their LP tokens (deposit those tokens into another pool for generating UNI) in order to generate UNI tokens over a period of time, adhering to the following model:

Staking LP Tokens to generate the UNI governance token

This in-turn incentivised users to deposit funds into those supported pools in order to receive UNI. This not only raised Uniswap to the top of DeFi in terms of value locked (and thus increased adoption), it has also solved the problem of how to fairly distribute minted UNI to parties that actually participate in the protocol.

The mechanism of generating governance or utility tokens by staking LP tokens is termed liquidity mining. The UNI page of Uniswap currently lists the available pools taking part in the UNI liquidity mining distribution:

The participating Uniswap liquidity pools for UNI mining.

Such opportunities allow token holders to boost their holdings with little risk, but as in the case with the UNI token, it is only available to be mined for 2 months — with the process starting on September 17th 2020. Not only this, but the share of tokens distributed to each participant is based on the value of your share relative to the whole pool. In other words, as more people take part in the mining process, your share of funds will go down.

So in order to be successful in liquidity mining, understand that:

  • There will always be a first-mover advantage. The fewer participants in a pool, the larger your share.
  • Opportunities will come and go. The distribution purpose of liquidity mining happens when a new governance token launches, and the process of which could only last days or weeks. Keep up to date with the field and prospective governance token launches so you’re prepared to leverage such opportunities as they arise. (and no, Yearn Finance will not monitor these opportunities for you — its strategies are limited to known smart contracts and their corresponding addresses hard coded into a particular strategy).
  • There will undoubtedly be many tokens adopting such a distribution method, some of which will have flawed business models and valueless tokens. Understand that depositing your tokens in such a pool will render them useless to others — consider the opportunity costs of participating in liquidity pools.

Generating governance tokens / Curve Finance use case

The third underlying DeFi value proposition we’ll cover here is generating governance tokens over time, that is often done by participating in a particular protocol.

Unlike an initial token distribution, governance token generation is a stable and long-term mechanism to reward users for using the protocol over the long term. An increased holding of governance tokens will then give the holder more voting power when improvement proposals arise.

The ability to change a protocol should be the main value proposition of governance tokens, giving the user-base the power to shape or evolve the protocol in question. Governance tokens, like any other Crypto Currency, are subject to pump-and-dump schemes and radical market movements in extreme bullish or bearish sentiments.

A good example of generating governance tokens is that of Curve Finance, a decentralised exchange that focuses on trading stablecoins and wrapped Bitcoin. Here is the Curve home page, where users can exchange a range of stablecoins from the get-go:

The curve.fi home page UI that mimics a dated terminal application.

The UI of Curve is rather bizarre and not too user friendly, mimicking a dated operating system GUI. As we’ll cover further down, there are alternative front-end apps available to interact with the protocol.

The governance token of Curve Finance is CRV, and is rewarded to users that take part in Curve’s liquidity pools. This is done similarly to how the UNI distribution was done, but with no time limit this time.

The next section will dive more into Curve liquidity pools and how they operate.

The story does not stop here with generating CRV — there is another mechanism in place to generate more CRV with your current holdings — a mechanism called vote locking. Vote locking, as the name suggests, involves sending your CRV to a smart contract for a certain amount of time (this could be a period of months or years), where it will be locked up until the time period is over.

Curve’s DAO page is where vote locking and other governance mechanisms can be interacted with. Tokens can be locked for up to 4 years using the provided GUI. Curve have stated that vote locking can multiply your CRV rewards by ~2.5x, making it a tempting proposition to give your LP tokens a yield boost.

CRV vote locking risks

Before you lock up CRV, assess the following considerations to ensure you commit to a strong position:

  • Do you have enough LP tokens in your wallet to make the commitment worth your while? The more LP tokens you have staked, the more CRV you will be rewarded.
  • Weigh up the opportunity cost of locking the CRV. In that time period there could be major price movements, with selling opportunities in-particularly being missed.
  • Do you believe in the long term prospects of the protocol? You’re ultimate goal is to increase your CRV governance token holdings, with the derived value pertaining to the ability to shape the protocol in future improvement proposals. Don’t lock value into protocols that you do not understand or those that do not have a clear roadmap or market need.

Beyond the CRV token, Curve Finance is a great protocol to study to understand other concepts and mechanisms used in DeFi. The next section will visit how Curve pools work, how one can back a range of tokens in a particular pool, and how we can leverage “wrapped tokens” to increase yields.

Curve Finance Pools

Curve hosts a number of pools that consist of multiple assets, either in the form of stablecoins or wrapped Bitcoin. The Y Pool for example contains DAI, USDC, USDT and TUSD stablecoins, and users can deposit any of those tokens into the pool, either in a balanced proportion or disproportionately. There are two stand-out properties that have made Curve pools popular in DeFi:

  • Low fees for traders: Very low fees for exchanging one stablecoin into another, some of which rival centralised exchanges, and are much less than competitors such as Uniswap.
  • High APYs for liquidity providers: Not only do liquidity providers receive commissions via the small fees the protocol charge for exchanging tokens, liquidity is also supplied to lending protocols (such as Compound in Curve’s C Pool) so providers gain even more rewards.

In the case of the C Pool, the amount of liquidity sent to Compound is automatically managed by Curve’s smart contracts. The thinking behind this is to maximise your yield when the Curve pool is experiencing low volumes — it makes sense to delegate some liquidity to more active protocols to maximise your returns.

The Y Pool takes this concept one step further

Now consider the scenario where Compound is also experiencing low borrowing activity and APYs are low — sending liquidity to inactive protocols will not yield much of a return.

This is the problem the Y Pool attempts to solve, by automatically sending liquidity to the lending protocol that offers the biggest returns. The Y Pool relies on Yearn Finance’s “yTokens”: wrapped tokens that Yearn’s smart contracts can then move and exchange to other assets, depending on the targeted lending protocol. The Y Pool in fact considers Compound, Dydx and Aave as the lending protocols to provide liquidity to.

Curve’s C Pool (or Compound pool) mentioned earlier also relies on wrapped tokens, denoted by cTokens. DAI wrapped as a Compound cToken will be cDAI.

This is where the UX of Curve can make things more confusing — visiting their Y Pool page represents each currency as a native token:

Curve’s interface for depositing stablecoins into the Y Pool.

But once deposited, these tokens will be converted into yTokens, before being further exchanged and distributed to the targeted lending protocol.

Notice the “Deposit wrapped” option in the above screenshot — this allows the token holder to deposit ready-wrapped yTokens, thus skipping the conversion process from native tokens and saving gas fees.

How wrapped tokens are exchanged

At this stage one may wonder how wrapped tokens maintain their value to the native token, and how they are exchanged. For example, how would a yUSDC token be converted into DAI and then supplied on a lending protocol such as Aave? The answer lies once again in decentralised exchanges and liquidity pools. Concretely, a pool can be set up for any ERC20 token, including wrapped tokens. It is these pools that allow wrapped tokens to be exchanged and their value to be maintained by arbitrage trading.

Decentralised exchanges rely on arbitrage trading to keep token prices balanced relative to market demand. This is a fundamental concept in keeping a DEX token price inline with the overall market price of a token.

Furthermore, smart contracts communicate with DEX protocols on the user’s behalf, removing the need for humans to interact with front-end portals. Understanding this is key in understanding how platforms like Yearn Finance automatically move and exchange assets on your behalf.

A particularly useful exchange for making token swaps we’ll mention here is 1inch Exchange. 1inch Exchange aggregates the popular DEX protocols and discovers which offers the cheapest fees for a particular token swap. Here is their home page at the time of writing and the supported exchanges to spread your trade over:

1inch Exchange homepage interface.

1inch Exchange is a good reference to discover other DEX protocols. Mooniswap and Sushi Swap for example are forks of Uniswap, but have their own liquidity pools and rates within their independent smart contracts. Therefore, there is a possibility that one of these forked exchanges have better rates than the original.

To summarise this section:

  • Wrapped tokens are heavily used in DeFi to manage assets.
  • Wrapped tokens rely on liquidity pools to their native counterparts to maintain their value.
  • Curve Finance leverages liquidity pools, but also delegates liquidity to other lending protocols to maximise a lender’s yield.
  • To expand on the above point further, Curve’s Y Pool further optimises this process by automatically choosing the most profitable lending protocol.

A note on Token Lists

To accommodate the vast amount of tokens being added to the Ethereum ecosystem, Token Lists have been created to curate lists of Tokens for particular needs, such as the mostly traded tokens, or Lists tied to a particular protocol or yield strategy. Check out Token Sets here.

The last section of this piece will explore a few more tools in relation to Yearn Finance and its products.

Yearn Finance and Yield Strategies

The level of sophistication and inventiveness that the Yearn Finance creator, Andre Cronje, has demonstrated is mostly unmatched within the space. Community adoption of the protocol is high (as is reflected in the YFI token price, that has been capped at 30,000 unless a Yearn improvement proposal, also known as a YIP, is approved by token holders).

Yearn Finance aggregates quite a few protocols in Ethereum’s DeFi space to form the “strategies” of their vault products. A “Vault” is a program in the form of smart contracts, designed to leverage particular DeFi protocols and automatically move assets between them to maximise returns, much like we have discussed throughout this piece. Each of Yearn’s Vaults have a different strategy.

As an example, the yETH vault, designed to yield ETH over time, has the following strategy:

  • You deposit ETH or WETH (wrapped Ethereum) which is then exchanged into yETH or yWETH and added to a vault (aka, pool).
  • The vault then takes your ETH and puts it in a Maker DAO vault — a vault that combines every deposit from the yETH contract. DAI is then borrowed from this vault with the deposited ETH as collateral.
  • This DAI is then deposited into the Curve Y Pool in order to generate CRV (Curve’s governance token we covered earlier) plus exchange fees.
  • The generated CRV and exchange fees are then exchanged back into ETH, which is the final form of your reward.

It is important to note that the yETH vault contract maintains a 200% collatoralization ratio on Maker. By knowing what the ratio will be in the next hour, the smart contract can rebalance the vault to ensure there will not be a liquidation. If the ETH price falls, DAI will be paid back in the vault. If ETH increases in value, more DAI will be drawn from the vault.

This may sound complex on the first read — and it is. This is just one strategy Yearn Finance offer. It is encouraged to read the Yearn Docs to find out more about the inner workings of their products.

As you can probably sense by now, yield farming is simply stacking DeFi products together to yield as much of their reward mechanisms as possible.

Yearn’s offering is constantly evolving, so it is likely that the reader will discover new products on their website that are not mentioned in this piece. What this piece aims to do however is to introduce the concepts and mechanics of how yield is generated, shedding some light on the heavily used Yield Farming terminology.

Yearn’s YFI token — that has dramatically increased in value since its inception — also acts as both a governance and utility token for Yearn’s products. YFI can only be generated by using Yearn products.

Interact with Yearn Finance from Zapper.fi

One of the easiest ways to get started with Yearn Finance is via Zapper, at Zapper.fi. Zapper creates easy-to-use front-end portals to interact with smart contracts — even Curve Finance’s pools we discussed earlier.

Zapper aggregates exchanges, lending protocols and investment vehicles like Yearn Finance’s Vault products and integrates them all in one portal. The dashboard page displays every protocol you have invested in, your total assets, and net worth, as the following screenshot illustrates:

The Zapper dashboard displaying your net worth and where assets have been allocated.

In order to make a deposit into a liquidity pool, such as Curve’s Y Pool, simply click the Invest tab and find the pool listed. It is worth familiarising yourself with all the investment opportunities listed on the platform, some of which we have discussed here.

It is becoming more common for on-chain developers to leave front-end web apps to Zapper and others focused on the front-end. Smart contracts are public, and thus can be accessed by any web app. You are not limited to the front-end website that the official protocol team provide to you — perhaps a good thing in the case of Curve!

In Summary

This piece by no means covers the entire DeFi space (and more articles pertaining to DeFi will surely be plugged here as the space evolves), but we have covered the major concepts and some of the components behind the inner workings of yield farming.

We’ve covered how tokens can be generated and the reward mechanisms behind providing liquidity to pools. We’ve also covered how Curve Finance and Yearn Finance work together, and some useful tools such as 1Inch Exchange and Zapper to facilitate this activity.

Be sure to check out DeFi Pulse to view the most popular DeFi protocols based on total value locked. The website offers good metrics and overviews for a range of protocols, a lot of which have not been discussed in this piece.

Main bottleneck of DeFi adoption: gas fees

DeFi is evolving quickly, and there will most certainly be many more products added to the space in the months ahead. At the time of writing Ethereum gas fees have seen the highest prices in its history, making a lot of the tools discussed here unprofitable for trading small amounts of tokens.

Although network congestion is likely to continue to be an issue in the short term, they are a primary focus for the core developers of Ethereum clients right now. Until Ethereum 2.0 launches with sharding capabilities, it is likely that gas fees will continue to be high.

Keep an eye on the Ethereum Gas Tracker if you aim to set up a position, such as depositing funds into a liquidity pool. If you would like to leverage Yearn’s Vault products, keep in mind that every asset exchange, movement and withdrawal will require gas fees, that will eat away at any rewards you aggregate — this is the main bottleneck of DeFi.

Programmer and Author. Director @ JKRBInvestments.com. Creator of LearnChineseGrammar.com for iOS.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store