With the explosion in popularity of DeFi, yield farming, and liquidity mining, this guide breaks down what you need to know to stay tax compliant.
September 17, 2020 · 13 min read
DeFi stands for decentralized finance. One of the biggest problems in the centralized financial system we have today is the involvement of intermediaries and the high cost and inefficiencies associated with processing transactions. For example, in order to process a mortgage, a bank would charge many different fees and take weeks to process the transaction!
DeFi refers to a broad range of financial activities (lending, borrowing, earning interest, paying interest on borrowed funds, trading financial instruments, etc.) which are conducted peer-to-peer (e.g. on the Ethereum blockchain) without going through an intermediary like a bank. By eliminating middlemen from transactions DeFi aims to make transactions cheaper, faster, and more efficient. For example, protocols like Compound, Aave, MakerDAO allow users to lend money and earn interest. Exchanges like Uniswap and dYdX enable users to trade crypto assets without using a centralized cryptocurrency exchange like Coinbase or Binance.
Recently, a new phenomenon known as yield farming has exploded in popularity. yield farming is essentially a process to maximize returns by putting your cryptocurrency assets to work. For example, users can deposit their crypto assets in a DeFi protocol like Compound and earn reward tokens (similar to interest) which in turn are lent out to other DeFi platforms to earn more rewards. The goal of yield farming is to deposit some initial capital and use leverage and arbitrage strategies to maximize interest earned.
A second phenomenon known as liquidity mining has recently added gasoline to the fire of yield farming’s growth. Liquidity mining adds in second order optimizations into the yield farming strategy. To understand how liquidity mining works, you first need to understand liquidity itself.
Liquidity is the lifeblood of DeFi, and finance generally. But what is it? In text book terms, liquidity is how quickly you can convert an asset into cash. For example, 1 GOOG stock in your portfolio is more liquid than a piece of rental property you own, because there are so many buyers available for the GOOG stock and not very many for your rental property. Cash is the most liquid asset you can have. In the cryptocurrency exchange world, liquidity means every time you place an order to buy or sell a coin, there is a counterparty for that transaction.
In centralized finance (CeFi), crypto exchanges like Coinbase or Binance.com, the liquidity is provided by market makers. Market makers can be crypto whales or big institutions who deposit their assets on the exchange.
Suppose Binance lists a new token: ABC. At launch, 1 million ABC tokens will be listed. At this point, market makers would come into the picture and offer to buy 1 million ABC tokens at $10 (ask price) AND offer to sell 1 million ABC token at $12 (bid price). Note how they are participating in both sides of the trade, or in other words, literally making the market. This creates liquidity for the token and other retail users would place trades based on the initial ask and bid price set by the market makers. This would ultimately form an order book like you’d see on any major exchange.
Think of market makers as the wholesalers. Without these wholesalers, your trades won’t be executed instantly and you will have to wait until there is a readily available buyer at your price. During this process, these market makers pocket a humongous amount of profit from the spread between ask and bid price. If you are a small investor, you never get to be a market maker in the centralized world!
The easiest way to understand why liquidity pools exist and how they work is by drilling into one of the major use cases of liquidity pools ‑ a decentralized exchange.
Decentralized exchanges and protocols still need liquidity but using traditional market makers would defeat the whole premise of being decentralized. The solution to the problem is creating liquidity pools governed by smart contracts. Liquidity pools are in place to provide liquidity to DeFi platforms (exchanges, lenders, borrowers, insurance, etc.) in a peer-to-peer fashion without using traditional market makers (e.g. big financial institutions).
Liquidity pools
A liquidity pool is a smart contract where crypto users’ funds are grouped together to provide liquidity for the market as a whole. Crypto holders who provide cryptocurrency tokens into liquidity pools are called Liquidity Providers (LPs).
So why provide your hard earned cryptocurrency tokens into a liquidity pool? Because LPs are rewarded with interest for locking in their tokens. Liquidity pools are used in various DeFi applications ranging from lending/borrowing platforms to cryptocurrency exchanges exchanges.
The process is relatively straightforward. First, many retail crypto holders (liquidity providers, aka LPs) collectively lock their funds in a pool administered by a smart contract. LPs get rewarded for providing liquidity. The greater the amount of locked funds in these pools, the greater the liquidity the exchange has. Liquidity pools facilitate cryptocurrency trades (trading one cryptocurrency to another) and cryptocurrency loans backed by collateral.
Decentralized finance example
For example, let’s say someone starts a Uniswap (decentralized exchange) liquidity pool for DAI/USDC. They could start the pool by putting in 5 DAI and 5 USDC — equal parts of both because they are both dollar stablecoins that are closely pegged to $1. Why would they do that? Because they will earn interest in the form of pool fees for users who use the pool. Let’s say someone now puts in 1 DAI and withdraws 1 USDC, then the balance will be skewed in the remaining pool: 6 DAI and 4 USDC. The next user to put in 1 USDC will get 1.2 DAI out and make a profit in arbitrage. The open pool market makes it possible for there to essentially be a trading pair between any Ethereum pairs on Uniswap, and also highly liquid due to the clear arbitrage opportunities.
Now on top of this, each time someone makes a trade in the pool, Uniswap charges a small fee that goes back into the pool. Let’s say in this case instead of getting back 1.2 DAI, the user would actually get back 1.197 DAI. The remaining portion goes back into the pool and available for the liquidity providers in the pool to earn a profit. So you can see how the incentive mechanisms work to create lots of trading pairs with the transparency of DeFi, in addition to supporting high liquidity and maintaining price ratios of token pairs.
This is where liquidity mining comes in to super charge yield farming. As mentioned above, yield farmers are looking to optimize the return on their deposited tokens. Recently however, some DeFi protocols like Compound have started paying additional rewards on top of the interest to liquidity providers in the form of governance token rewards, which themselves carry financial value as well. These are essentially extra bonuses to bootstrap liquidity.
Liquidity miners are essentially yield farmers who take into account the second order optimization of not only maximizing DeFi interest, but also governance token rewards as well.
At a high level, cryptocurrencies are treated as property by the IRS and all the general rules applicable to property apply to cryptocurrency transactions. Every time you spend, sell or exchange cryptocurrency, there is a taxable event.
So far, all the guidance issued by the IRS (Notice 2014-21, Rev. Rule 2019-24, 45 FAQs) has been generic and does not address DeFi at all. However, this is not an excuse not to report any of your DeFi related taxes. There is enough guidance in place to infer tax implications of DeFi and yield farming transactions.
The process of DeFi and yield farming generally consists of several transactions. In the following sections we will break down these different transaction types. Some DeFi transactions do not have any direct nor ancillary tax guidance. In these situations, we will present various tax positions you can take based on your risk tolerance.
The more aggressive the tax position, the higher the tax exposure. This means greater risk of under reporting and getting audited. On the upside, more aggressive tax positions will generally result in lower taxes, more tax deferment, and lower upfront tax payments. The lower the aggressiveness level, the lesser the risk of getting into trouble with the IRS. However, you will report income sooner and likely pay more taxes in the process.
In the case of lending, a user locks an asset in a DeFi protocol in exchange for a protocol token that represents their locked position. Examples of protocols that support these types of tokens are: Compound (cTokens), yearn.finance (yTokens), and Aave (aTokens).
Example
Bruce locks 1 ether (ETH) which he purchased a few years ago for $20 in a DeFi protocol. At the time of the deposit, 1 ETH is worth $100. Bruce receives 50 xETH, a protocol token, representing his contribution to the liquidity pool. xETH is tradable at other exchanges and is worth $1 per coin.
Conservative position: taxable. It could be argued that Bruce is disposing his original ETH and receiving a new crypto token called xETH. Crypto-to-crypto trades are taxable according to the IRS (A15). Additionally, crypto tokens are not fungible like fiat. When Bruce receives his collateral back later, he does not receive the same exact ETH coin he deposited. This could mean a disposition of Bruce’s original ETH in the eyes of the IRS. As a result, Bruce would report $80 ($100 – $20) worth of capital gains from the transactions.
Aggressive position: not taxable. Bruce is not disposing his ETH. He is only depositing assets as collateral. His intention is to borrow funds against ETH. His intention is NOT to sell the protocol token, xETH.
(If xETH does not have any real world market value and merely represents Bruce’s contributions to the platform, it is not a taxable event).
Wrapping
Sometimes protocols require you to wrap coins before they can be deposited into a specific blockchain’s smart contract. For example, BTC operates on the Bitcoin blockchain, not on Ethereum. Therefore, to use bitcoin with Ethereum-based DeFi platforms, you can “wrap” BTC using a protocol like Ren, which essentially locks your BTC in escrow in exchange for an ERC-20 token version of your BTC called wBTC.
An analogy to wrapping in the non-crypto world is a cashier’s check. It represents the value of dollars in your bank and whoever gets their hands on your cashier’s check owns the right to the underlying money in the bank.
Conservative position: taxable. It could be argued that the wrapped version of the original coin is a new coin resulting in a disposition of the original coin. Crypto-to-crypto trades are taxable (A15).
(CoinTracker defaults to this approach which is pro-taxpayer)
Aggressive position: not taxable. The intention of wrapping a coin is to add additional functionality to the original asset to make them work with DeFi protocols. Therefore, it is not a disposition and wrapping is not a taxable event.
Let’s say Bruce receives 50 xETH which is worth $50 ($1 x $50)
Position: not taxable. Generally speaking, funds received from a loan are not taxable because they are not income to the borrower.
When you borrow funds from a DeFi protocol, you have to pay interest to the platform for the risk assumed by the liquidity providers. Interest expense charged on loans is one of the main sources of income for DeFi platforms.
The deductibility of this interest expense depends on the use case of the loan proceeds. If the borrowed funds are used to buy a car or some other personal asset, that interest expense is considered personal so it is not deductible.
If you use the borrowed funds for investment purposes (yield farming for example) the interest expense you incur is classified as investment interest expense. Investment interest expenses are subject to special tax rules and are deductible only up to your net investment income. Since special rules are applicable to investment interest expenses, it is important to track these separately. The amount you can deduct on each year is calculated on IRS Form 4952. Once calculated, this amount will flow to Schedule A, Line 9. Make sure to itemize these expenses to take advantage of their benefit.
Bruce receives 0.1 ETH as interest for providing liquidity. At the time of the receipt, 1 ETH is worth $200.
Position: taxable. Receiving interest rewards is a taxable event where you have to pay taxes based on the market value of the token at the time of the receipt. Here, Bruce has to report $20 ($200*0.1) of ordinary income on Schedule 1, Other income line.
When you report this income, the newly received 0.1 ETH will now have a cost basis of $20. If Bruce were to later sell this coin on another platform for $30, he would incur a capital gain of $10 ($30 – $20). If Bruce were to be a yield farmer and put this new token on another platform to earn interest, Bruce has to go through events 1 through 8 to figure out tax implications arising from that token.
In addition to receiving more ETH interest income, Bruce also gets 0.5 of a protocol’s governance token (similar to COMP token offered by Compound and YFI offered by yearn.finance). At the time of the receipt, the governance token trades at $100/token.
Position: taxable. In this case, Bruce would report $50 ($100 * 0.5) of ordinary income on Schedule 1. When he reports this income, the newly received governance token will now have a cost basis of $50. If Bruce were to later sell this coin on another platform for $60, he would incur a capital gain of $10 ($60 – $50). If Bruce were to be a yield farmer and put this new token on another platform to earn interest, he has to go through tax events 1 through 8 to figure out tax implications arising from that token.
Let’s say that the price of ether drops and therefore Bruce’s DeFi platform liquidates his collateral at $50.
Position: taxable. Liquidation of his collateral is a disposition event, similar to a sale of an asset. In this case, Bruce will have to pay taxes on the difference between how much he originally paid for the 1 ETH (cost basis) vs. the price at which the protocol liquidates it. The liquidation results in $30 ($50 – $20) of capital gains.
Position: not taxable. Generally speaking, paying off a loan and getting your collateral back is not a taxable event. In the yield farming world, as long as you recognize interest income and governance token income as mentioned in event 4 and 5, there is no taxable event at the time you exit the pool.
With that said, if you unwrap your coin when you exit the pool, that could trigger a taxable event. See the section on wrapping above.
All previously mentioned transactions require users to send and receive various tokens on the Ethereum blockchain multiple times. This involves a transaction fee commonly referred to as a gas fee. Gas fees have recently skyrocketed due to the popularity of yield farming and high frequency of transactions occurring on Ethereum.
Transaction fees on sales
Gas fees on sales and dispositions are deducted from proceeds. For example, if Bruce sells 1 ETH for $100 and spends $5 for gas, his total proceeds on the transaction would be $95 ($100 – $5).
Transaction fees on transfers
Gas fees on transfers could be added back to the basis of the token. Suppose Bruce purchases 1 ETH at $10 on Coinbase. In order to transfer this token to Metamask, he has to incur a $2 gas fee. Once the transfer is complete, the cost basis of his 1 ETH on Metamask will be $12 ($10 + $2). When the cost basis increases, the eventual capital gains will decrease.
As you can see, DeFi taxes can quickly get extremely complicated. Luckily cryptocurrency tax software like CoinTracker can help automate the portfolio tracking, basis detection, and reporting calculations for DeFi activity.
The following are quick overviews of some of the most popular DeFi platforms.
Compound Finance is a leading DeFi protocol which allows users to deposit and borrow cryptocurrencies, and earn interest while doing so. Their protocol tokens are called “cTokens”. It represents your initial deposit. The lenders also receive $COMP token, the governance token, of the Compound protocol. These tokens are taxed as ordinary income at the time of the receipt.
Uniswap is a peer-to-peer, decentralized cryptocurrency exchange which allows trading Ethereum (ERC-20) tokens. Uniswap is differentiated from traditional centralized exchanges because it uses liquidity pools with thousands of retail crypto users directly providing liquidity (instead of traditional market makers). These LPs get a percentage of platform fees for providing liquidity. For more details, see how Uniswap taxes work.
Curve is another popular decentralized exchange that uses liquidity pools like Uniswap. It allows users to trade between stablecoins with low slippage, using a low fee algorithm designed specifically for stablecoins and earning fees. Behind the scenes, the tokens in Curve liquidity pools are supplied to Compound and yearn.finance to generate more income for liquidity providers via yield farming.
Aave is another DeFi protocol where users can provide liquidity, earn interest, and borrow funds. When users provide liquidity, their initial deposit is converted into aTokens (refer to Event 1 for tax implications). Aave is different from other lending protocols because it lets you pick both stable or variable interest rates and open flash loans.
MakerDAO allows users to deposit cryptocurrency collateral and generate DAI (stablecoins). Each type of cryptocurrency a user locks up goes into a separate Vault (as of publishing, Vaults support ETH and BAT, with more types of cryptocurrency collateral to be expected in the future). For more details, see the tax consequences of Maker Vaults.
yearn is DeFi protocol that optimizes yield automatically. As you already know, there several DeFi platforms offer various interest rates for providing liquidity. Before yearn, finding the best yield rate for each coin was a time consuming and laborious process. yearn simplifies this by algorithmically finding the best yield. The protocol token issued by yearn is called yToken (ex:-yDAI). You receive them at the time you deposit your collaterals to represent your deposit. YFI is the governance token.
CoinTracker helps you calculate your cryptocurrency taxes by seamlessly connecting to your exchanges and wallets. Questions or comments? Reach out to us @CoinTracker.
Disclaimer: this post is informational only and is not intended as tax advice. For tax advice, please consult a tax professional.