What is Impermanent Loss?

Impermanent loss (IL) is when the prices of tokens in a liquidity pool change from what they were when the liquidity was added, resulting in a loss of value for the liquidity provider.

 

This happens when the pool's current price is within the position's range and token prices change due to market fluctuations.

 

Uniswap pools use a constant product formula represented by the variable k. The variable k reflects the total liquidity in the pool and ensures that the total amount of the two tokens remains balanced during swaps.

 

The smart contract for the liquidity pool keeps the balance constant using this function: x*y=k

  • x = token0
  • y = token1
  • k = constant

During each swap, one token is taken from the pool in exchange for another. To keep the value of k constant, the smart contract adjusts the balances of the tokens during the swap.

 

Prices vary across different pools and exchanges, leading to changes in the liquidity balances.

 

The price may or may not return to the level at which you initially provided liquidity. If it doesn't, this difference is known as impermanent loss.

 

In most cases, concentrated liquidity in a price range will increase the chance of impermanent loss happening. However, Uniswap v3 and v4 allow providers to add liquidity across multiple price ranges within a pool. This may help lower the chance of impermanent loss occurring.