MultiversX Tracker is Live!

Understanding DeFi Part 2: Providing Liquidity, LP Tokens, and Impermanent Loss

All Cryptocurrencies

by COINS NEWS 52 Views

Introduction

This guide is the second and final part of a 2-part series that is meant to explain the core ideas underlying DeFi: automatic market makers, decentralized exchanges, and liquidity pools (and impermanent loss).

I highly recommend reading Part 1 before diving into this installment.

Part 1 can be found here: Understanding DeFi Part 1

Being a Liquidity Provider

Generally speaking, anyone can create a new liquidity pool to allow others to trade some specific pair. Once a pool has been made, anybody can provide liquidity to it, or withdraw their liquidity, at any time. When you provide liquidity, you must provide the two assets in equivalent amounts (at least, in the eyes of the pool, determined by the current ratio of the pool).

When you provide liquidity, the funds leave your wallet, unlike with staking. This is necessary, because these funds need to be mobile to facilitate swaps.

So, how does the pool know that some portion of its liquidity belongs to you?

When you add liquidity to a pool, it will give you some amount of a special token called an LP token. The token will be specific to the asset pair, and will be called something like LP-ETHUSDC. They will also be specific to the AMM you are using. These tokens are essentially vouchers for the liquidity in the pool that you own (this is necessary since the assets you provided are not in your wallet while they're in the pool, so you need proof they belong to you).

LP tokens are managed in such a way that the amount of this token that you, a liquidity provider, hold, is proportional to your slice of the pool. In other words, if you are providing 10% of all the liquidity in a pool, you will also have 10% of all LP-ETHUSDC tokens that exist on that AMM.

When you want to cash out, you trade in your LP tokens, and that lets the pool know how much ETH and USDC to give you back (in this example, you would get 10% of the ETH and 10% of the USDC in the pool, because you traded in 10% of all existing LP-ETHUSDC tokens, proving you owned 10% of the pool).

Note that trading fees are always just added to the pool as trades are made, making the total holdings of the pool go up, which means that when a liquidity provider pulls out their liquidity, the fees they earned while they were providing liquidity are naturally part of the share of the pool they have a claim to. So, in our example, the 10% of the pool that you own when you withdraw includes 10% of the fees that the pool has collected while you've been providing.

It is also worth understanding what happens when other providers either add or remove liquidity while you are providing liquidity. Say 10% of the liquidity in the pool belongs to you like in the above example, so you hold 10% of all LP-ETHUSDC tokens that exist as a voucher for your portion of the pool. Let's say that, after you add your liquidity, some other provider decides to join in, and they add such a large amount of liquidity that they double the size of the pool. Well, a whole bunch of new LP-ETHUSDC tokens will be minted and given to that person, and they will end up with 50% of all such tokens that exist. This will dilute your portion from 10% down to 5%. So now, when you redeem your LP tokens, you only get 5% of the pool. But this amounts to the same thing, because you are getting 5% of a pool that is twice as large. Similarly, if someone leaves the pool, they turn in their LP tokens, which get burnt. This increases your overall share of the remaining LP tokens, meaning you own a larger share of the pool, but the pool has gotten proportionally smaller, so you still own the same amount of assets in an absolute sense.

This means that your bottom line isn't really affected by others joining or leaving the pool, except for in the following way: a larger pool means the trading fees get split more ways, leading to less profits for each provider. The only way that a growing pool doesn't lead to decreasing fee rewards for the providers is if the trading volume is also growing at least as quickly as the pool is.

Risks

There are several risks you take on when you add your funds to a liquidity pool. You are taking on risk that the smart contract of the specific AMM you are using can be exploited. You are also exposed to a change in price of the two assets you are providing, because when you pull out your liquidity, it is given back to you in the form of those two assets. So it's like you were holding them all along.

So, in our example above, we are exposed to ETH price movements, we are exposed to USDC permanently losing its peg, and we are exposed to vulnerabilities in the smart contract of the AMM.

We are also always exposed to one more key risk which deserves its own section.

Impermanent Loss

Impermanent loss is a way that you can lose money when providing liquidity. More accurately, it refers to losing money relative to if you had just held the two assets rather than providing them to a pool. In other words, you may gain money in an absolute sense due to the value of the assets in the pool going up, but because of impermanent loss, you might have gained more money by just holding.

In order for it to be worth it to provide liquidity, the trading fees you earn (plus any additional yield incentives you might be getting) must be enough to counteract the impermanent loss that will happen to you.
First I'll tell you when impermanent loss happens, and then I'll explain what it is.

Impermanent loss happens whenever the price of the two assets in the pool change relative to each other. The "relative to each other" part is really important. If the two assets go up in perfect lockstep together, or down together, or stay still together, then there is no impermanent loss. But if one goes up or down while the other doesn't move, or they go up or down together, but by different amounts, or (worst of all) one goes up while the other goes down, then you will experience impermanent loss.

Note that this means providing liquidity for stable pairs like USDC/DAI means you are basically not exposed to impermanent loss or price movements, assuming pegs hold. This is why those pools tend to offer far less reward (less risk, less reward).

Also note that stable/non-stable pairs are not necessarily more safe from impermanent loss that non-stable/non-stable pairs. With the latter, if the two assets tend to go up together and down together, then that pair will likely experience less impermanent loss than a stable/non-stable pair.

To understand what impermanent loss actually is, we need an example. Let's imagine two scenarios: one in which you just hold 1 ETH and 2000 USDC, and one in which you provide 1 ETH and 2000 USDC to a liquidity pool. Assume that the price of ETH is 2000 USDC at the time you provide to the pool, and that you own 10% of the pool. Thus, the pool must have 10 ETH and 20,000 USDC in it. Assume for simplicity that no other liquidity provider adds or removes liquidity to the pool while you are in it.

Now let's say the price of ETH in the eyes of the world spikes to 3000 USDC. This would cause arbitrage traders to quickly buy up 2 ETH from our pool for 2000 USDC each, because that would mean the pool now contains 8 ETH and, 24,000 USDC, which is a ratio of 3000 : 1. This means that our pool is now in agreement with the rest of the world, so we have found equilibrium, and there are no more arbitrage opportunities.
Now let's say you pull your liquidity. You own 10% of the LP tokens, so you get 10% of the 8 ETH, and 10% of the 24,000 USDC. So, you get 0.8 ETH and 2400 USDC. Since ETH is worth 3000, the total value of your assets is (0.8 * 3000) + 2400 = $4800.

As for our holder: they still have 1 ETH and 2000 USDC, for a total of $5000.

So, we lost $200 to impermanent loss by providing liquidity. Hopefully the trading fees and yield incentives were enough to offset that so that we are actually rewarded for taking more risk than holding.

In conclusion, to lower your impermanent loss risk, you want to provide liquidity for pairs whose prices tend to move approximately together when they move at all.

Closing Thoughts

Now that you've read these two guides, you should have a good grounding in the core concepts of DeFi. We covered the impermanent loss that happens to liquidity providers when they supply to liquidity pools, which are the central idea of AMMs, which are the smart contracts at the heart of DEXes, which are the centerpiece of DeFi.

DeFi now contains a lot more than just decentralized exchanging. Some of the other things you can do are borrow and lend, insure your assets, make synthetic assets, trade derivatives, use dynamic yield optimizers, and take out flash loans. And this is sort of just scratching the surface.

The playground that is DeFi is full of many wonders. You could learn about it seemingly forever. Hopefully this post has given you a good launch pad to explore the rest of this world by teaching you the fundamentals of DeFi's most integral idea: decentralized trading.

submitted by /u/pseudoHappyHippy
[link] [comments]
Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments