Question about LP token swaps

I don’t think Koinly can handle the scenario outlined below so I’m wondering what the best way to log this into Koinly would be. I’ll attempt to describe this as simply as possible.

There are services that can automatically compound any rewards earned in a liquidity pool so you don’t have to do it manually. Typically this scenario looks like…

  1. Send some USDT and DAI into a liquidity pool
  2. Receive liquidity pool tokens (LPT)
  3. Exchange/swap the LPT for an auto-compounding liquidity pool token (aLPT)
  4. Deposit aLPT

Wait an amount of time whilst auto-compounding mad gainz

  1. Release aLPT
  2. Swap the aLPT back to the LPT
  3. Remove the liquidity from the LPT
  4. Receive USDT and DAI with an increased value.

The part I need perspective on is the swap between LPT and aLPT and back again. If I label it as a ‘swap’ then the cost trail seems to work out and any profits when cashing out the LPT are calculated correctly. However reading Koinly’s documentation they say Swaps are meant for something else. The other option is ‘exchange’ but I if I use this, then have to manually put the same cost values into all the exchange transactions (essentially meaning there is no profit or loss - ie: a swap). Doing this is very slow, as Koinly is constantly updating prices once one is changed.

I think how Koinly should actually treat this is to allow multiple levels of liquidity…?

Anyways, there doesn’t seem to be much discussion on this, but it’s fairly common to do this in DeFi. I personally use Pangolin > YieldYak > Pangolin on Avalanche to do this.

Any help would be greatly appreciated.

If you are taking the position that the second level exchange/swap of LPT for aLPT is not a taxable transaction in your jurisdiction, then I think you should label these transactions as a “swap”. I know some Koinly documentation states that this label is for “migrations and rebases” but elsewhere Koinly states that it should used for exchanges/swaps of the kind you are focused on. Below is one example of this from the Koinly Help Center:

How to handle AAVE staking tokens like STKAAVE?

When you stake coins with the AAVE protocol, it will give you back a new token that represents your ownership of the staked token. Such transactions will appear in Koinly as Trades by default (which will result in taxable gains) but you can tag them as Swaps to remove any gains from them (if you believe they are exempt from taxes).

I’m based in the USA. I was going to be conservative by taxing the initial LP trade / deposit. But then treating any sub-swaps as Swaps. So I guess a mix of both stances. Man this is confusing - it really puts me off DeFi.

Thanks for your answer and the info you dug up - it really helped me.

Hmmmm - so I was working on my report yesterday I noticed the following which is throwing up a few more questions. Here’s a fictional scenario… I deposit some AVAX and ETH into a liquidity pool:

10 AVAX :arrow_right: 2 PGL
10 ETH :arrow_right: 2 PGL

This is marked this as a taxable event / trade as there is a clear indicator of value based on the crypto deposited. Koinly notes the trade value.

From there, I deposit the 4 PGL into an auto-compounding contract and receive sPGL in return.

4 PGL :arrow_right: 3 sPGL

I have this marked as a swap as the value of both tokens is the same

Now this token is fixed in size, but the # of PGL wrapped inside slowly grows (from the auto-compounding that happens within the sPGL contract - this is happening constantly as people click ‘reinvest’ buttons - typically every few hours). Eventually I convert sPGL back to PGL and the amount returned is different:

3 sPGL :arrow_right: 4.5 PGL

What should this be marked as? A swap? A trade? If a trade, how am I supposed to determine the value as at this point I’m unable to see inside the contract to know how much the underlying assets have changed. And also, these tokens cannot be bought or sold anywhere (unlike say COMP) - they just represent the assets held within.

I have a number of instances here where I then moved the PGL tokens to other auto-compounding services to get: a better UI experience / or lower fees / or I wanted a more secure platform etc. Are these trades or swaps? Again, I do not know the underlying value that is wrapped up in the original PGL - this is only known once I remove the liquidity. I am treating them as a swap currently.

When the PGL liquidity is removed I can see the # of tokens has increased and the final value is then easily determined. Eg:

2.25 PGL :arrow_right: 11 AVAX
2.25 PGL :arrow_right: 10.2 ETH

It is at this point Koinly can determine the P/L based on the values and amount of AVAX & ETH returned. This is currently how I am choosing to work out my tax implication (value of liquidity in vs. value of liquidity out).

My confusion/uncertainty stems from all those steps in between. How can these be accounted for? The actual value of the underlying PGL is only known to the smart contract which is recalculating several times a day every time the ‘auto-compound’ button is pressed by other users. And unlike a token like COMP there is no fixed trackable price to refer to, instead the price of the token is based on the assets wrapped inside which can’t be seen until they are released. Therefore, since these tokens have no value to look up, and since this value is constantly changing… it’s hard to know the gain/losses made during the middle stages where the token swaps are happening.

I hope tracking and taxing the in and out moments is the best method to account for this kind of (common) DeFi process. How are others approaching this? Surely this isn’t unique to me :slight_smile:

Me again :joy:

Thinking on this further (it’s all I’ve been thinking about - ha!) I’m wondering if it makes more sense to do the following… (continuing to use the PGL example above)

Deposit into the LP as before…

10 AVAX :arrow_right: 2 PGL
10 ETH :arrow_right: 2 PGL

Then mark:

4 PGL :arrow_right: Sent to Pool

At this point the source assets are locked in the LP Pool. I then Soft Delete all the transactions where I moved/wrapped the PGL tokens around.

Before removing liquidity, I then add a transaction inside the Pool Wallet that reflects the increase in growth of the PGL Pool tokens.

Deposit +0.5 PGL

Finally, I remove the PGL from the Pool…

4.5 PGL :arrow_right: Removed from Pool

…and remove liquidity…

2.25 PGL :arrow_right: 11 AVAX
2.25 PGL :arrow_right: 10.2 ETH

I’m fairly sure the P/L Koinly will calculate will be the same as the P/L in the post above this one - but all the intermediate transactions will be hidden lowering my overall transaction count in Koinly and making the transaction history easier to read…

Here’s my thinking behind this: ultimately, the underlying PGL has always been in my possession from the moment I put liquidity in to get it, to the moment I take liquidity out and sell it. All I did was move the PGL around different smart contracts. With this thinking in mind (and to remove transactions / simplify) removing all the intermediary steps seems like an alternative option.

PS: I really wish you could filter the currency list by smart contract address. For example there are 100s of PGL smart contracts and when searching them you can only see a few even though, the others are in there. Being able to just add “0xc5ab” would be a massive help. I notice when you filter the URL changes and shows a unique currency id… even if that used the correct contract address then it would be useful as you could just insert the contract address straight into the URL.

Your final solution is creative and seems to produce an appropriate outcome from a tax perspective. I assume that the deposit of +0.5 PGL was assigned a $0 cost base so that the increase in PGL is reflected as a capital gain on disposal when removed from liquidity.

I had to use this Deposit tx approach recently with a DEFI protocol where I couldn’t record the numerous increases in value through compounding under the liquidity contract and only learned the increase in the amount of the deposited crypto on removal from the pool.

I think capital gains treatment is correct for this increase in PGL value based on the manner in which it occurred through auto-compounding under the PGL contract, i.e. I don’t think it shouldn’t be taxed as income as could be the case if you received new coins from the liquidity contract periodically.

Yeah I agree - I even spoke with the developers of one of the contracts I used and they said their tokens have no market value (ie: you cannot buy or sell them) so I think zero cost works. And the P/L is ultimately determined when the liquidity is deposited and then when the liquidity is removed (ie: to and from tokens with market value).

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.