Topics Blockchain

What Is Yield Farming in DeFi and How Does It Work?

Intermediate
Blockchain
Crypto
DeFi
Glossary
web3
4 нояб. 2020 г.

In less than ten years, we’ve seen the novel crypto space reshape everything we know. Now, we're all on the verge of perceiving the rise of decentralized finance (or simply DeFi) becoming mainstream with its applications in the crypto world. With the surge of $4 billion total value locked (TVL) in DeFi, this ecosystem’s development is entirely viable. Of course, crypto is volatile, but DeFi unlocks opportunities for the public. 

The upshot? More DeFi projects are introduced to sustain and transform conventional financial products run on transparent protocols without intermediaries. That’s precisely how decentralized exchanges, insurance, lending and borrowing have given rise to the newer phenomenon of yield farming.

If you find yourself struggling to understand the fundamentals of yield farming, or to assimilate the relationship between DeFi and yield farming, here’s what you need to know. Read on to decipher what yield farming is all about, including its mechanism, applications, profitability and the underlying risks.

What Is Yield Farming?

Yield farming is a practice allowing yield farmers to earn rewards by staking ERC-20 tokens and stablecoins in exchange for supporting the DeFi ecosystem. Yield farming, also commonly known as liquidity mining, involves depositing and lending a crypto underlying a mining mechanism to support the liquidity pool for lucrative rewards.

While yield farming is comparably similar to the concept of staking, there is substantially more underlying complexity associated with this mechanism built on the Ethereum blockchain. As opposed to staking, yield farmers usually move their digital assets from one lending market to another in search of the highest yields. 

Typically, a yield farmer is required to lock their funds into a lending protocol such as Compound or MakerDAO to provide liquidity to funding pools, in which borrowers and lenders earn an incentive in the process. For example, when a yield farmer stakes 1,000 USDT in Compound, the farmer will receive a cUSDT token in return for each USDT token. These tokens can then be pumped into an automated market maker (AMM) liquidity pool that accepts cUSDT to leech off the transaction fees. In short, a yield farmer is earning incentives on Compound and the liquidity pool.

How Yield Farming Started

The emergence of the DeFi protocols Compound (COMP) and Aave is what gave rise to yield farming’s boom in the early summer of 2020. Soon after the COMP governance token issuance took off, the succeeding AMM participants in yield farming (such as Balancer, Kyber Network, Tendies and SushiSwap) further strengthened its growth and position. It was thereby making yield farming one of the most popular trends in DeFi. While it’s possible to farm using cryptocurrencies such as ETH and stablecoins like DAI, USDT is still a more acceptable token across AMM platforms. 

Of course, there are plenty of factors that contribute to the popularity of yield farming. But the main reason for yield farming popularity is that it offers a unique opportunity to earn yield on a loan. Regardless of your status, a yield farmer can find loopholes to stack yields, simultaneously earning multiple governance tokens. 

How Does Yield Farming Work?

Yield farming is never a standalone mechanism. It usually involves extensive participation of automated market makers (AMM) — the liquidity providers (LP) that add funds to the liquidity pool from time to time to uphold the ecosystem. Following the staking concept, the LP earns rewards by facilitating the transactions on a blockchain network.

Hence, liquidity providers and liquidity pools play an indispensable role in maintaining the liquidation rate. After all, liquidity tends to attract more liquidity. 

The AMM concept is direct yet intricate at the same time. Liquidity providers who provide funds into the liquidity pool enable yield farmers to lend, borrow and exchange tokens. Every transaction will incur a fee, and these fees are paid out to liquidity providers in exchange for the service. Besides the yields, new tokens will be paid out according to the unique implementation of the protocol to encourage LPs to keep funding the liquidity pool. 

It should be clear that DeFi is based on Ethereum, although stablecoins are frequently deposited as well. Stablecoins are pegged to USD. Hence, you’ll often see coins like DAI, USDT, USDC and more in the DeFi ecosystem. However, according to the individual protocol, if you’re depositing USDT into Compound instead of getting USDT, you’ll receive cUSDT. While there are no restrictions on how you circulate the coins for maximum yields, you’re obligated to follow the protocols. That means your cUSDT is continually changing, depending on the tokens that are pegged to the protocols. 

However, yield farming is still in its initial stages, so comprehending the operations for maximum yield can be complext. On top of that, yield farmers rarely disclose their strategies to the public, making it even harder for beginning investors to understand. 

Yield Farming vs. Crypto Mining

Crypto mining is based on a consensus algorithm called proof of work (PoW), while yield farming relies on the decentralized ecosystem of “money legos” built on Ethereum. Compared to crypto mining, yield farming is an innovative way to earn rewards with cryptocurrency holdings using permissionless liquidity protocols.

While both yield farming and crypto mining involve mining pools, liquidity providers are the prominent elements which differentiate yield farming from crypto mining. 

