(DRAFT February 4, 2021)
PDF copy: I rushed this out in two hours for some friends, and will fix formatting and grammar errors later.
Updated 2/18/2021: added link to Acryptos and pancake bunny. What a wild month for Binance Smart Chain... please also see the other article: BSC Farms and Yield Optimizers.
Updated 2/21/2021: added Matic Network - The New Frontier.
Disclaimer
Defi, yield farming and liquidity mining are the most risky ways to “invest” because one can lose 100% overnight for all types of reasons described below. This article provides an introduction to the combination of the three topics, and is not a financial advice in any kind. As the top rule of cryptocurrency, one should only put in money that they can afford to throw away.
There does not seem to be any regulation that prohibits U.S. citizens from buying cryptocurrencies. However, operating a defi project may be illegal in the U.S., so some defi sites establish geofences to exclude U.S. customers. Almost all defi developers are anonymous for tax and regulation concerns.
Why do we want to know those risky topics? On January 30, 2021, one pair of liquidity mining on beefy.finance reached 190 billion APY before dropping to 200M. On February 4, 2021, we begin to see APY measured in Q and P. That clearly will not last, but it surely ignites the curiosity to check out what has happened.
Introduction
Defi stands for decentralized finance and has many subtypes, such as exchange, lending, insurance, or gambling, etc. Taking the defi exchange for example: unlike a centralized exchange (CEX) such as New York Stock Exchange that is operated and controlled by a business entity, defi exchanges (DEXs) are governed by smart contracts. Once a developer puts smart contracts online, everyone can examine the code and interact with the contract in a predictable way. If the developer does not change the contract, the contract will faithfully carry out the intended tasks, without the needs for customers to submit identification, open account, fund the account, exchange funds, or withdraw money.
Think about a machine with only Apple stock and U.S. dollars: every time we send some Apple stock to the machine (the contract address), the machine returns some U.S. dollars based on published algorithms, and vice versa. The machine does not have unpredictable behaviors such as restricting your sell order to one share per day.
Yield farming is a like a bank deposit to earn interest. When a new defi project starts, it gives out their free tokens to incentivize users to examine their project and use their platform, just like UberEats sending out 20 off 25 coupons. To earn those tokens, the project may require us to temporarily send some types of cryptocurrencies, such as ETH, or a common liquidity pairs like ETH/USDT to a contract. This practice is called “staking.” The project then calculates the amount of staked currencies and the length of staking, and provides their free tokens for claiming. Typically a user needs to pay transaction fee to “harvest” from those sites known as “farms.” Those free tokens can then be sold on the open market. Yield farming typically has a relative low APY, but sometimes can reach 1,000% to 3,000% if one joins the project in an early stage.
But where do we sell those tokens and why would people want to buy from us? Then it comes the liquidity mining. Providing liquidity is to build the machine of Apple to USD in the example above. To provide liquidity, a new user must submit equal dollar amounts of a common currency, such as ETH or USDT, and the new token to a DEX to the liquidity pool on a DEX. The user then stakes the DEX’s liquidity provider (LP) token (LP token) on the project website, and receives interest in the form of the new token over time. If everyone buys from the LP, your LP token value will increase, when measured in USD. If everyone sells to the LP, your LP token value will decline.
Those new tokens are minted at the cost of zero, but may have some economic reasons to support some kind of valuation.
Liquidity Mining APY, Compounding, and Transaction Fee
Liquidity mining is the core of any defi projects, because those projects are typically not listed in any CEX and users must go to DEX liquidity pool to buy and sell. Therefore liquidity mining of new tokens must have a high APY to attract traders to provide liquidity, usually ranging from 1% daily to 6% daily.
Without compounding, 1% daily equals to 365% profit over a year, ignoring the possibility that the LP token may decline in value (discussed separately below). With compounding, 1% daily would yield 101%^365-1 = 3,678%. At 6% compounded hourly or more frequently, we can see an APY exceeding hundreds of billions.
Transaction fee is the major obstacle of compounding. Because Defi projects run on public blockchains, compounding requires the user to interact with the contract to put the earned interest into the LP token, and therefore triggers a transaction cost. During peak hours of Ethereum chain such as 8AM PST on February 4, 2021, the compounding costs $50 to $150. The hefty transaction fee is because ETH price has increased from $1 to $1,600 over time, pretty much prohibiting compounding on the ETH chain.
Binance Smart Chain (BSC) is developed by Binance, a CEX, but is gaining popularity among Defi projects due to low transaction fee around $0.2 to $0.4 each time. Personally I believe BSC will become much more popular due to yield farming, because not a lot of people can resist billion APY.
How to Provide Liquidity
All DEXs allow traders to create new liquidity pairs.
- Uniswap is the largest DEX on the ETH chain, with a valuation of $6 billion. It has $4 billion of liquidity pool of many pairs, also known as $4 billion of total locked value (TVL)
- Pancakeswap is the largest DEX on the BSC chain, with a valuation of $280 million. It has a TVL of $375M
Mechanism
Most DEXs use one algorithms for all liquidity pairs, including:
- The value of both tokens must be the same all the time
- The product of token quantities must be the same all the time
This creates a pricing curve as discussed in details at: https://docs.ethhub.io/guides/graphical-guide-for-understanding-uniswap/. When traders sell token A into the liquidity pool, the price of token A measured in token B declines, but at a declining speed.
If both tokens in a liquidity pair appreciates in USD, the value of the LP token will surely go up. When one token value declines in USD, the value of the LP token will decrease, but at a slower speed when compared to holding the original tokens. This is described as “impermanent loss.” https://academy.binance.com/en/articles/impermanent-loss-explained
In essence, impermanent loss (IL) is just a fancy term for loss. If either token value declines in USD, the LP suffers until the value bounces back. Therefore, it is critical to ensure that both token values may appreciate, or at least stay stable.
The LP receives 0.3% of transaction amount as transaction fees, and additional tokens from the project. The 0.3% transaction fees are automatically included in the LP token value, and do not need to be harvested manually.
Procedure
The liquidity interface looks similar for all DEXs and flows the same procedure:
- Obtain crypto from a CEX, because no DEX can take USD in paper form. There are a lot of CEXs available: CoinBase may be the most common one, and I use Bittrex. We cannot use Robinhood, because Robinhood does not allow users to transfer crypto to our own wallet
- Set up a browser wallet, with MetaMask being the most popular choice. There are plenty of guides online on how to set up MetaMask
- Keep your MetaMask seed phrase and password in a safe location, or you may lose all funds!
- Connect MetaMask to Binance Smart Chain if needed. MetaMask by default is a wallet of Ethereum tokens, but can be used for BSC. I found this video quite useful, which also talks about yield farming: https://www.youtube.com/watch?v=JwAHCtYUIlU
- Send crypto from your CEX account to your wallet address. Please try a small transaction first to make sure you can receive funds
- Exchange your common crypto (ETH or BNB) to the tokens required by the liquidity pair. For example, we need equal amount of CAKE and BNB to provide the liquidity pair of CAKE-BNB. https://exchange.pancakeswap.finance/#/swap
- Add liquidity to liquidity pool: https://exchange.pancakeswap.finance/#/pool and receive the LP tokens
- Stake the LP tokens at one of the auto-compounding “farms.” Please be careful that there are CAKE-BNB tokens issued by different DEXs and they are not interchangeable
If you are confident about the value of CAKE AND BNB, there is nothing else to do but to watch your LP tokens compound. JetFuel currently compounds it at 3,600% APY.
Risks and Risk Mitigation
Risks for Cryptocurrency
Buying and holding cryptocurrency is highly risky. For the largest crypto, Bitcoin, the price reached 20K in December 2017, crashed to 4K, and took 3 years to recover. One can lose 99% when holding an alternative coin (altcoin) in a day, and lose another 99% in the second day.
Higher Risk for Yield Farming
Defi has much higher risks by itself:
- The developer is typically anonymous, and can be imposters too. Therefore the team may walk away from the project for all types of reasons at any time. The project may still have some value, because the Defi smart contracts are still running on the public blockchain, but the value may decline without further update and support
- The developer may have intention to steal the staked assets. This is uncommon because the staking contract itself is so popular and the codes are publicly available, any deviation from the common codes may catch attention. Nevertheless, there is always a possibility that the developer creates a backdoor to steal the staked assets.
- There may be a flaw in the staking contract. Sometimes the staked assets are used for other purposes, such as a collateral for borrowing. A hacker may detect the flaw in the staking contract since it is publicly available, and drains the fund from the contract. Even the most established sites are not immune to attack: https://www.coindesk.com/yearn-finance-dai-vault-exploit
- Even without all the risks above, the staked asset may still decline in value
Highest Risks for Liquidity Mining
Rug-and-pull is a special term in the crypto world, describing the developer that has the sole intention to steal the liquidity pool when creating a project. A typical flow looks like this:
- A developer creates a project website and a token on ETH or BSC chain. It costs less than $100 for website hosting and token creation.
- The developer began to promote the project concept on twitter, discord or telegram, either using a referral program or airdrop – sending free tokens directly to some users
- The developer may go to presale directly using the concept, or may actually make the project live. Because all codes are publicly available, anyone can create a copy of the most popular projects and rename it. Therefore, on the ETH chain, there are suspected Ponzi projects such as Basis Cash, One Cash, Basic Gold, etc., that look exactly the same.
- The developer hosts a presale to sell the tokens. If the sale goes well, he may actually run away with the fund and starts another project.
- Sometimes the developer does not hold a presale – they simply keep some tokens at the beginning, or during the project process. Then they create huge incentives for trader to provide liquidities.
- When the liquidity pool becomes large enough, the developer may either (a) sell all of their tokens or (b) mint unlimited tokens from the contract and sell all to the liquidity pool. If the liquidity pool was $1M USD and $1M YYY token before the rug, the USD amount may be fully drained, leaving the liquidity provider with worthless YYY token
Risk Mitigation
Several factors may reduce the risk of Defi projects:
- Developer of another project. Sometimes an anonymous developer may host multiple projects. If the earlier projects are successful, the new project may be safer than other projects
- Audit. Many Defi projects are audited by various agencies. Audit does not eliminate the risk of contract coding risks, as seen in COVER and other projects, but reduces the risk to a certain degree. Also, the developer may replace contracts, which renders the audit useless
- Locked liquidity. Sometimes the developer may contribute all or most of the presale amount to a liquidity pool, and lock it for a few months or years. However, there are cases that the developer decides to rug and takes away majority of the locked liquidity.
- Timelock. To prevent a developer from minting billions of new tokens, many projects have a timelock on contract, which requires 24 hours delay time between contract update and contract execution.
None of those actions completely eliminates the defi risks. Fundamentally, if a developer can earn profit from a project over a long term, the developer has less incentive to take the current gain and run. That requires the project to have a true use case.
For example, Basis Cash protocols create three sets of tokens, but those tokens have no true use case except making one token a stablecoin (even that effort failed). It is commonly considered a ponzi scheme but can last for months, if not longer. If the developer premined the coin, there is nothing prohibiting him from dumping on the market and leave the project.
BSC Ecosystem
Key Tokens
Over the last several days, BSC tokens went up wildly in price. CAKE has increased from $0.80 to $2.80, as an example. Therefore near-term fluctuation may be possible.
Major tokens on BSC related to Defi include:
- BNB ($56.65): the coin driving the entire BSC. We only need to keep about 1 BNB on hand for gas fee, since the gas fee is typically 0.005 BNB
- BUSD/USDT/USDC ($1): USD equivalent
- CAKE ($2.79): the token driving the PancakeSwap, the largest DEX on BSC
Minor tokens include:
- BSCX ($5.20): BSCX aims to be Binance on-chain, and currently has a DEX aggregator, farming section and Launchpad. The Launchpad will have the first token this week. Price for BSCX is around $5 with about 4-5 million tokens in circulation. The valuation is way lower than ETH peers
- Tokens of Farms
- BIFI ($713): token for beefy.finance
- FUEL ($175): token for jetfuel.network
- AUTO ($472): token for autofarm.network
- Thug/Drug: confusing tokens for Thugs.fi
- Lending/Borrowing sites:
- Venus
- Cream Finance
- Copycat projects. There is only one copy of Basis Cash on the BSC - BDO. Other projects are mostly copies of Pancakeswap
Strategy with relatively low risks
The three major farms listed above have been audited and are considered relatively safe. Traders can exchange USD into USD equivalent, and still achieve more than 100% APY. This APY is insanely high, compared to stock market returns or bank deposit interest, although it comes with higher risks.
For example, autofarm.network has a total of $46 million locked on-site. There are three stablecoins: BUSD/USDT/USDC, all of which are pegged to USD and have an APY exceeding 100%.
Strategy with medium risks
If one has a higher risk tolerance, or anticipates the major tokens to appreciate in value, one may consider to be an LP.
For example, BNB-CAKE is a key pair in the BSC ecosystem. As of February 4, 2021:
- Autofarm has an APY of 760%
- Beefy has an APY of 605%
- Jetfuel has an APY of 3,925%. Because they hand out free FUEL token that has appreciated in value, the APY is much higher than other farms
Strategy with higher risks
The minor tokens have a higher level of risks, but offers a much higher rate. For example, jetfuel.network offers two products out of many:
- Fuel-BNB pair on pancakeswap at 35,000% APY, or the same pair on streetswap at 70,000% APY
- BSCX-BUSD pair on pancakeswap: this has a 4% daily yield, but with 3% locked for a year. Therefore the displayed 1B APY is effective between 3K and 300K
Strategy with highest risks
Many copycat projects offer an insanely higher APY to attract new traders. With TVL going higher, the APY will decline. Those token pairs have enormous risks, because the developer may walk away, resulting in your 100% loss.
But how many people can resist APY measured in B, Q and P?