WTF is Impermanent Loss in DeFi and How To Avoid It?

EQIFi
6 min readSep 13, 2022

--

One of the risks associated with DeFi, or decentralized finance, is impermanent loss. If you have ever provided liquidity to a liquidity pool and noticed that some of your funds disappeared, chances are that you have been experiencing impermanent loss. But what exactly is impermanent loss, how does it happen, and most importantly, how can you mitigate the risk associated with it?

What is Impermanent Loss?

Impermanent loss represents a temporary loss of funds that can occur when providing liquidity to a liquidity pool.

To fully understand how impermanent loss happens, we must first understand how a liquidity pool works. Automated market makers, such as Uniswap, use liquidity pools for exchanging one asset for another. A liquidity poll is a reserve of a decentralized exchange that is available for users to exchange tokens with.

Automated market maker, or AMM, is a term used for a class of decentralized exchanges that gained significant popularity with the rise of DeFi.

One type of automated market maker is the constant product market maker that the equation can describe: x * y = k,

where x and y represent the amount of each asset in the liquidity pool, and k is the total amount of the liquidity.

The most basic type of liquidity pool is one that holds two tokens. Nevertheless, other variants of liquidity pools with multiple tokens exist, but those are beyond the scope of this blog post.

For a liquidity provider (LP) to contribute liquidity to a pool, they must provide an amount equal in the value of the two assets. LPs are incentivized to provide liquidity because they get in return Liquidity Provider tokens (LP tokens), proportional to their share in the liquidity pool.

The LP tokens can be staked in the platform to obtain the native token of the platform. Such programs incentivize the creation of liquidity around the protocol’s native tokens and allow users to trade those tokens on decentralized exchanges easily.

However, whenever the initial price of the tokens that the LP provided to the pool deviates from the current global price of those tokens, an instant arbitrage opportunity arises, resulting in lost capital for the LP, or impermanent loss.

Impermanent loss happens when traders rebalance the pool to correct the value of its underlying assets at a rate to their advantage. In turn, this proves to be suboptimal for the liquidity providers because the price of their assets fluctuates very often.

How Does Impermanent Loss Happen?

To have a better understanding of the phenomenon, we can illustrate it with an example:

Let us suppose a liquidity pool with two digital assets, ETH and USDC, on an automated market maker (e.g: Uniswap, Pancakeswap).

The total pool contains 10 ETH and 1000 USDC. The ETH and USDC maintain a 1:1 ratio in value, meaning that 1 ETH = 100 USDC (we chose these numbers for the sake of simplicity).

Therefore, the total value of the pool is 2000$.

You deposit 1 ETH and 100 USDC to the pool, which means that the value of your deposited assets is 200$, and you own 10% of the share of the pool.

Now suppose that the ETH price rises to 400 USDC. The formula that stands at the core of constant product market makers is that the product of the asset quantities must remain constant (x * y = k).

In this case, the constant k must always be equal before and after a transaction in the pool (10 ETH * 1000 USDC= 10 000). Considering this, and that the price of ETH in the pool is still 100 USDC, an arbitrage opportunity arises.

At this point, arbitrageurs can buy ETH from the liquidity pool at a lower price until the price is in line again with the external price.

If we do not consider the transaction fees, there would be 2000 USDC and 5 ETH in the liquidity pool, while their product, k, remains 10,000.

If you withdraw your funds from the liquidity pool, based on your share of 10% of the pool, you would be able to withdraw 0.5 ETH and 200 USDC, which means that the value of your assets is 400$ (not considering fees).

However, if you had simply adopted a holding strategy instead of providing liquidity, you would now have your initial 1 ETH and 100 USDC worth 500$ at this point.

This means that if you exit under these circumstances, you can lose 100$ (500$-400$), which is called impermanent loss. However, sometimes the gains that result from the fees you collected as a liquidity provider surpass the loss, but there is no guarantee.

What are the Risks Associated with Impermanent Loss?

When providing liquidity to a liquidity pool, the price of the tokens can deviate in any direction. The greater the divergence of the prices, the more impermanent loss the liquidity provider experiences.

The phenomenon is referred to as “impermanent” loss because the losses become permanent only when the LP closes their position and the price ratio relative to the time of the deposit has changed (it does not matter which direction the price changes).

However, if the LP does not exit and waits until the price comes back to its initial value because of volatility (assuming it does come back at some point), the loss is removed, thus it is not permanent. However, it can also happen that the impermanent loss becomes permanent.

This occurs when the liquidity provider withdraws their funds, taking in the losses, or when the price continues to diverge, resulting in an even more significant loss of tokens. Especially in the short term, losses can become permanent due to volatility. This can negatively affect a user’s investment in a pool and lead to negative returns.

How to Mitigate Impermanent Loss?

A couple of strategies can be adopted to mitigate impermanent loss.

Avoid Volatile Liquidity Pools

In contrast to stablecoins that are pegged to the value of an external asset, the price of crypto assets such as ETH fluctuates depending on the market demand. When it comes to impermanent loss, the greatest risk comes from volatile assets. If you think that a coin like ETH is volatile, then think twice before considering smaller coins that have even greater price swings.

Provide Liquidity for Liquidity Pools Pegged to the Same Asset

Stablecoins such as Tether (USDT) or USC coin (USDC) are pegged to the USD dollar. This means that their price is always around $1, with very little room for volatility compared to other crypto assets.

Also, theoretically, since they are pegged to the same asset, even the small volatility that they experience should be in the same direction, but this is not always the case. Stablecoin liquidity pools are usually in high demand, thus they do not offer great returns in comparison to more exotic pools.

Usually, the more exotic the tokens from a liquidity pool are, the greater returns they produce, but they also come with a bigger risk for impermanent loss.

That is why, if you want to be on the safe side, you should consider larger pools despite bringing smaller returns, since those are not hit so hard from fluctuations. After all, the more assets are pooled together, the harder it is for price swings to occur within that pool.

We hope you have now gained a better understanding of what impermanent loss is and how to avoid it. Finally, please make sure to:

🤖Follow us on Twitter | Instagram | Facebook | LinkedIn ;

Should you need to:

🗨️Contact us Support | Telegram ;

Read about us on:

📢About us Website | Platform | Blog

--

--

EQIFi

EQIFI democratizes financial products previously only available to the privileged few.