Our previous blog on Decentralized Finance (DeFi) covers the basics of DeFi along with some of its common use cases such as Stable Coins, Borrowing and Lending and Decentralized exchanges. It also covers the various advantages of and disadvantages of DeFi. 

DeFi is one of the fastest growing sectors in crypto. It helps in developing decentralized applications (Dapps) that are not managed by any institution, transparent to everyone around the world, global for every human being across the globe, permissionless, flexible and interoperable. At the time of writing around $7.85 billion has been locked in DeFi. You can track top DeFi tokens based on market capitalization on this site.

A commonly used term associated with DeFi is Yield Farming. This article explains what yield farming is, how it functions and the risks involved in it. 


What is Yield Farming?

Most DCX Learn readers know what Decentralized Finance (DeFi) is, but just in case you don’t; DeFi is an ecosystem of decentralized apps (Dapps) enabling anyone with an internet connection to access a variety of financial products and services spanning crypto asset exchange, margin trading, financial derivatives, synthetic assets, algorithmic trading, and lending markets. Yield farming is a new way to earn rewards using your cryptocurrency holdings on permissionless liquidity protocols. Through the use of yield farming, users can earn passive income from these decentralized ecosystems that have been built on Ethereum. While some farmers hop from one protocol to another to maximize their yields, others use the strategy of set and forget to earn yields in DeFi ecosystems.Some people simply earn tokens by lending cryptocurrencies on Compound while others participate in the more complex liquidation auctions on Maker.

Consider depositing money in a bank account. It is effectively you making a loan to the bank and the bank paying you some interest in return. Yield Farming typically involves lending ERC-20 to generate rewards which could be interest or fees coming from the DeFi platform or tokens of that protocol. The most significant impact happens when the token of that protocol appreciates in value. Farming refers to reaping high annualized percentage gains while providing liquidity to DeFi protocols. 

Yield farming is also referred to as liquidity mining and can be compared to staking but it is more complex to staking when it comes to the technicalities involved in yield farming. It is not the same as HODLing ETH tokens. In many cases, yield farming works with users called liquidity providers (LPs) who add funds to liquidity pools. But what are liquidity pools? These are smart contracts that contain funds. Anyone who adds more funds to these smart contracts adds liquidity to them  and are termed as LPs. These LPs get rewarded for doing so. 

While yield farming is currently done on Ethereum because all DeFi tokens are ERC-20 tokens, this may probably change in future. With more smart contract development platforms coming up with more features of interoperability, there is a higher chance of development of DeFi applications that will link more than one blockchain network.

But how did this begin?


The Big Bang of Yield Farming

While many say that yield farming began with the launch of COMP token for governance of Compound’s Finance system, liquidity mining was seen in Fcoin, a Chinese exchange that had created a token in 2018 to reward its traders for making trades on its platform. The reason why we don’t attribute the beginning of yield farming to Fcoin was because people started running algorithms that would do pointless trades only to earn the tokens.  

Keeping Fcoin aside, liquidity mining was first seen on Ethereum when the marketplace for synthetic tokens, Synthetic, announced SNX tokens to all the users who would add liquidity to the sETH/ETH pool on Uniswap. This soon became Uniswap’s biggest pools in October, 2019.

Irrespective of all the previous tries, the real credit of yield farming goes to COMP token. Compound’s protocol was created in such a manner that it supplied the governance tokens to its users in an algorithmic fashion. The market took off when word got out that farmers could reap 100% APY on Compound’s protocol. This acted as a liquidity incentive too as more people entered the protocol to farm the new token and add liquidity to the pool. Other DeFi tokens have followed a similar path to attract liquidity in their ecosystem.

Now another important concept needed to know about DeFi is the Total Value Locked or TVL.


Total Value Locked (TVL) in DeFi

Since most DeFi applications require lending of some sort, often as collateral or liquidity in a trading pool, the value gets locked. The Total Value Locked or TVL is a very effective metric to measure the overall health of a DeFi protocol. Clearly from the image below, the TVL in USD rose from $2 billion to $7.85 billion in a span of 2 months.  Naturally, the more value that is locked, the more will be the yield farming. We could also look at the TVL for ETH and BTC. This will give us a different perspective about the market.

One of the reasons why this value has grown is because of the increase in the price of Ethereum. One of the main reasons why the TVL value has spiked is because of the price and not because of any growth factor as such. The network also gets heavily influenced by the price of the DeFi token. At the time of writing, Uniswap has a market dominance of 18.22%, meaning one-fifth of the market is dominated by Uniswap. This could help us understand the current state of yield farming. 

While TVL tries to express the aggregate liquidity in the liquidity pool, it does not always talk about the growth of DeFi or the creation of new capital when we have observed that one user lends cryptos on one platform to get another crypto that will be lent on another platform. This must not mean that there is growth in DeFi even if TVL is increasing.

Source – DeFi Pulse

