DeFi: Our approach to Liquidity Provider and LP tokens

This article explains about Liquidity Provider, a transaction type which is unique to DeFi, and how Cryptact treats these transactions while calculating the pnl.

As of December 2021, there is no clear guidance from the National Tax Agency on how the Liquidity Provider should be treated while calculating the pnl. Ultimately, you need to check with your tax office for final guidance on your own circumstances. In the future, the National Tax Agency may issue guidance on the calculation method which differs from the below.

 

1. Liquidy Provider and LP tokens - what are they?

Liquidity Provider --- deposit a pair of coins into a liquidity pool on the platform and receive an interest-like reward based on the volume of transactions in that pool.

LP tokens --- coins you receive when you deposit a pair of coins into a liquidity pool as described above. Almost like a receipt for your deposit.

 

 

2. Cryptact's approach

The default calculation method focuses only on the difference in the number of coins deposited (Add Liquidity) and withdrawn (Remove Liquidity). The pnl is calculated only based on the difference.
(For details on how to create a custom file for Liquidity Provider, please refer to here.)

This means that the act of Adding Liquidity/Removing Liquidity or the increase/decrease in the number of LP tokens is deemed to have no impact on the pnl, and therefore, they are not included in the pnl calculation.
By changing the setting, you also have the option of leaving them as To Confirm transactions and handling them by yourself via custom trades.
(For details on how to change this setting, please refer to here.)

 

3.Calculation method

  Calculation method
Add Liquidity No PNL
Remove Liquidity

Calculate the PNL based on the difference in the number of coins deposited and withdrawn

・Increase: BONUS (consider it a profit at the market price)
・Decrease: LOSS (consider it a loss)

 

Example 1: Remove all liquidity at once

This is a simple scenario and the pnl is calculated based on the difference in the number of coins deposited and withdrawn.

  1. Deposited 10 X-coins and 15 Y-coins and received 10 LP tokens.
  2. Gave back 10 LP tokens and withdrew 12 X-coins and 14 Y-coins.

The withdrawals are treated as follows:

For X-coin: a BONUS of (12-10)=2 in X-coin

For Y-coin: a LOSS of (14-15)=-1 in Y-coin

 

Example 2: Add Liquidity multiple times and partially remove the liquidity

Based on the number of LP tokens returned, Cryptact first calculates the percentage of the liquidity removed, and then calculates the pnl based on the difference in the number of coins deposited and withdrawn.

 

  1. Deposited 10 X-coins and 15 Y-coins and received 10 LP tokens.
  2. Deposited 20 X-coins and 40 Y-coins and received 20 LP tokens.
  3. Gave back 5 LP tokens and withdrew 6 X-coins and 8 Y-coins.

The withdrawals are treated as follows:

For X-coin: a BONUS of 6 - ( 5 / ( 10 + 20 ) × ( 10 + 20 ) ) = 1 in X-coin

For Y-coin: a LOSS of 8 - ( 5 / ( 10 + 20 ) × ( 15 + 40 ) ) = -1.166… in Y-coin