Sign In

In yield farming, what is an impermanent loss?

DeFi: Understanding impermanent loss

3650% APY, even 100,000%. These numbers are cool, till it’s not. Yield farming projects throw about the insane figures for APY and everyone wants to provide liquidity to farm more tokens, till it isn’t cool when you see your tokens diminishing in value or you make losses.

Rewind ⏪︎⏪︎ What does it mean to provide liquidity?

Let’s take a moment and discuss liquidity provision, as it happens on an Automated Market Maker (AMM) protocol like Uniswap, a decentralized protocol for automated liquidity provision on Ethereum.

An automated market maker (AMM) is a type of decentralized exchange (DEX) protocol that relies on a mathematical formula to price assets. Instead of using an order book like a traditional exchange, assets are priced according to a pricing algorithm.

For example, Uniswap uses x * y = k, where x is the amount of one token in the liquidity pool, and y is the amount of the other. In this formula, k is a fixed constant, meaning the pool’s total liquidity always has to remain the same.

Anyone can become a liquidity provider by depositing tokens into a smart contract and receive pool tokens in return. These pool tokens track the liquidity provider’s share of the total reserves and can be traded in for the underlying staked asset at any time. Liquidity is provided in pairs, so if you are staking $100 ETH in the ETH-USDT pool, you will have to stake $100 USDT in addition. It can be done in any proportion. 50–50%, 80–20% etc. Uniswap liquidity is usually in a 50–50 ratio.

There is a 0.3% charge as fees per swap, and liquidity providers receive a share of the fees accumulated based on the proportion contributed. For example, if you contributed 10% of the total liquidity provided, you receive 10% of the total fees.

All this is well and good, right? You may earn new tokens, you earn from fees, so what is it that is making people think twice about providing liquidity on Uniswap?

What happens to tokens in an AMM

In their raw form, AMMs are disconnected from external markets. If token prices change on external markets, an AMM doesn’t automatically adjust its prices. It takes the role of arbitrage traders to do this adjustment. This leads to impermanent loss.

Okay, you’ve got my attention. Tell me more

Impermanent loss is the difference between holding tokens in an AMM and holding them in your wallet. It occurs when the price of tokens inside an AMM diverge in any direction. The more divergence, the greater the impermanent loss.

Why is there a divergence in the first place?

The price of a token remains the same as the price at which you put it in the AMM. This is because AMMs are disconnected from external markets. As a result, if you provide liquidity to AMMs, your staked tokens lose value compared to if you simply held the tokens themselves in your wallet. This loss is impermanent because if the relative prices of tokens in the AMM return to the price it was when you entered the AMM, there’s no loss, plus you earn trading fees too. This rarely happens.

Let’s use an example

Say the price of ETH is 100USDT. In the ETH-USDT liquidity pool, equal nominal values of ETH and USDT will have to be deposited. For this example, let’s assume that there are 10 individuals contributing to the pool, with our special user named Gainzy. Gainzy has 1ETH and 100USDT bringing the dollar value of his deposit to 200USD at the time of deposit.

If all the other remaining individuals in the pool all send in 1ETH and 100 USDT, there will be a total of 10ETH and 1000 USDT in the pool. Gainzy has a 10% share of the pool, which has now 10000 total liquidity (10*1000=10,000).

If ETH price were to increase to 400 USDT, arbitrage traders will exchange USDT for ETH. It is important to note that AMMs do not have order books so the ratio between the assets in the pool determines the asset’s price. So while total liquidity remains constant in the pool, the ratio of the assets in it varies.

So now that ETH price is 400 USDT, the ratio between how much ETH or USDT is in the pool has changed due to the activity of arbitrageurs. There is now 5 ETH and 2000 USDT in the pool (5*2000=10,000).

When the time comes for Gainzy to withdraw his funds, he is entitled to 10% of whatever is in the pool, as that correlates with the amount he put in. As a result, he gets 0.5 ETH and 200 USDT bringing his total to $400.

On a normal day, this is sweet profit. Gainzy put in $200 and now has $400, but let’s consider a scenario where he simply held his 1ETH and 100 USDT in his wallet. The dollar value of his holdings would have been $500.

By contributing to the liquidity pool, Gainzy made a loss of 150$/ She would have been better off holding his tokens. Gainzy suffered from impermanent loss.

Why go through the stress when you are going to lose?

Well, providing liquidity means you earn on the fees that are charged. On Uniswap, liquidity providers can earn 0.3% on trades. You can also exchange stake LP tokens for a reward.

Share to Social Media