Introduction - DeFi and Yield Farming
Let's talk a bit more about DeFi and Yield Farming.
What is so special about decentralized finance (DeFi) and why is everyone talking about it? Defi is basically permissionless, meaning that there is no central instance who has to allow and process contracts between participants in the market. That means the system is trustless and allows for efficient and quick algorithms to run on its platform. These algorithms, called 'smart contracts', govern the relation between two market participants in the space.
One of the new concepts that has come up with these smart contracts is 'yield farming'. It allows everyone to use their cryptocurrencies to earn passive income on the decentralized Ethereum system. So how does yield farming work?
What is Yield Farming?
Yield farming, also called liquidity mining is a way to earn rewards using cryptocurrencies. Basically, it works by locking up your crypto to earn rewards. In some sense, it works a bit like staking, but with higher complexity in the background.
So what is a liquidity pool? Basically, this is a smart contract containing money - liquidity. For providing liquidity to the pool, users earn rewards. This can for example be fees generated by the underlying DeFi platform or other sources.
Some pools provide rewards consisting of several tokens. These tokens can then be used in other liquidity pools to earn additional rewards and so on. .
Yield farming usually happens with ERC-20 tokens on the Ethereum network and rewards are usually also ERC-20 tokens. However, there are also new networks that support yield farming, see my article on Cardano [ADA]. Furthermore, cross-chain-bridges can lead to Defi Apps working across several platforms, ignorant of the underlying blockchain.
Yield farmer usually move their assets quite frequently between different platforms. Platforms try to hold their users by providing additional rewards.You can see how this might become quite complex quite quickly
Usually the origins of yield farming are traced back to the creation of the COMP governance token. This governance token of the COMPOUND ecosystem grant the holders governance rights within the network. COMP has contributed substantially to the boom.
So how does it work?
Yield farming is wedded to the concept of automated market makers (AMM). Liquidity provider pay into a liquidity pool. Using this pool amarket place is run, where users can lend, borrow or swap tokens and pay fees for using the platform. These fees are then split between the providers according to their holdings. This is the basis for AMMs and yield farming.
However, implementations can differ a lot. Other incentives for providers can be the provision of a new token; this might even be an exclusive token for liquidity providers for a certain period. Distribution also depends on the protocol. Provided tokens are usually stablecoins which are pegged to the US Dollar. Some of the most common are DAI, USDT, USDC, BUSD and others. Some protocols mint their own representations of stablecoins. So you would receive cDAI in COMPOUND.
How do we measure it?
Total Value Locked
So how do we measure the current state of the DeFi yield farming scene? Usually this is done via total value locked (TVL). As the name suggests, this measures how much crypto is locked in lending activities and other markets. TVL is more or less the complete liquidity in liquidity pools. It is an useful indicator to measure the health of the DeFi space. A good space to follow TVL is Defi Pulse [Defipulse]. The more liquidity is locked, the more yield farming is possible.
How do we calculate yields?
So you can see how this might turn fairly complicated fairly quickly. So how do we calculate yield here? Usually this is done on a annual basis, some common indicators are percentage yield (APY) or annual percentage return (APR). APR does not include compound interest. These yields are always projections and estimates. Yield farming is quite competitive and yields can vary substantially. Once a substantial number of people moves into a strategy, it might become unsustainable.
Risks of Yield Farming
Yield farming is not easy. The most profitable strategies are quite complex, you should be an advanced user to use them. Also, the more capital you have, the better these strategies will work. So what risks do you have to be aware of?
First of all: smart contracts. They are made by humans meaning they might have mistakes in them. Some smart contracts are being written by small teams with small budgets. This can pose a risk. Even the big players are not immune to that risk.
One of the biggest strengths of Defi is also its biggest risk: composability. Defi protocols are trustless and can interact with each other. If one of the building blocks fails, this can have potentially catastrophic consequences for the whole System.
If you borrow money, you usually have to come up with collateral. How does this work in Defi? This usually depends on the protocol. If the value (beware the bear) of your collateral falls under a certain threshold, you can get liquidated easily. You must redeposit more collateral to stay in the game.
Just to make sure: each platform will have its own rules, so make sure to check them. Many platforms work with over-collateralization, meaning people put more collateral in than they get out in loans. Let's say, you want to borrow 100 USD. With a 200% over collateralization, you will need to put in 200 USD. Many platforms use high collateralization rates to make their platforms more secure.
Platforms and Protocols
Compound is an automated market maker allowing users to lend and borrow assets. Everybody with an Ethereum Wallet can deposit assets in the liquidity pool of Compound and earn rewards. Rates are usually algorithmically adapted to supply and demand. Compound is one of the
Maker is a decentralized credit platform. It also create DAI, a stablecoin which is pegged to the USD. Everybody can open a Maker Vault and deposit tokens like ETH, BAT, USDC or WBTC. These deposits can be used as collateral to borrow DAI. The interest on this loans is called a stability fee.
Synthetix is a synthetic asset protocol. It allows everyone to stake Synthetix Network Token (SNX) or ETH as collateral and generate synthetic assets in return. Nearly everything with a price feed can be an asset. This makes nearly every asset eligible for being on Synthetix. In the future, nearly all assets could be theoretically used to generate returns. Want to use your gold in yield farming? Synthetix has you covered.
Aave is a decentralized protocol for lending and borrowing. Interest is being calculated algorithmically depending on market conditions. Lenders receive 'aTokens' as reward. These tokens compound interest immediatly. Aave also allows for 'slash loans'.
Uniswap is a decentralized exchange (DEX) protocol allowing users to swap tokens trustlessly. Liquidity providers deposit a value of two tokens to create a market. Trader can then trade against this liquidity pool. THe providers then get a fee out of the trades being done in relation to the size of their provision to the pool. Uniswap has had great success due to its frictionless exchange.
Curve is a DEX specifically created for efficient stablecoin swaps. In comparison to other protocols this allows users to trade stablecoins with relatively low slippage. This infrastructure of stablecoins is an important factor in many yield farming strategies.
Balancer is a DEX similar to uniswap and curve. The main difference being that it allows for user-defined token distribution in a liquidity pool. This allows liquidity providers to created individual balance-pools instead of the mandatory 50/50 distribution. LPs earn rewards for trades done on their pools, same as in uniswap. Considering the flexibility in creating liquidity pools, balancer is an important addition to yield farming strategies.
yearn.finance is a decentralized ecosystem of aggregators for credit platforms like aave, compound and other. It aims at optimizing the token lending operations by algorithmically finding the most profitable lending platforms. Funds are being morphed into yToken when providing them to the platform. yearn.finance is useful for farmer wanting to automate their strategies.
We have gained a glimpse into an exciting field in crypto: yield farming. What will the future bring? Defi and trustless protocols are a real innovation in fiannce, crypto and informatics. Defi can potentially contribute to a more open and inclusive financial system. However, at the moment they still require a lot of technical knowledge and background. The more they are adopted, the easier they will hopefully become.