Dear User, please note that this website has been discontinued and will therefore no longer be serviced. All current information about our software and products can be found at www.blockpit.io

DeFi Cryptotax Guide: Swaps, Liquidity Pools, and Yield Farming

Cryptotax DeFi

What is DeFi and how is it taxed?

Decentralized Finance (DeFi) has become one of the hottest applications of blockchain technology. If 2017 is considered to be the year of the ICOs, 2020 is considered to be the year of Decentralized Finance. 

What is DeFi? Decentralized Finance takes the original idea of Bitcoin one step further. For the first time in human history Bitcoin has enabled decentralized digital currency, where payments or transfer of value can be made without intermediaries, i.e. banks and other financial institutions. If you apply this idea to the wider area of finance, like lending, borrowing, exchanges, derivatives and even insurance, you will get decentralized finance. 

Ideally, DeFi aspires for the strongest traits of Bitcoin, like being permissionless, censorship-resistant, and trustless. Ultimately that would mean that anyone can access and participate in DeFi. You do not need to obtain anyone’s permission and no one can block you from transacting with anyone else.

Anyone includes not only any human on the Earth but also machines or program code (smart contracts), which in their turn can interact with other code without the middleman. This can lead to complex constellations, where smart contracts on different platforms automatically interact with each other, i.e. enabling programmable actions across the protocols as we see it with yield farming.

There are many DeFi protocols competing and complementing each other, like Uniswap, Curve, Sushiswap, Synthetix, and many more. Most of them are based on the Ethereum blockchain, which was also the blockchain that fueled the ICO craze in 2017. There are some uprising platforms that try to take a piece of the DeFi cake from Ethereum, like EOS, Tron and Kava (running on a Cosmos blockchain), but none of them has come close to the good old Ethereum yet. 

DeFi has also seen a surge of DeFi coins, i.e. tokens that facilitate governance of a DeFi protocol or provide a specific utility like a stable coin. 

Top DeFi coins by market capitalization include Wrapped Bitcoin (WBTC), Dai (DAI), Uniswap (UNI), Aave (AAVE), yearn.finance (YFI), Maker (MKR), Synthetix (SNX) and Compound (CMP).

A notable event was the airdrop of the Uniswap Token with at least 400 Uniswap worth more than $2,000 on September 18th, 2020 to each wallet that interacted with the Uniswap smart contract. We have covered the taxation of the Uniswap airdrop in this article.

 

DeFi Taxes

With the USD value of billions being locked in DeFi smart contracts, many started wondering about the tax implications. How are my DeFi activities taxed? How are liquidity pools taxed? How to calculate taxes, if I do yield farming across different protocols?

These are questions that also move us at Cryptotax personally and we want to bring some light into the jungle of DeFi taxes and give you an effective remedy against the pain of calculating and filing DeFi taxes.

We have already covered DeFi Lending and Borrowing in our first DeFi blog. Now we are going to take a look at the DeFi Swaps, Liquidity Pools, and Yield Farming. 

We will address the questions of the tax treatment of DeFi in the US. For the tax treatment of DeFi in Germany please check this publication. We will also help our users understand how to import DeFi transactions into the Cryptotax application and report them properly. Specifically, we will cover the following use cases:

  1. A token swap on a decentralized exchange like Uniswap
  2. Liquidity pools on a decentralized exchange like Uniswap
  3. Yield farming on the example of “Max $Comp Rewards” on InstaDAPP

 

Swap on a decentralized exchange like Uniswap

Token swap is actually just a fancy name for trading one cryptocurrency or token like ETH for another token like DAI on a decentralized exchange. Therefore swaps can be treated the same way as trades for tax purposes. 

Example: swap 0.09 ETH for 36.0167 USDT on Uniswap

https://etherscan.io/tx/0xcbaeaad98961698a103c01f1bc1eee26acb645d641dc72a4ccbff2b08ce762c4/

Tax treatment

Same as trading 0.09 ETH for 36.0167 USDT, i.e. treatment as a taxable sale of ETH

