Liquidity providing & IL

Linka
Luchadores Chronicles
4 min readDec 27, 2021

Decentralized exchanges such as Uniswap, Balancer or Curve allow anyone with token to become a market-maker, in order to receive trading fees or liquidity mining tokens in exchange (a new way for a DeFi project to distribute their tokens)
The democratization of these kinds of DeFi protocols allows for the emergence of a frictionless economy in the crypto ecosystem.
But then, what do you need to know if you too want to provide liquidity? We’ll discuss one of the most important concepts: impermanent loss (IL).

What is the impermanent loss ?

Impermanent loss occurs when you provide tokens in a liquidity pool (LP) and the ratio between these two tokens changes. The larger the gap between the price of the deposit token and the current price, the more you are exposed to impermanent loss. Also the weighting of the assets in the pool has an impact on the IL.

IL according to the weighting

How does it work?

Let’s see together with an example, let’s say that there are several LUCHA liquidity pools against several (MATIC, USDC, MUST…).
Our example focuses on a single pool 50% USDC / 50% LUCHA on Uniswap:

IL curve for 50/50 weighting

Total LP Uniswap = 990,000 LUCHA & 29,700 USDC

Batman deposit 10,000 LUCHA et 300 USDC

New total LP Uniswap = 1,000,000 LUCHA & 30,000 USDC

Ratio of 1 LUCHA / 0.03 USDC & total eq. amount of 60,000 USDC
Batman have 1% LP share

Now let’s say that the LUCHA price is 0.11 USDC on the other pools (MATIC, MUST …) and that there have been no new deposits since Batman. LUCHA is trading at 0.03 USDC on the LP Uniswap, while it can be sold at 0.11 USDC on others LP.
Traders will arbitrage the price of LUCHA by adding USDC to the pool and withdrawing LUCHA to sell on the other pools until equilibrium is reached. After arbitrage the market price of LUCHA is 0.10 USDC.

New Total LP Uniswap : 5,477,200 LUCHA & 54,772 USDC

Ratio of 1 LUCHA / 0.1 USDC total eq. amount of 109,544 USDC

Batman, decides to withdraw his funds. As we said before, no additional liquidity so he still holds 1% of the pool …

Impermanent loss to permanent loss

But what would have happened if he had just kept 10,000 LUCHA and 300 USDC? Although misleading, the term “impermanent loss” is used because they are only effective if you withdraw your tokens from the liquidity pool.

Initial deposit was 10,000 LUCHA et 300 USDC

Ratio of 1 LUCHA / 0.03 USDC, total eq. was 600 USDC
Now is 1 LUCHA / 0.1 USDC, total eq.
is now 1,300 USDC

Because of IL withdraw is ~ 5,477.20 LUCHA & 547.72 USDC

Ratio of 1 LUCHA / 0.1 USDC, total eq. ~1,095.44 USDC

Yes, you read correctly, the total value of these assets would be $1300, a loss of 15.73% or ~$204.46

How do you calculate IL ?

As we have seen, the IL occurs when the price of the assets in the pool changes. Of course, depending on the weight of the assets in the pool, the impermanent los is different. Indeed, the larger the share of the volatile asset in the pool, the lower the volatility.

In the case of Uniswap and the 50/50 pool, according to the previous formula, here is an idea of the losses according to the change of the ratio versus asset holding:

  • price change of x1.25 = 0.6% loss
  • price change of x1.50 = 2.0% loss
  • price change of x1.75 = 3.8% loss
  • price change of x2 = 5.7% loss
  • price change of x3 = 13.4% loss
  • price change of x4 = 20% loss
  • price change of x5 = 25.5% loss

You can use the excellent IL simulation tool from Balancer https://balancer.tools/impermanentLoss

Why provide liquidity?

IL can be compensated by transaction fees (usually 0.30%) or liquidity mining, even the most exposed pools can be profitable in the long run.

Swap fees

Uniswap charges a 0.3% fee on each transaction. These fees are then distributed to the liquidity providers. If a pool has a large transaction volume, the fee can be enough to compensate for non-permanent losses. This depends on the protocol, the pool, the assets deposited and of course the market conditions.

Liquidity Mining

As for liquidity mining, it is a new way for a DeFi project to distribute their tokens. Unlike ICOs, STOs and other IEOs, tokens are not sold to investors, but must be earned by taking part in the operation of the protocol by liquidity providing. Afterwards, the protocol redistributes its tokens in proportion to the deposit of the different liquidity providers.

However, it is still essential to understand non-permanent losses before providing liquidity to a DeFi protocol.

There is something important you need to understand: whether the asset goes down or up only the ratio between the current price and the price at the time of deposit defines your IL. Feel free to start with a small amount, so you can get familiar with MAs while enjoying their performance.

--

--

Linka
Luchadores Chronicles

🦇🔊 enthusiastic building an autobattler fully on-chain Luchadores.io ⬡ Praying the VRF Goddess 📿