1650855380 What is Impermanent Loss and How to Avoid It

What is Impermanent Loss and How to Avoid It?

The difference between the value of the LP tokens and the theoretical value of the underlying tokens if they had not been paired results in IL.

Let’s look at a hypothetical situation to see how impermanent/transient loss occurs. Suppose a liquidity provider with 10 ETH wants to offer liquidity to a 50/50 ETH/USDT pool. You need to deposit 10 ETH and 10,000 USDT in this scenario (assuming 1 ETH = 1,000 USDT).

If the pool they commit to has a total asset value of 100,000 USDT (50 ETH and 50,000 USDT), their share equals 20% using this simple equation = (20,000 USDT/ 100,000 USDT)*100 = 20%

Calculation of the share of liquidity providers in the liquidity pool

The percentage of a liquidity provider’s participation in a pool is also significant because when a liquidity provider deposits or deposits its assets into a pool via a smart contract, it immediately receives the liquidity pool’s tokens. Liquidity providers can withdraw their share of the pool (in this case 20%) using these tokens at any time. So can you lose money with a temporary loss?

This is where the idea of ​​IL comes into play. Liquidity providers are vulnerable to another layer of risk known as IL as they are entitled to a share of the pool rather than a specific amount of tokens. As a result, it occurs when the value of your deposited assets changes from the time you deposited them.

Please note that the larger the change, the more IL the liquidity provider will be exposed to. Loss here refers to the dollar value of the withdrawal being lower than the dollar value of the deposit.

This loss is volatile as there is no loss if the cryptocurrencies are allowed to return to the price (ie the same price as when they were deposited on the AMM). Also, liquidity providers receive 100% of trading fees, which offsets the risk of temporary loss.

How to calculate temporary loss?

In the example discussed above, the price of 1 ETH was 1,000 USDT at the time of deposit, but let’s say the price doubles and 1 ETH starts trading at 2,000 USDT. As an algorithm adjusts the pool, it uses a formula to manage assets.

The most basic and widely used is the constant product formula popularized by Uniswap. Put simply, the formula is:

Constant product formula

Using the numbers from our example, based on 50 ETH and 50,000 USDT, we get:

50 * 50,000 = 2,500,000.

Similarly, the price of ETH in the pool can be found using the following formula:

Token Liquidity / ETH Liquidity = ETH Price,

i.e. 50,000 / 50 = 1,000.

Now the new price of 1 ETH = 2,000 USDT. That’s why,

Formula for ETH Liquidity and Token Liquidity

This can be verified using the same constant product formula:

ETH Liquidity * Token Liquidity = 35.355 * 70, 710.6 = 2,500,000 (same value as before). So, now we have the following values:

Old vs. new ETH and USDT values

At this point, if the liquidity provider wishes to withdraw its assets from the pool, it will exchange its liquidity provider tokens for the 20% interest it owns. If they then take their share of the updated amounts of each asset in the pool, they will receive 7 ETH (i.e. 20% of 35 ETH) and 14,142 USDT (i.e. 20% of 70,710 USDT).

Now the total value of withdrawn assets is: (7 ETH * 2,000 USDT) 14,142 USDT = 28,142 USDT. If these assets could not be deposited into a liquidity pool, the owner would have earned 30,000 USDT [(10 ETH * 2,000 USDT) 10,000 USD].

This difference, which can occur due to the way AMMs manage wealth, is known as impermanent loss. In our fickle loss examples:

Temporary loss if the liquidity provider withdraws its 20% stake