Tracking in Cryptotax

  1. Go to Ethereum Wallet Import and enter your wallet address on Uniswap, in this case: 0xed007a4535457079fd886ab3f34d8bf508bc100b
  2. In a few seconds you will see the following trade transaction in the Cryptotax dashboard:

In: 36.01670100 USDT

Out: 0.09000000 ETH

Fee: 0.00456348 ETH

  1. Done, you can generate your tax report!

Note: if you take a detailed look at this transaction on Etherscan, you will note that Uniswap smart contract will swap ETH in USDT in two steps. Firstly, it will convert ETH in WETH and then WETH in USDT. As there is no inflow of the WETH to the wallet, we consider it legitimate to treat it as one trade between ETH and USDT for tax reporting purposes. 

 

Liquidity Pools

With liquidity pools, anyone can participate in the automated market making of a decentralized exchange like Uniswap, Curve or Aave by supplying liquidity to token pairs. For example, you can add liquidity to the USDC-ETH pair on Uniswap and receive a share of this liquidity pool. As a reward, you are entitled to your share of all fees earned by this pool.

When you add liquidity to a pool, you receive a corresponding liquidity pool token (LP-token). On Uniswap V2 it is the Uniswap V2 (UNI-V2) token. From the tax perspective, this can be considered as a taxable sale of each token that you added to the liquidity pool.

When you remove liquidity from the pool, you exchange the LP-token for the two tokens that you receive from the pools. This corresponds to a taxable sale of the LP-token.

Example: add 102.74 DAI and 103.80 USDC to the DAI-USDC liquidity pool

https://etherscan.io/tx/0x9010d9dece562cea96f7bea9d9ecee3492575bb2487f34098c01e361ad77c03b/

In this example, you receive 0.000097824762297145 Uniswap V2 tokens for adding the DAI-USDC liquidity to the pool.

Tax treatment

Same as trading the DAI-USDC-pair (102.74 DAI and 103.80 USDC) for the LP-token (0.000097824762297145 Uniswap V2 token). Here you can apply the market prices for DAI and USDC to calculate the corresponding sale proceeds in USD. Accordingly, the cost basis or the acquisition costs for the LP-token would be the sum of the sale proceeds for DAI and USDC.

Tracking in Cryptotax

  1. Go to Ethereum Wallet Import and enter your wallet address on Uniswap, in this example 0xd29f0e7e717b62dc3e65be2241840e3bec7b867d
  2. In a few seconds, you can find two withdrawal transactions of the pair (DAI and USDC) and one deposit transaction (LP-token) in the Cryptotax dashboard. In this case, the LP-token will be shown as G (0xae461ca6…), as this token is not listed on CoinMarketCap.
  3. Clarify each withdrawal transaction of the pair (DAI and USDC) as “OTC Sell” at market value
  4. Clarify the LP-token deposit transaction as “OTC Buy” and enter the value in USD. For this, you would need to add the market values of the two withdrawal transactions. You can look up the market value in Cryptotax when you generate the tax report or you can manually calculate the USD value by applying the respective exchange rate.  
  5. Done, you can generate your tax report!

Notes:

  • We are continuously improving our application to enable as much automation as possible. However, as this work is in progress you need to make some manual adjustments as described above. 
  • Sometimes you might see two same ETH fee amounts for the two withdrawals. In the example above you need to delete the fee amounts from the withdrawals and add the amount to the deposit. In this case, you need to delete the 0.00605559 ETH fee from the withdrawals of DAI and USDC and add 0.00605559 ETH fee to the deposit of the LPT.
  • When you add a pair that includes ETH to a liquidity pool, Cryptotax will currently import the inflow of the LP-token and the outflow of the ETH in one trade transaction. This needs to be corrected, as you are actually trading the LP-token for a pair that includes the ETH and not the ETH only. Hence you need to create one LP-token deposit and one ETH withdrawal transaction instead. After that, you can proceed as described above.
  • Occasionally you might see an additional ETH deposit. This is leftover ETH that is refunded to you after the transaction is finished. You can leave this transaction as it is. 

 