Beyond the shared, decentralized peer-to-peer network, what further differentiates yield farming is its resemblance to the borrowing and lending plan involving governance tokens to yield rewards. Furthermore, crypto mining aids the introduction of new coins into the existing supply by mining a block to hash each transaction taken from the memory pool individually.

Ultimately, yield farmers and crypto miners share the same goal of earning incentives by deploying unique strategies to maximize yields.

Yield Farming vs. Liquidity Mining

Simply stated, liquidity mining means giving liquidity to accrue tokens, while obtaining governance rights represented by the token. The curious amalgam of liquidity and mining gives rise to liquidity mining, favoring DeFi's prospects. While the dissection of liquidity involves the supply of coins or tokens, mining takes account of the PoW computation power to receive new tokens minted by the algorithm. For example, an avid investor can supply liquidity by staking in a liquidity pool like Uniswap to earn a dividend of 0.3% swap alongside newly minted tokens upon each block’s completion.

Yield farming, however, is a liquidity movement across DeFi platforms that utilizes different mechanisms, including fund leveraging and liquidity mining, to maximize returns. At the same time, yield farmers maximize their gains by moving funds from time to time with different strategies. These could range from yield farming roots to increasing liquidity for Synthetic ETH tokens (Synthetix) or using the 100% APR approach to supercharge earnings by leveraging loans to borrow tokens that yield Compound. 

Ultimately, both liquidity mining and yield farming differ, even though they're used interchangeably since they both maximize returns through earning governance tokens. 

Yield Farming vs. Staking

Yield farming allows token holders to generate passive income by locking their funds into a lending pool in return for interest. While staking involves a validator who locks up their coins, these can be randomly selected by the PoS protocol at specific intervals to create a block. 

Staking usually involves a larger amount of crypto to boost the LP's chances of being selected as the next block validator. Depending on the coin maturation, it can take up to a couple of days before staking rewards materialize. 

In contrast, yield farmers move digital assets more actively to earn new governance tokens or smaller transaction fees. Unlike stakers, yield farmers can deposit multiple coins into liquidity pools across several protocols. For example, yield farmers can deposit ETH to Compound to mint cETH, then deposit that into another protocol that mints third and fourth tokens.

Compared to staking, yield farming is more complex, and the chains can be hard to follow. Though yield farming has a higher return rate, it's also risker.

Is Yield Farming Profitable?

Anyone who invests expects a return, and yield farming is no exception. As we discussed earlier, yield farmers earn rewards by lending in the liquidity pool, but this also sparks a discussion about whether or not yield farming is profitable. 

Generally, yield farming’s returns are calculated annually. That means you can expect an average return over the span of a year. However, the profitability of yield farming is rather complicated, as it depends on the capital you deploy, the strategies you use, and of course, the liquidation risk of your collateral. 

On the bright side, since yield farming is still in its early stages, those who decide to stake their cryptocurrencies into protocols can expect significant returns. While the profitability is uncertain, some successful yield farming techniques are circulating in the crypto world with earnings as high as 100 percent. With the continuous growth of active users in DeFi, the ROI for tokens with governance rights could be a massive hit in the years ahead. 

How to Calculate Yield Farming Returns

It's hard to estimate the returns of yield farming, even for a short term period. Many factors contribute, including volatility in yield farming and relentless competition. Let’s use the demand and supply concept to justify the idea: If one yield farming strategy becomes overpopulated, then returns will naturally dwindle.  

Nevertheless, calculating the ROI of yield farming is still possible despite its limitations. Here’s an overview of the standard metrics.

Annual Percentage Rate (APR)

APR doesn't consider compounding, which means the calculation only involves the multiplication of the periodic interest rate by the number of periods within a year. The yearly return rate is imposed on borrowers but is paid to capital investors. 

Annual Percentage Yield (APY)

APY involves the return rate imposed on capital borrowers and then paid to capital providers rather than investors. Compounding interest, however, is taken into account to increase investors' returns.

Basically, the main difference between these two metrics is that APR doesn't consider compounding, while APY describes the return rate with compounded interest.

What Are the Risks of Yield Farming?

Every investment possesses some threats, and yield farming is no different. Yield farming is indeed profitable early on, but continued profit requires extensive strategic planning. In most cases, the most profitable yield farming strategy involves a highly complex process. It also requires considerable capital to deploy different investment tactics.

In fact, if you’re unaware of the risks it comes with, you’re likely to encounter the following threats:

Increased chance that collateral will be liquidated

In order to take a loan, you’ll need to collateralize some assets. Depending on the protocol, some borrowers are required to over-collateralize, mainly to allow some room for position adjustments in the market whenever there’s a sudden market crash. While some lenders require little to no collateral, this is precisely why it’s essential to take the collateral ratio into account to avoid liquidation. 

For example, you can only borrow an asset if you deposit according to the collateral ratio of 400%. Therefore, when your collateral value is $1,000, you can only borrow $250. The higher the collateral ratio, the less you can borrow. It’s best to avoid liquidation by adding more collateral from the actual asset you intend to borrow.

