Yield farming is a set of strategies to maximize returned yield (APY) from multiple aggregated protocols that usually are stacked on one another and compounded. In this blog post we’ll walk you through how yield farming works, its protocols and platforms, and some of the risks involved in using it.
But let's start from the basics
Before we delve into yield farming, let's start from a top level overview of how decentralised exchanges (or DEXs) work and the role that Liquidity Pools play.
DEXs
DEXs are essentially peer-to-peer marketplaces connecting all the people involved in buying and selling currencies. They are non-custodial in their nature, meaning that as a user, you always remain in control of your private keys when you’re transacting.
Liquidity Pools
Liquidity pools are one of the main pieces of technology involved in the DeFi ecosystem. They form the backbone of many DEXs. Users known as liquidity providers (LPs) add an equal value of two tokens in a pool to create a market. In exchange for providing their funds, they earn trading fees from the trades that happen in their pool. These are proportional to their share of the total liquidity.
» We are 10Clouds: Introducing the DeFi Developer Roadmap
Liquidity Staking is the process of staking the liquidity you add to a pool (either ETH pool or USDT pool) and earning rewards in return.
Its worth noting that there are some DEXs specifically designed for swapping:
- Uniswap gives the users the privilege to handle trustless swapping of tokens making it possible to perform automated transactions. It also allows LPs the possibility to deposit multiple tokens of similar values. Its frictionless nature makes it even more popular in yielding strategies.
- Curve Finance is a protocol allowing stablecoins high-value swaps and fast and efficient trade between pairs.
Lend vs Borrow APYs
Decentralised Finance (DeFi) lending lets users become lenders or borrowers in a completely decentralized and permissionless way. At the same time, they are able to keep full custody over their coins.
This form of lending is based on smart contracts which run on open blockchains. The two main lending protocols available are Aave and Compound, both of which work by creating money markets for tokens such as ETH, LINK, wrapped BTC and others.
- Compound Finance is an algorithmic market that allows users to lend and borrow assets that accumulate compound interests.
- Aave allows algorithmic adjustments of interest rates in accordance with the market state.
- MakerDAO is a lending platform on the Ethereum blockchain supporting the creation of a stablecoin called DAI. Users can also borrow against collateral.
If you’re looking to become a lender, you should use your tokens in a specific money market and you can receive interest on it right away in accordance with the current supply APY. The tokens that you’ve supplied will then become available for other users to borrow.
So where does Yield Farming come in?
Yield Farming It is an entirely different concept from staking deferred by the annual percentage yield (APY) and the lock-up period. In simple terms, a crypto trader deposits or locks their funds in a decentralized finance protocol and earns returns or rewards from their investments. The users can move their gains or tokens to other liquidity pools for more rewards, and the cycle continues. The farmers may deposit their funds in various lending markets in a hunt for high returns. It is an excellent way of earning passive income.
How Yield Farming Works
Liquidity providers deposit their funds in a DeFi protocol to create a pool of funds with the sole purpose of earning high returns with minimum risks. However, high rewards come with more significant risks. To gain more crypto from the coins deposited by the yield farmer, users can exchange tokens or borrow crypto from the smart contract. The borrowers of digital assets are required to put up collateral to act as insurance for the loan. The collateral value has to be within a certain threshold for different platforms to consider the user's creditworthiness before they can lend them the assets. The collateral ratio is different for other lending protocols depending on their rules. However, the borrower has to deposit more collateral for liquidity than they can borrow to reduce liquidation risk. Using the yield farming platforms also incurs a certain fee. These fees charged are rewarded to the yield farmers in accordance with their shares in the pool. Read our article on flash loans to get additional insight.
However, the fees are not the only way to go about accumulating funds to the DeFi pool. Provision of liquidity to a particular pool works fairly and allows new tokens to be distributed within the marketplace. The LPs earn from the amount of liquidity they offer to that pool. Therefore, how yield farming works can be paralleled to the automated market maker (AMM).
Farming Protocols and Platforms
The basic idea of yield farming is to place crypto assets into smart contracts for liquidation and gain returns as a result. So how does the farmer achieve this? Obviously, by tending his crops. And how can he manage to do this? The farmers need protocols that enable them to be in control of their funds.
YearnFinance
Yearn.finance (which runs on Mainnet), for instance, targets finding lending services with far more profitability in a bid to optimize lending of tokens. The Yearn protocols ensure users’ ease of participating in investment strategies. It achieves this by allowing the users to place tokens on to Yearn.finance platform. It does this by converting the funds deposited into yTokens. Some of the most common protocols include Compound finance, MakerDAO, Synthetix, Aave, Uniswap, Curve Finance, and many more. Yearn.finance is the aggregator for these lending services.
Autofarm
Autofarm is a decentralized finance cross-chain yield aggregator running on BSC. It allows users to earn from their digital assets invested in yielding farms. The Autofarm ecosystem consists of the yield optimizer, AutoSwap, and farmfolio. Autofarm aggregates the best yield optimizer when users want to stake in autofarm vaults. Like the yVaults in Yearn, the vaults come up with the most optimal strategy that would most likely maximize returns while minimizing the costs. To find the best swap rates and prices, AutoSwap implements the optimization routes for the trades. For users to manage, control and track their assets, they use the farmfolio, which is basically a portfolio manager.
Yield Farming Risks
Yield farming is highly complex, and of course - risky. To gain, one has to be prepared to lose at some point. Some of the possible risks in yield farming include:
1. Liquidation Risk
This occurs when the user’s collateral is insufficient to be rendered a loan. As earlier stated, the user has to deposit more collateral than the amount they intend to borrow. To be on the safer side, the users are advised to deposit less volatile assets for collateral in case of fluctuations that might result in a user liquidation penalty.
2. Smart Contract Risk
Bugs due to the developers overlooking an error in the system may affect the smart contracts by giving cybercriminals loopholes into the system. A break-in into the system may cause users to lose their funds from the liquidity pool if they steal the funds. Therefore, it is reasonable to perform an audit of the smart contract for safety and minimize smart contract risk.
3. Impermanent Loss
Impermanent loss occurs when the market takes a sharp move and users lose their investments. The only viable solution is to pick protocols that mitigate this risk.
4. Composability Risk
The DeFi protocols are known to work together seamlessly, implying their dependability. Imagine if one of the building blocks malfunctions. Tragic. The whole ecosystem suffers if its building blocks does not work as it should. This poses one of the most significant risks to yield farmers.
Bottom Line
Yield farming is a new technology that is quickly gaining popularity. This embrace seems to be motivated by the prospects of high rewards gained passively. However, with its evolution still underway, it is nearly impossible to predict accurate prospects. For instance, cross-chain bridges may enable interoperability to yield farmers to move their funds around with much ease between protocols. Therefore, any yield farmer or an enthusiast should not be scared to take a risk at it. With yield farming on the rise, DeFi protocol is creating a breakthrough in accessibility and transparency in the financial systems and forever changing the approach on trustless liquidity and computer science. In summary, yield farming is the wild west of DeFi.
Are you looking for expert advice about blockchain implementation at your company?
Get in touch with me for a free blockchain consultation. You can contact me on dennis.vandervecht@10clouds.com or call me on +48 793 200 141.