guest@tfb:~$ cat analysis/dex-liquidity-lp-tokens-tax.md
~/analysis/dex-liquidity-lp-tokens-tax.md

DEX liquidity provision: LP tokens and impermanent loss

Income: investment income (V0648-24) · swap into LP tokens: open
Income Tax 3 min

Depositing into a liquidity pool

Liquidity provision consists of depositing two assets into a smart contract in exchange for LP tokens that represent the proportional share in the pool. On withdrawing the liquidity, the provider recovers the assets in the proportion corresponding to the relative price of each at that moment. The tax question is whether the deposit of the assets and the receipt of the LP tokens constitute a barter —assets given up in exchange for LP tokens, with a gain or loss at the moment— or a deposit operation with no tax effect until withdrawal.

The analysis: what the doctrine resolves and what it leaves open

The DGT has ruled in part. V0648-24 classifies as investment income that obtained from participation in liquidity pools and yield-optimisation platforms. What it does not expressly resolve is whether the initial swap of the assets for LP tokens itself constitutes a barter with immediate tax effect.

On that initial swap, two positions are possible. The strict one holds that the LP tokens are assets distinct from those deposited, so that the exchange is a barter with immediate tax effect, like any other swap between crypto-assets. The flexible one holds that the LP tokens have no independent value, but are mere certificates of participation in the pool —close to units in a fund—, so that the taxable event is deferred until withdrawal. In our view, the more conservative position remains to treat the initial swap as a barter where distinct assets are given up and differentiated LP tokens are received, although we acknowledge that there are solid arguments for defending the simple-deposit logic in certain designs. The uncertainty is no longer total, but it remains high.

Impermanent loss

Impermanent loss is the difference between the value the asset would have if it had been held without depositing it and the value recovered on withdrawing the liquidity, due to the automatic rebalancing of the pool. If it is accepted that the withdrawal of liquidity gives rise to a gain or loss —as the difference between the value on withdrawal and the value on deposit, adjusted for the fees received—, the impermanent loss is automatically captured in that calculation. It does not exist, in itself, as a separate tax category in Spanish law.

DGT rulings — IRPF
  • V0648-24 — the income obtained from participation in liquidity pools is classified as investment income; the ruling expressly sets aside the obtaining and redemption of the LP tokens.

Applicable legislation: Articles 25.2 and 37.1.h) LIRPF.

Partially resolved: V0648-24 clarifies the taxation of the income (investment income), but does not close the initial swap into LP tokens or all the effects of impermanent loss.