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.
Contents:
1.Liquidy Provider and LP tokens - what are they?
2.Cryptact's approach to calculating the pnl for Liquidity Provider and LP tokens
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.
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) |
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.
- Deposited 10 X-coins and 15 Y-coins and received 10 LP tokens.
- 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.
- Deposited 10 X-coins and 15 Y-coins and received 10 LP tokens.
- Deposited 20 X-coins and 40 Y-coins and received 20 LP tokens.
- 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