How does Yield Farming work?

Unlike modern day banking, which still requires customers to fill out forms, lenders and borrowers in DeFi do not need to do any such thing. In fact, there is no need for people to develop any trust before lending and borrowing tokens on various protocols. To begin with yield farming, we first talk about LPs who add liquidity to liquidity pools. This pool is used as a marketplace where people lend, borrow and exchange tokens. All you need is a Web 3.0 wallet and some ERC-20 tokens to get started.

Whenever someone uses these pools, they have to pay a transaction fee. This fee goes to the LPs based on their share in the liquidity pool. This is how the concept of Automated Market Maker (AMM) works.

Many protocols also encourage people to add liquidity to their pools by offering them governance tokens. While these tokens can be received through participating in such processes, they can be sold on various platforms, thus creating a market and therefore a speculation in prices. One of the main features of governance tokens is that they offer the token holders the option to vote on the protocol’s future. This creates an additional incentive for many to move to that platform. Additional features, as in the case of MKR token, include giving rights to holders to vote on changes that govern borrowing costs on Maker, how much savers can earn, and much more. 

As mentioned above, the tokens are usually ERC-20 tokens and stable coins mostly. Some of the common stable coins are DAI, USDT, USDC and others. Many times, the protocols mint tokens that represent the token you have deposited i.e. if you have deposited USDT on Compound then you will get cUSDT back. Following  the logic of depositing one token in the other, one may lend cUSDT on some other protocol to get another token for that. This chain can go on and on. Also notice that the cTokens denote Compound’s native token.

Once the tokens have been deposited, the yield farmers try to estimate the yield that can be calculated annually. People usually use two metrics to determine the returns and rewards over the year namely APR and APY. The only difference between Annual Percentage Return (APR) and Annual Percentage Yield (APY) is that APY calculates the return in a year after getting compounded  and APR does not. Here compounding means that your returns will simply get added to the liquidity pool to get more yield on them. This will go on throughout the year.

Another important factor to consider after calculating the APR or APY for the short term or the long term, is that participants in the DeFi protocol need to be very careful about their collateral. They must keep in mind that they must not play with funds that they are not willing to lose. If the collateral’s value falls in price, then there are chances that the collateral gets liquidated if the users are unable to add more of those tokens to keep the yield farming activity going on. 

Now when we have understood how yield farming works in DeFi it is necessary to think whether our funds are safe while farming and  whether there is any risk involved in the process.


Risks of Yield Farming

As we know that the market capitalization of crypto markets is very small as compared to some of the most prominent fiat currencies, cryptocurrency prices are highly volatile and there is risk involved in yield farming too. 

While the lender is always in control of their funds with everything automated and as programmed in smart contracts, smart contracts can sometimes dictate over how and when you can withdraw your collateral and you must be aware of it especially during cases of liquidation. 

Locking your funds in vaults and using smart contracts for that is not as safe as we think it is. Smart contracts are written by humans and there are chances of humans finding programming errors in the smart contracts. Take the example of the attack on DAO due to programming errors and attack vectors that led hackers to access 3.6 million ETHs worth about $50 million at the time. You must therefore go through the smart contracts before making any decisions.

Sometimes, people exploit the logic in the smart contracts to generate high returns and liquidation becomes a major threat to collateralized funds and as mentioned earlier, the fall in value of the collateral may lead to further fall in value of the loans which will create more panic in the market, more people selling the tokens and therefore leading to a removal of liquidity.

The boom of DeFi also led people to try new and untested protocols on smart contracts which led to malfunctions or loss in funds. Another major concern that has been spotted recently is that the Compound DeFi fund shows more than 1.3 billion DAI in its lending and borrowing markets, while there are around 421 million DAI coins created as of August 14, 2020. This situation resembles a debt bubble, in which cryptocurrency assets are created via the process of lending, thus circulating value that is artificially amplified by yield farmers. This situation may lead to an unstable DAI dollar peg and may affect the liquidity severely. 


Future of Yield Farming

Crypto users respond very quickly to incentives. Things in the crypto market have been happening very fast and yield farming suddenly became the talk of the town as soon as yield farming was announced on Compound. 

Yield farming has got advantages of mobilizing idle tokens and generating passive income while being risky on the same side. There are chances that you might lose your funds in case of a price crash or if the smart contract of the protocol in which you have lent your tokens gets exploited or even worse is when your collateral price falls and you do not have more funds to prevent your collateral from getting liquidated. Another issue is that DeFi is not regulated and therefore your funds are not protected in case something goes wrong. Many protocols are at a very nascent stage and more protocols are coming up in the DeFi space. Many people take advantage of this to play with the existing protocols.

Yield farming allows risk takers to get higher yields on idle lying tokens. While this may look the perfect place for you to lock in your funds, always remember that you must not lock what you cannot lose and always DYOR!

You can learn more about DeFi tokens here.