Yield Farming

Yield Farming or Liquidity Mining is an evolved concept of maximizing returns by leveraging the power of smart contracts. It basically seeks to combine various components of DeFi across different DeFi protocols to get maximum return. It is strongly fuelled by the arising of DeFi governance tokens, which incentivize users to use their platform by rewarding them with the governance tokens. As anyone can participate in DeFi, why not let an algorithm optimize the returns across different protocols and automatically interact with the corresponding smart contracts? As you can imagine this adds an additional layer of complexity as different platforms are involved. Also you need to evaluate each interaction separately regarding its tax treatment. The good news is that in most cases the complexity of yield farming and liquidity mining can be broken up into transactions with known tax treatment like borrowing, lending, swapping, adding liquidity, and getting rewards.

Yield Farming gained strong with the rise of the Compound Finance’s COMP Token. We are going to show tax treatment of Yield Farming on the example of the “Maximize COMP mining” on InstaDApp. A similar approach can be used for other Yield Farming / Liquidity Mining activities.

Example: InstaDApp maximize COMP mining with 900 DAI to 1800 USDC

In this example InstaDapp will execute several smart contracts to do the following:

  • Borrow 1,800 USDC on Compound by leveraging 900 DAI (that had been deposited before) 
  • Swap 1,800 USDC For 1,788 DAI On Curve.fi 
  • Get a reward of 0.00000271 COMP for supplying DAI on compound (not claimed)
  • Swap 1,788 DAI For 86,734 cDAI on Compound

Tax treatment

In this example we need to evaluate each transaction separately: 

  • The inflow of 1,800 USDC from borrowing has no tax implications. You can find more about the tax treatment of DeFi borrowing in this post.
  • Swapping USDC for DAI receives the same treatment as selling USDC for DAI. It is a taxable event, which results in a realized capital gain or loss on selling USDC.
  • As COMP reward has not been claimed yet, it is not a taxable event. This is similar to staking rewards, where tax obligation arises at the moment of the claim.
  • Swapping DAI for cDAI is also treated as selling DAI for cDAI and realizing a capital gain/loss accordingly.

Tracking in Cryptotax

  1. Go to Ethereum Wallet Import and enter your Yield Farming address. In this example, you will import the contract address of the InstaDapp account (InstaAccount)
  2. The inflow of the tokens borrowed has no tax implications, hence no action needed.
  3. The swaps are imported as separate deposit and withdrawal transactions. You need to link the deposits to the corresponding withdrawals for the proper tax treatment. You do that by classifying each deposit as “OTC Buy” and selecting the corresponding withdrawal classification: 
    • Click the three dots on the right-hand side of a deposit and select “Clarify.”
    • Choose “OTC Buy” as a distribution source.
    • Uncheck USD “Market value”.
    • Click “LINK TO A WITHDRAWAL”.
    • Select the corresponding withdrawal.
    • Click “Save”.

You will see that both the deposit and the withdrawal are marked as “OTC Buy” in the Clarification column in the dashboard. 

In this example you need to do the above two times, i.e. once for linking USDC/DAI swap and another time to link the DAI/cDAI swap

Done, you can generate your tax report!

Note: in this Yield Farming example, a single ETH fee incurred for all the steps described above. As it is very difficult to split up the fee along all the transaction actions, we suggest allocating the fee to one of the actions. For example, you could leave the fee with the USDC/DAI swap and delete it from other transaction actions.

 

We hope this brought more clarity to the tax treatment of DeFi. Cryptotax is committed to continuing its support for DeFi and making it even easier for you to calculate and report your DeFi Taxes. 

 

Try out Cryptotax now with our free plan!

 

Disclaimer: The information provided in this blog post is for general information purposes only. The information was completed to the best of our knowledge and does not claim either correctness or accuracy. For detailed information on crypto regulations, we recommend contacting a certified legal advisor in the respective country. If any questions occur, feel free to contact us on our social media channels.