Impermanent loss is another DeFi jargon that is not complicated to understand but tricky to solve. Impermanent loss usually occurs when we compare the yield between holding certain cryptos in wallets and the yield from providing liquidity to certain liquidity pools in certain DeFi products. Before you try to understand, it is a good idea to understand AMM’s — Automated Market Makers in DeFi. You can read my post about Uniswap here.
AMMs are part of the DeFi ecosystem. They allow cryptocurrencies to be traded in a decentralized, permissionless fashion using public blockchains. AMMs use liquidity pools created from users' crypto assets and assets priced within the pool using algorithms. AMMs are disconnected from external crypto markets in their raw form. Arbitrageurs establish connectivity to the real-world crypto market. Let’s look at how an impermanent loss happens to a trader.
AMMs has a constant balance of assets that determines the price of tokens in a liquidity pool
The standard weightage for tokens in a two-token AMM liquidity pool is 50–50. Let’s bring back Bob & Alice. Alice deposits 1 ETH and 100 DAI in an AMM liquidity pool. The price of ETH is $100 at the time of deposit. This means Alice has a total deposit of $200 in the AMM. Bob has 9 ETH and 900 DAI in the same liquidity pool. The total value of tokens in the liquidity pool is $2000 with 10 ETH and 1000 DAI. So Alice has a 10% share of the pool. Imagine the price of ETH went up to $400 in the external market. This allows arbitrage traders to buy ETH cheap from the AMM by paying DAI. Arbitrageurs are incentivized to balance the total value of tokens on each side of the pool by selling DAI for ETH. When both sides of AMM are balanced in terms of the value, you will notice that the yield from ETH in the AMM is slightly lower than what you would have made by simply holding to the ETH token. Since the price of ETH is $400, the ratio of the number of tokens in the pool is changed to balance the token value on both sides of the pool. The pool now has 5 ETH and 2000 DAI, which amounts to a total liquidity value of $4000. If Alice withdraws her share from the pool, she will receive 10% of the value, 0.5 ETH and 200 DAI, which amounts to $400. She has made a decent profit from the pool. But think if she was holding 1 ETH and 100 DAI in her wallet. Her total profit would have been $400 from 1 ETH and $100 from 100 DAI, $500. This is what we call impermanent loss. The loss is not permanent because the loss is realized only if we withdraw from the pool. But I think it is misleading because the loss is permanent once you withdraw funds from a pool. Also, the impermanent loss can occur no matter which direction the price changes in a pool, and it is an unavoidable part of any AMM.
There are several ways you can mitigate the risk of impermanent loss in a DeFi liquidity pool. Assets with similar volatility in a liquidity pool can reduce the effect of impermanent loss. Also, liquidity pools with more than two assets and any flexible ratio are another way to reduce impermanent loss.
Uniswap v3 introduces a new concept that will use the capital provided by LPs [Liquidity Providers] more efficiently than in v2. The liquidity provided by LPs is usually allocated into different small price brackets from zero to infinity, and the LPs gain fees when trades happen in any of the price brackets where their liquidity is used. This is an inefficient way of using the capital because most of the time, the liquidity provided by LPs is not used. In Uniswap v3, liquidity providers use the concept called concentrated liquidity, where they can specify the price range where their capital will be used. When trades happen above or below the specified price range, the capital provided by LPs becomes inactive. This gives the advantage for LPs to make use of their liquidity more efficiently and with lower capital than in v2 but more fees collected. This also reduces price slippage in trades by adding more liquidity in popular price ranges.
Slippage is the price difference that occurs between the time when order is placed and executed due to volatility and higher volume of trades in AMMs
The downside with Uniswap v3 compared to V2 is that it has become an active trading DeFi protocol where LPs have to constantly monitor and adjust their liquidity price ranges to generate maximum fees.
Bancor v2.1 is designed so that the protocol ensures that the liquidity providers get back the same value originally deposited in the pool plus the trading fees collected through a concept called Impermanent Loss Insurance. Bancor relies on its token, Bancor Network Token — BNT, to generate fees called swap fees/transaction fees that occur whenever tokens are swapped into and out to BNT. BNT tokens are used as an intermediary currency when each token is traded in Bancor. Bancor protocol adds Bancor as co-investment to any liquidity pool created in the platform, and hence swap fees earned from BNT token can be used in the pools.
Impermanent Loss Insurance accrues over time, by 1% each day, until 100% protection is achieved after 100 days the assets are locked in the pool. There is a 30-day cliff, which means that if a liquidity provider decides to withdraw their position before 30 days passes, they’d incur the same IL loss experienced in a normal, unprotected AMM. If an LP withdraws any time after 100 days, they receive 100% compensation for any loss that occurred in the first 100 days, or anytime thereafter.
If fees earned by the protocol from its co-invested BNT are greater than IL [Impermanent Loss] compensation, the protocol can offset IL for LPs without emitting new BNT. If there are insufficient tokens in a pool to fully compensate LP for IL in the staked ERC20 token, the protocol will pay part of the IL protection in an equal value of BNT.