In this article, I will try to explain the main benefits and risks involved when using a DeFi platform with a spotlight on Impermanent Loss
Author: Lorenzo Primiterra
Originally published at: https://lorenzoprimiterra.medium.com/decentralized-finance-what-impermanent-loss-7022c5d0b24a
With the advent and rise in popularity of new DeFi platforms and projects, a lot of people have been sucked into the temptation to throw a lot of money into a variety of these DeFi options without understanding the risks.
In this article, I will try to explain the main benefits and risks involved when using a DeFi platform with a spotlight on Impermanent Loss, the most difficult aspect to understand for any liquidity provide
Let’s first take a step back and describe how a platform like Uniswap works and how a liquidity provider can earn money:
Uniswap is a decentralized exchange where you can exchange your coins without having to register on an exchange and complete the KYC with all the bureaucracy involved. For example, you can simply deposit your ETH and swap them for USDT for a very small fee and then finally withdraw your USDT.
How this system works is more complex and beyond the scope of the article, but you need to know that everything is managed by a smart contract and, even if in most of the cases the smart contracts are audited, there can still be a risk since the smart contracts can be hacked.
In a platform like Uniswap, anybody can create a new pool with a new token and at the moment there are more than 100 token pairs available with an estimated total of 200 ERC20 tokens available.
So how does this work?
You can provide liquidity by depositing one pair of coins in a swap pool, but the total value of the deposited coins has to be the same. Let’s assume 1 ETH is valued 400 USDT, so, for the ETH-USDT pair, you need to deposit 400 USDT for every ETH you deposit into the pool. Let’s pretend we deposit 10 ETH and 4000 USDT.
A natural question arises here: why would you deposit these coins into the pool? What are the advantages?
As a liquidity provider, you collect a percentage of the fees collected by the platform, Uniswap charges 0.30% for every trade, and this fee is proportionally distributed to the liquidity providers with this formula:
"Total liquidity in the pool / My liquidity in the pool"
So, as in this example, if there are 40.000 USDT and 100 ETH in this pool, my reward will be 10% of all the trading fees because I’m providing 10% of the total liquidity of the pool.
In addition to the fees, many platforms distribute their tokens to the liquidity providers to keep them in the ecosystem, incentivizing the addition of more liquidity and increased use of the platform. This is known as yield farming or liquidity mining, but this will be explored in another article.
So, providing liquidity and collecting fees, seems like the best way to make some easy money with all the liquidity I don’t need at the moment and thus the best way to generate passive income!
Wait, what are the risks?
“There Is No Free Lunch on Wall Street” and there cannot be either in the cryptoverse.
Well, one of the risks can be the smart contract risk. Usually, these smart contracts are audited and secure, but they have still been programmed by humans and humans can make errors. Once a smart contract is compromised, the hacker can even drain it until it's empty and there is no way to recover the liquidity. But, in my personal opinion, this risk is not as big as it is portrayed unless you put your money on brand new platforms, especially the ones who clearly state they are in a beta phase!
The other main risk, often not really considered or understood by the general public, is the Impermanent Loss.
To keep the price in the pool in line with the real world price, the pool has to rely on arbitrageurs taking out the tokens that appreciated in value from the liquidity pool in order to sell them elsewhere for a profit.
Let’s assume that the price of ETH goes up in value to $450, and the arbitrageur notices this price difference and can then get “cheap” ETH for only $400 (or 400 USDT).
The algorithm that determines the price of an ETH in the pool is called “constant product market maker”, which assures that there is a correct ratio of the two tokens in the pool. In this case, the more ET that is being bought from the pool, the higher the price of ETH, until eventually, it reaches $440.
If you are interested in the formulas, check out this article.
After the arbitrageur buys enough cheap ETH, there will now be approximately 41952.35 USDT and 95.346 ETH in the pool.
Our 1% share is 4195.23 USDT and 9.5346 ETH = 8390
So, we gained $390 right?
Not exactly because, if we compared this gain with simply holding the tokens, we would end up with the same amount of tokens we started with (10 ETH and 4000 USDT) for a total value of 10*440 = 4400 + 4000 = $8400
As you can see, if we just had held the original tokens we would have gained $10 more, or a bit less than 1%. This 1% is our impermanent loss.
Impermanent loss is called “Impermanent” because of the price fluctuation: it’s only a temporary loss of funds when providing liquidity. If the price of ETH, in this case, would go back to $400, the IL would go back to zero, but it will become permanent the moment you withdraw your liquidity from the pool.
Here, you can find a graph to understand the impermanent loss in relation to price volatility.
So, is being a liquidity provider profitable or not? Can you still make money? Sure you can, upon the condition that the fees you collected over time covers for these Impermanent losses!
Or can you provide liquidity in a pool with two stable coins such as USDT / USDC, USDT / DAI, where the price of these tokens is linked to the US Dollar. The risk of Impermanent Loss in such pool is close to zero as both assets are so not volatile. Another way is providing liquidity in a pool where the two pairs are two different flavors of the same token such as sBTC, renBTC and wBTC.
Once you fully understand what Impermanent Loss is and how it can affect your revenue you can embrace this new incredible world of Decentralized Finance.