Loss of assets due to smart contract glitches

Yield farming relies on smart contracts to bind two anonymous parties’ farming transactions without an intermediary. This means that when there’s manipulation, or error in the central data, participants can fall victim to system failure such as leaks of financial information and the loss of funds. 

Decrease in future token value

The farmed token might grow considerably in value, but its value could plummet as well. While DeFi is hyped because of public interest, its future is uncertain. Ultimately, value drops whenever the trend dies down or there's an oversupply of tokens in the market.

Lack of assurance, since DeFi is a highly composable system

DeFi is based on the idea of composability: Each building block comprises components which can be combined differently according to user requirements. This concept is essential in eliminating third-party involvement, thereby making the protocols seamless and permissionless. The downside is that when a block experiences a malfunction, the entire ecosystem shares in the losses as well. 

Is Yield Farming Safe?

It can't be said that yield farming is entirely safe. Like everything else, investment takes time, effort and extensive research. As with any other endeavor, there's danger ahead for those who fail to appreciate the ideology behind it.

However, all this can be prevented by simply reading and understanding the terms of a smart contract. Try to be less reliant on outsourcing third parties to interpret the contract, and instead know the contract’s ins and outs so that you can detect any potential scam. However, do note that smart contracts are vulnerable to system bugs. This means that if the system fails, you risk losing staked funds or values of a token in the protocol.

While some crypto enthusiasts believe DeFi and/or yield farming possess boundless growth, volatility is still a part of it all, giving rise to speculation of another crypto bubble. Ultimately, when investing, you should weigh your financial position and your capability to go out of your comfort zone in order to reach logical decisions.

How to Yield Farm on Different Platforms

It’s clear by now that farmers earn incentives by providing liquidity to a platform. Interest and fees vary, depending on the capital growth and the strategies you deploy. The inevitable question is: Which protocols can help you diversify your yield?

1. Uniswap

As a decentralized exchange (DEX), Uniswap uses an AMM to swap two trustless cryptocurrencies into a fund pool. In exchange, the liquidity provider earns a 0.3% fee when liquidity is provided for each swap. 

2. Compound Finance

The Compound token (COMP) is granted to users who borrow and lend crypto assets with it. This approach is one of the simplest and most popular strategies. Anyone with an ETH wallet can supply assets to the COMP liquidity pool. The challenge here is to determine the token's expected value, while allocating sufficient liquidity to maximize returns. 

3. Staking Yields

The great thing about yield farming is that you can stake yields to generate more profits. Let’s say an LP receives a token minted by an algorithm: Re-staking it based on the other protocols will yield a third token.

Here’s are some of the platforms that support these protocols.

Aave

According to the algorithmic interest rates, lenders who deposit funds will receive aTokens and immediately earn compounding interest.

Balancer

Balancer adopts similar protocols like Uniswap to allow LPs to allocate funds to the pool. However, LP can disregard the fixed fund allocation on Uniswap by allocating custom funds. 

Curve

As stablecoins optimize swaps, Curve functions like Uniswap, except that it allows users to make higher-value swaps with lower slippage rates. For example, a Curve token can be staked on Synthetix to yield sETH with the underlying minted token, then redistributed to another staker. 

What to Consider Before Yield Farming

Inconsistent Gas Fee

Since yield farming is built upon Ethereum, the computation effort needed to execute a transaction or smart contract execution is inevitable. And to do so, you need Ethereum Gas.  Ultimately, the more complicated a protocol is, the more gas is required to execute a transaction.

In short, gas is used to calculate the fees to pay within the network to perform a transaction. Let’s say you intend to interact with Synthetix; you’ll need more gas to transfer any of the SNX because the protocol is more intricate than others.

Risk on Debt Pool when Staking

The debt pool represents the total value of the tokens you've funded in the platform. Taking Synthetix as an example again, when you stake by minting sUSD, you’ve already claimed a portion of the debt. 

So, if a majority of SNX holders hold sETH while ETH soars, then the debt pool will increase proportionally. That means you'll need more funds to unlock the SNX again. Let’s say you minted 1,000 sUSD, and the total circulation of Synths is at $1 million; your debt ratio is standing at 0.1%. You’ll need 1,000 sUSD to unlock your SNX, while the unlock rate doubles as the prices of Synths doubles as well.

Misleading Annual Percentage Yield (APY)

Calculating your short-term profit with APY can be misleading — and confusing. Since yields are usually based on the expected return for a year, the APY percentages in the short term aren't sustainable. Looking at a farming reward that only lasts a few days with a volatile rewarding system, APR’s actual calculation is doubtful.

What Does the Future Hold for Yield Farming? 

Since they first rolled out, DeFI and Yield Farming have shaken up the internet. With over a million active users in this ecosystem, it’s impossible to see what the future holds. Will there be newer, more value-adding and cutting-edge applications to revolutionize yield farming and DeFi in general? Only the future can tell.