*The difference between the value of the LP tokens and the theoretical value of the underlying tokens if they had not been matched leads to IL.*

Let’s look at a hypothetical situation to see how temporary/non-permanent loss occurs. Suppose a liquidity provider with 10 ETH wants to offer liquidity to a pool of 50/50 ETH/USDT. They will need to deposit 10 ETH and 10,000 USDT in this scenario (assuming 1 ETH = 1,000 USDT).

If the pool you pledge to has a total asset value of 100,000 USDT (50 ETH and 50,000 USDT), your stake will equal 20% using this simple equation = (20,000 USDT/ 100,000 USDT)*100 = twenty %

A liquidity provider’s percentage share in a pool is also substantial because when a liquidity provider commits or deposits their assets to a pool via a smart contract, they will instantly receive the liquidity pool’s tokens. Liquidity providers can withdraw their share of the pool (in this case 20%) at any time using these tokens. So can you lose money with a temporary loss?

This is where the idea of IL comes into the picture. Liquidity providers are susceptible to another layer of risk known as IL because they are entitled to a portion of the pool rather than a defined number of tokens. As a result, it occurs when the value of your deposited assets changes since you deposited them.

Note that the higher the change, the more IL the liquidity provider will be exposed to. Loss here refers to the fact that the dollar value of the withdrawal is less than the dollar value of the deposit.

This loss is not permanent because no loss occurs if the cryptocurrencies can return to price (i.e. the same price they were when they were deposited in the AMM). And also, liquidity providers receive 100% of the trading fees that offset the exposure to risk of temporary loss.

### How to calculate impermanent 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. Since an algorithm adjusts the pool, it uses a formula to manage the assets.

The most basic and widely used is the constant product formula, which is being popularized by Uniswap. In simple terms, the formula states:

Using the figures 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 obtained using the formula:

Token Liquidity / ETH Liquidity = ETH Price,

that is, 50,000 / 50 = 1,000.

Now the new price of 1 ETH= 2,000 USDT. Therefore,

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 values as follows:

If, at this time, the Liquidity Provider wants to withdraw your assets from the pool, it will exchange your Liquidity Provider Tokens for 20% ownership. Then, taking their share of the updated amounts of each asset in the pool, they will earn 7 ETH (ie 20% of 35 ETH) and 14,142 USDT (ie 20% of 70,710 USDT).

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

This difference that can occur due to the way AMMs manage asset indices is called transient loss. In our temporary loss examples:

Source link