Sometimes you have provided liquidity to a pool for some nice APY and suddenly you retrieve less funds than expected or even worse, get losses. We will explain what these pools are, how they work, and how to prevent losing funds.
Through this article, you will also learn the effects of unbalanced pools and study a case where a stable coin is de-peg (as we have recently seen with huge “stablecoins“ such as UST, USDT, MIM, “TOMB”, etc…)
What is a Liquidity Pool and why we need them in DeFi?
First of all, what is a pool? Liquidity pools enable users to buy and sell crypto on decentralized exchanges and other DeFi platforms without the need for centralized market makers.
A liquidity pool is a crowdsourced pool of cryptocurrencies or tokens locked in a smart contract that is used to facilitate trades between the assets on a decentralized exchange (DEX). Instead of traditional markets of buyers and sellers, many decentralized finance (DeFi) platforms use automated market makers (AMMs), which allow digital assets to be traded in an automatic and permissionless manner through the use of liquidity pools. - Cryptopedia
The main concept to get here is, Liquidity pools are a mechanism by which users can pool their assets in a DEX’s smart contract to provide asset liquidity for traders to swap between currencies. And liquidity providers get swap fees and often liquidity mining rewards (Protocol Tokens) as compensation for providing liquidity.
Providing Liquidity to a Pool
Until this point, everything is straightforward and easy. But we will show you what complications can appear for the lp (liquidity provider).
When providing liquidity, a popular option is choosing Stablecoins Pools in order to avoid impermanent loss. They consist of two different Stablecoins pegged to the $USD. As these assets are supposed to maintain the $1 dollar value, liquidity providers will earn trading fees and some liquidity mining rewards, increasing their initial investment. But is this always true? What complications could happen?
We will use SpookySwap as an example of a DEX. Currently is one of the largest DEXes by TVL, with $230M at the time of writing the article.
We will use, the USDC-DAI Pool has $1M of TVL with the reserves distributed in an equal manner (50/50) between both assets (50% USDC / 50% DAI). This 50/50 would be the ideal scenario but this is the real world, so now we will also cover what happens when it is not a 50/50 balance, in other words, unbalanced pools and the impact of one stablecoin (MIM) de-peg.
When providing liquidity to SpookySwap, the investor deposit DAI-USDc and receive in return LP Tokens.
LP tokens are used to track individual contributions to the overall liquidity pool, as LP Token will contain a proportional share of the constituents of the pool according to the reserves of each asset on the pool.
In really simple words, LP tokens are the “ticket” you received for the deposited funds that verify you are the owner of those funds.
Balance Pool Example
In an initial scenario, the USDC-DAI Pool has $1M of TVL with the reserves distributed in an equal manner between USDC and DAI. As can be appreciated in the image below, this is $500K each. In this particular pool state, 1 DAI = 1 USDC. For simplicity, we are considering USDC is equal to 1$.
Jimmy is a DeFi liquidity provider. If Jimmy would like to provide liquidity to this pool and wants to invest 1000$ into the Pool, this represents investment represents 0,001% of the pool TVL, and needs to be deposited in the same proportion as the pool holds. So, he will need to add 500 USDC and 500 DAI liquidity to receive 1000 LPs. Jimmy deposits their funds as liquidity in order to get some nice trading fees.
After one month, Jimmy wants to withdraw his liquidity from Spooky. Therefore, he transfers his LP back to Spooky and gets some USDC and DAI back. In this case and this pool state, he will receive around 500 USDC and 500 DAI ($1000 in LP)+ trading fees + protocol token reward (BOOs), let’s say for example the retrieved funds are $1010.
1000 LP = 500 DAI + 500 USDC
Since USDC and DAI are still worth the same, around 1$, this means Jimmy can withdraw the same amount of token he deposited.
500 USDC * 1$ + 500 DAI * 1$ = 1000$
Jimmy also made a nice profit of 10$ from trading fees, during the month of providing liquidity. Which is around 12% APY, not bad for Jimmy.
Jimmy is happy as he has made some money.
But Jimmy would not be so happy if, when withdrawing the funds the pool was unbalanced, as in the following example.
Unbalanced Pool Example
In this case, as we can see in the pool reserves the ratio is 4/1, This means that 1 USDC is worth 4 times more than DAI.
So Jimmy 1000 LPs represent the following:
1000 LP = 800 DAI + 200 USDC
Since USDC still worth 1$ and DAI is 4 times less it means it is worth 25c.
200 USDC * 1$ + 800 DAI * 0,25$ = 400$
This means that the total amount of funds withdrawn is 400$. This makes Jimmy very sad since we deposited 1000$ but not it has 400$ plus 10$ of trading fees.
*To understand how liquidity pools work, please read our previous article.
What should Jimmy do to mitigate this loss?
- In case the unbalance is local (only affecting that particular pool) he should remove liquidity as it is, meaning 200 USDC and 800 DAI, and convert the 800 DAI in the DEX which offers the best rate. After these actions, Jimmy will end up with $1000.
- If the unbalance is global, meaning DAI has lost his 1:1 peg with USDC, he does not have much to do as he will incur a loss until DAI recovers the peg.
Case of MIM depeg
After the 0xSifu scandal, millions of MIM were sold causing MIM to lose its peg versus DAI, USDC, and USDT. As a matter of today, MIM has still not fully recovered from this de-peg.
The image below shows the state of Ethereum Curve’s MIM pool on the day when the scandal was published. At that moment:
- Anyone could swap $1M USDC for $1,022M MIM
- Pool total TVL was $690M.
- Reserves were in a 95–5 MIM-3Crv ratio.
If a liquidity provider would have chosen to remove liquidity at that moment, he would have received 95% MIM and 5% 3Crv (3Crv is DAI-USDC-USDT). Later, when converting those MIM for other stables in an unbalanced pool, he will incur some losses.
In summary, when acting as liquidity providers we need to have this into account:
- Collateralized stables are stronger than algorithmic ones.
- Stablecoins with some track record (USDC DAI) are less likely to experiment de-peg.
- Pools with big TVL are less susceptible to get unbalanced.
- Stable type Pools (Curve type) help to maintain the peg of the assets.
Providing Liquidity to a Pool can be really lucrative but you need to take into consideration the points we highlighted in this article (Unbalance Pools, De-peg, new stable coins). Our advice is to use popular pools with a good track record from big DEXs. If a pool is giving a 1000% APY, you should be skeptic of it. You can still earn a lot of money with these pools, but you get a higher exposure to the risks we talked about before.
Thanks for reading the article. We hope it was helpful. Stay Safu and happy yield!
Made with love by Epsylon Team. ❤️