Ethereum-Solidity Quiz Q16: What is impermanent loss?

Published: (January 7, 2026 at 03:10 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

What is impermanent loss?

Impermanent loss is the difference in value you would have if you simply held your tokens versus if you provided them as liquidity in an Automated Market Maker (AMM).

How it happens

When you provide liquidity to an AMM, you deposit two tokens of equal value. The AMM automatically adjusts prices based on supply and demand using the constant‑product formula

[ x \times y = k ]

If the price of one token changes significantly, the pool rebalances, leaving you with a different token ratio than when you started. That ratio shift can result in a loss compared to just holding the assets.

Why “impermanent”?

  • If the price returns to the original ratio, the loss disappears.
  • You only realize the loss when you withdraw while prices are imbalanced.
  • Trading fees earned by the pool can offset or even exceed the impermanent loss.

Example: ETH‑USDC pool

Initial deposit

TokenAmountUSD value
ETH1$2,000
USDC2,000$2,000
Total$4,000

The constant‑product is

[ k = 1 \times 2{,}000 = 2{,}000 ]

Price change: ETH rises to $4,000

Using the constant‑product formula (x \times y = k) with the new price ratio (y/x = 4{,}000):

x × y = 2,000
y = 4,000x
x × 4,000x = 2,000
4,000x² = 2,000
x² = 0.5
x = √0.5 ≈ 0.707 ETH
y = 4,000 × 0.707 ≈ 2,828 USDC

New LP position

  • ETH: 0.707 ETH (lost 0.293 ETH)
  • USDC: 2,828 USDC (gained 828 USDC)

Value:

[ (0.707 \text{ ETH} \times $4{,}000) + (2{,}828 \text{ USDC} \times $1) = $2{,}828 + $2{,}828 = $5{,}656 ]

Comparison

ScenarioETH (value)USDC (value)Total value
Just holding1 ETH = $4,0002,000 USDC = $2,000$6,000
Providing liquidity0.707 ETH = $2,8282,828 USDC = $2,828$5,656

Impermanent loss calculation

[ \text{Impermanent loss} = $6{,}000 - $5{,}656 = $344 \approx 5.7% ]

What actually happens

  • Lost: 0.293 ETH (sold as the price rose)
  • Gained: 828 USDC (bought as the price rose)

The AMM rebalanced the position to maintain the constant product, effectively selling ETH at lower prices than the market peak. Trading fees earned by the pool can mitigate this loss.

Back to Blog

Related posts

Read more »

Rapg: TUI-based Secret Manager

We've all been there. You join a new project, and the first thing you hear is: > 'Check the pinned message in Slack for the .env file.' Or you have several .env...

Technology is an Enabler, not a Saviour

Why clarity of thinking matters more than the tools you use Technology is often treated as a magic switch—flip it on, and everything improves. New software, pl...