Impermanent Loss Protection: the approach of Maya

Volatility is an issue in crypto, learn how to protect your finances as best as possible.

27 Jun 2022

10 min.

Key Takeaways

 

If you have considered providing liquidity in DeFi, or if you have read our previous article about Liquidity Providing in Maya, you are familiar with this term. Impermanent loss happens when the price of your tokens change compared to when you deposited them in the pool. The larger the change is, the bigger the loss.

This comes from one of the key mechanisms of the market-making engine called an automated market maker (AMM) as we outlined in our article “What is a DEX? What is a CEX?”.

However, at Maya Protocol we aim at being not only the safest & most decentralized exchange, but also the most user-friendly for liquidity providers. Therefore, we have implemented an Impermanent Loss Protection mechanism. We are so proud of it, we think it is the 8th wonder of crypto. Grab a cup of hot chocolate and keep reading! 

What is Impermanent Loss (IL)?

As you might remember (and if you don’t please read our article on providing liquidity to a Liquidity Pool), the Decentralized Exchanges (DEX) allow users swapping token A for token B (or in other words, selling token A to buy token B) thanks to liquidity providers, i.e, people that have provided token A and token B into a smart contract called Liquidity Pool, and they receive swap fees and other rewards in exchange.

As a liquidity provider, Impermanent Loss (often abbreviated IL) happens when the price of your deposited assets changes compared to when you deposited them. The bigger this change is, the more you are exposed to impermanent loss. In this case, the loss means less dollar value at the time of withdrawal than at the time of deposit.

So, first thing to remember: Impermanent Loss is denominated in dollar value, not in token A or token B.

Second thing to understand: It is called Impermanent because it is not realized as long as you don’t pull out the liquidity. If you don’t, and prices fluctuate back to its original position, the impermanent loss changes. 

It is similar to the concept of “paper loss” or “paper gain” when a stock you bought changes its price vs the price you bought it. It is in paper and will not be realized until you do an action (selling) that will “carve that gain or loss into stone”.

Understanding IL through an example

Let’s see an example with ETH and DAI. 

As you may know, ETH is Ether, the cryptocurrency that powers the Ethereum blockchain, and DAI is an ERC-20 token that is pegged to the US dollar, what is often called stablecoin. You can read more about the different types of cryptoassets here.

Let’s imagine that ETH is currently trading at $3,000. 

Since a liquidity provider needs to offer equal levels of liquidity in both DAI and ETH, he adds 1 ETH and 3,000 DAI to a ETH/DAI pool. For ease of calculation, we will imagine that the pool only contains the liquidity that this provider has added.  So the total pool contains $6,000 in value: 1 ETH and 3,000 DAI.

After he has done that, he starts earning rewards in the form of swap fees and possibly liquidity mining rewards. 

But suddenly, the price of ETH goes up to $3,200.

This creates an irresistible opportunity for arbitrage because the price of ETH in the liquidity pool still reflects $3000 (as there are 3,000 DAI for each ETH in the pool), but this doesn’t reflect what’s going on in the real world. To ensure the ratio of DAI to ETH remains balanced, other traders will buy ETH at a discounted rate by adding DAI in the pool, until there’s equilibrium again.

In particular, the equilibrium is found with 0.96825 ETH and 3098.4 DAI in the pool (since both will have the same dollar value of $3098.4).

Remember, AMMs don’t have order books. What determines the price of the assets in the pool is the ratio between them in the pool.

So if we do the ratio 3098.40.96825, this gives us 3200.

If the liquidity provider decides to withdraw his funds at this very moment, he will withdraw 0.96825 ETH and 3098.4 DAI, which at current prices of $3200 per ETH and $1 per DAI, means he is withdrawing $ 6,196.8. Note that in this example we are not adding the swap fees he would have bagged thanks to the activity happening in the pool.

However, if he had left the two assets in his wallet, simply HODLing it, he would have 1 ETH worth $3,200 and 3,000 DAI worth $3,000, for a total of $6,200. 

In particular, he lost $ 3.2$6,200 = 0.05% of his funds.

Doesn’t seem like a lot, but of course in periods of great volatility it can cause a dent in your portfolio.

Sizing IL mathematically

So, impermanent loss happens when the price of the assets in the pool changes. But how much is it exactly? We can plot this on a graph. Note that it doesn’t account for fees earned for providing liquidity.

Chart, line chart, scatter chartDescription automatically generated

What this means, in terms of “loss due to LP” vs “Holding the assets in your wallet”:

As you can see, IL can become noticeable when one of the assets at least doubles in price vs the other.

Why would people provide liquidity despite IL?

In many cases, the fees earned (thanks to swap fees) would negate the losses and make providing liquidity profitable nevertheless. Even in more cases, the liquidity mining rewards offered as incentive by most of protocols make liquidity provision a very profitable strategy.

Despite this, it’s crucial to understand impermanent loss before providing liquidity to a DeFi protocol.

Either that… or you provide liquidity with Maya! Because at Maya, we have the ultimate weapon against Impermanent Loss. An additional layer of compensation so IL doesn’t keep you up at night.

IL Protection (ILP): the Maya Approach

In Maya, on top of the swap fees and the liquidity mining incentives already covered in our Liquidity Pool article, there is another incentive for Liquidity Providers called Impermanent Loss Protection (ILP), that kicks in after withdrawing liquidity and having joined the pool for 100 days. 

ILP guarantees that you will always be better of providing liquidity with your portfolio rather than just holding CACAO and any other asset in your wallet.

ILP is based on the 50:50 symmetrical deposit of both assets. If the user chose to deposit asymmetrically instead, ILP calculation will be based on after the initial 50% swap to balance the pool.

In other words, if you add 1,000,000 CACAO asymmetrically to the BTC:CACAO pool, Maya is swapping half of the assets (500,000 CACAO) for BTC, and then, only then, the Impermanent Loss Protection mechanism enters into play.

If after 100 days in the LP, the user withdraws and the IL is greater than the earnings from swap fees and rewards, then the ILP will kick in and reimburse the differential amount. This way, Maya ensures that users will at least withdraw the same total value as per the assets provided in the initial deposit, at the current day’s market value.

If a user withdraws before 100 days, then the eligibility for ILP is proportional to the duration:  50% protection after 50 days in the pool, 75% protection after 75 days in the pool, etc. 

Note 1: ILP does not protect you from both assets depreciating. This loss would occur if you were just holding the assets in your wallet anyways.

Note 2: Since prices have changed vs the moment you deposited liquidity, the actual quantity of both tokens during withdrawal may be different vs the deposit; but users can always then swap one for the other and obtain the exact same deposited amount of asset. What you end up with is the same dollar value.

Note 3: if users top-up their LP upon an existing position, the ILP timer counter will be reset back to zero for the position.