A Brief on impermanent loss in DeFi, AMMs and risks in liquidity mining

In its simplest form, decentralized finance is a system by which financial products become available on a public decentralized blockchain network, making them open to anyone to use, rather than going through middlemen like banks or brokerage account, a government issued ID, social security number or proof of address are not necessary to use DeFi.

Decentralized finance has been around for a while now in the crypto world and the DeFi protocols have gained popularity. Ethereum blockchain drives the ecosystem and also has played a major role in bringing back the retail interest in the larger crypto space. There is a concept of earning passive income via DeFi protocols. Called as liquidity mining in DeFi has been the root cause for the market explosion which was led by automated-market-making protocols. There are many decentralized exchanges like Unizwap, SushiSwap and balancer that are dependent on AMM protocols. The platforms allow the users to exchange tokens in a decentralized and seamless way.

Now this is made available by liquidity providers. The liquidity providers are the ones who deposit some crypto assets to the platform providing liquidity for other assets to be exchanged. The LPs are motivated to deposit their assets as they earn transaction fees generated by the users swapping tokens on any given platform. If you see traders who lock their tokens into the DeFi protocol the transaction fees they earn are like a yield. The value of the yield varries as it depends on the protcol’s usage and volume.

Let’s go through how providing liquidity works in detail along with the concept of impermanent loss, which is crucial to grasp for the traders providing liquidity to AMMs. 

AMM liquidity pools

If the users of AMM protocol wish to exchange or swap tokens, there has to be pools of liquidity present for them to swap tokens. Suppose if a trader wants to sell 1 Ethereum for USDT, there has to be a liquidity pool that will take the 1 ETH and give 1000 USDT and otherwise. The need for liquidity goes up when the trading volume surge that is where those who are eyening to be LPs come into the picture. These traders can deposit a pair of cryptocurrencies in this example ETH and USDT to the protocol’s relevant pool in a predetermined ratio, which tends to be 50/50.

For instance if an LP with 10 ETH desires to add liquidity to an ETH/USDT pool with a 50/50 ratio, they will need to deposit 20 ETH and 10,000 USDT (Assuming 1 ETH = 1000 USDT). If the pool they commit to has a total of 100,000 USDT worth of assets, their share will be 20,000 USDT / 100000 USDT x 100 = 20%.   

The percentage of LPs shared in a given pool is important to see as the LP commits, or deposits, their assets to the pool through a smart contract, they are automatically issued LP tokens . These tokens qualify the LP to withdraw their share of the pool at any given time, considering the above example 20% of the pool can be withdrawn.

Here in this scenario the notion of impermanent loss comes in the picture. As the LPs are entitled to their share of the pool and not a specific number of tokens, they are exposed to risk i.e. impermanent loss, if the price of their deposited assets grows notably.

How to calculate impermanent loss

Considering the above example 1 ETH was 1000 USDT at the time, but let us consider that the price doubles and 1 ETH starts trading at 2000 USDT. As the pool gets adjusted algorithmically it uses a formula to manage the assets. Constant product formula is a basic and most commonly used which gained popularity by Usiswap.

The formula is: ETH liquidity x token liquidity = constant product

Using data from the example (50 ETH and 50,000) will get us: 50 x 50,000 = 2,500,00

The price of ETH in the pool can be obtained with the formula: token liquidity / ETH liquidity = ETH price

Using our data from the example will get us: 50,000 / 50 = 1,000 USDT (i.e., the price 1 ETH).

When the price of ETH changes to 2,000 USDT, we can use the formule to get the ratio of ETH and USDT held in the pool.

ETH liquidity = square root (constant product / ETH price)

Toke liquidity = square root (constant product x ETH price)

Applying data from the example above along with the new price of 2,000 USHT per ETH gets us:

ETH liquidity = square root (2,500,000 / 2,000) = -35.355 ETH

Token liquidity = square root (2,500,000 x 2,000) = ~70,710.6 USDT

The accuracy can be confirmed using the first equation (ETH liquidity x token liquidity = constant product) to arrive at the same constant product of 2,500,000: 35.355 x 70,710.6 = ~2,500,000 (i.e., the same as original constant product).

Thus, post price change, determining all other factors remain constant, the pool will have somewhere around 35 ETH and 70,710 USDT, compared to the original 50 ETH and 50,000 USDT.

Now the LP wants to withdraw their assets from the pool, they will exchange their LP tokens for the 20% share they own. Taking their share from the updated amounts of each asset in th pool, they will get 7 ETH (i.e., 20% of 35 ETH) and 14,142 USDT (i.e., 20% of 70,710 USDT).

Total value of the assets withdraw = (7 ETH x 2,000 USDT) + 14,142 USDT = 28,124 USDT.

If the user did not sell and kept the 10 ETH and 10,ooo USDT, instead of depositing these assets into a DeFi protocol, they actually would have gained more. Considering ETH doubled in price from 1,000 USDT to 2,000 USDT, the user’s non-deposited assets would be priced at 30,000 USDT: (10 ETH x 2,000)+10,000 USDT = 30,000 USDT.

The variability of 1,876 USDT which can occur because the way AMM platforms manage asset ratios is known as impermanent loss.


In the above instance the LP stands to lose nearly 2,000 USDT in the process of providing liquidity to a DeFi protocol. This process is called impermanent loss, the term is a bit misleading. The meaning of the term is same to the concept of unrealized loss. The loss can back-peddle in theory, but there is no guarantee of that occurring.

After LP withdrawals liquidity from a protocol, the impermanent loss indeed becomes permanent. If an LP experiences loss i.e., impermanent loss and then withdraws their assets, the only positive to having provided liquidity to the protocols remains the trading fees that the LP collected while their assets were deposited there.

On the other hand a cut in the price of ETH from the time it was deposited in the pool would yield additional ETH, thus taking up the liquidity provider’s ETH holding. Taking into consideration how the impermanent loss works, giving liquidity during a bear market and simply holding volatile assets during a bull market are both strategies that merit consideration.

If you want to learn more about DeFi then start with how crypto works.