What is Impermanent Loss?

Impermanent Loss (IL) happens when you deposit tokens into a liquidity pair and one of the tokens changes in value while the other remains more stable. This is because the liquidity pool maintains a balance in the value of the tokens deposited. When one token increases in value, the amount of that token in the pool decreases, and the other increases to maintain balance. In this case, it would have just been better for you to hold the original tokens to take profits from the run-up.


Why deposit into liquidity pools?

DEX’s incentivize users to provide liquidity by offering them rewards in the form of yield. As long as the tokens do not change too radically in value, these rewards cancel out the IL suffered by LP providers. This is true of token pairs with assets that do not vary significantly in value (i.e., stablecoins like FRAX). Protocols can offer a share of their trading fees to provide these rewards.

How does a liquidity pair work?

DEXs require liquidity to allow users to trade on their platforms without incurring high slippage. Liquidity pairs usually consist of two tokens deposited in amounts of equal value. A pair of tokens of equal value can be deposited in a protocol as a liquidity pair in exchange for an LP token.

Your LP token will represent your share of the total value of the liquidity pool. Let's say the pool has 1000 TEMPLE and 650 FRAX; you have a claim to 10% of the pool. If we use TEMPLE/FRAX as an example, when TEMPLE is trading at IV, and the value of 1 TEMPLE = 0.65 FRAX, then our liquidity pair could be 100 TEMPLE and 65 FRAX.

The AMM does not actually set the price of the assets in the pool; users do this by depositing and withdrawing assets as the price changes. If the TEMPLE price goes higher, more TEMPLE will be taken out by users seeking profits, and more FRAX will be added to the pool. The liquidity stays the same but the ratio of assets in the pool changes.

liquidity pool.png

We know that the price of Temple cannot go under 0.65 FRAX, but what happens if it goes higher?

An LP token is essentially an accounting mechanism representing your claim to a number of tokens in this pair that are equal in value. While your tokens are staked, the protocol is constantly rebalancing the pair so that each side equals the other.

Since the price of FRAX is fixed to the dollar, we can assume this will not change. If the price of Temple moons, then those who have deposited their TEMPLE tokens into an LP with FRAX will suffer some impermanent loss.

For Templars who want to estimate possible IL for the FRAX/TEMPLE liquidity pool on STAX liquidity pool we've created this impermanent loss calculator 🧮

The equations are based on the price change of TEMPLE, APY rewards and length of time locked. You can simply change the appropriate values to calculate the IL for a given scenario and price change.

Let’s say the price of TEMPLE does a 2x, increasing to 1.3 FRAX. In our example of the user who deposited 100 TEMPLE and 65 FRAX, the pool would be rebalanced, and if they choose to withdraw their liquidity now, it would look like this:

Start with 200 TEMPLE:

Swap half of your TEMPLE for FRAX to deposit in the LP:
100 TEMPLE ($0.65) = $65
65 FRAX = $65
Total investment = $130
TEMPLE does a 2x - After you deposited in the LP:
70.71 TEMPLE ($0.65) = $91.92
91.92 FRAX = $91.92
Total investment = $183.84
Profit = $53.84
TEMPLE does a 2x - You did not deposit in the LP:
100 TEMPLE ($1.3) = $130
65 FRAX = $65
Total investment = $195
Profit = $65
TEMPLE does a 2x - You never swapped any for FRAX:
200 TEMPLE ($1.3) = $260
Total investment = $260
Profit = $130

Summary of outcomes with the different scenarios:

No change in value
Held tokens, no change in value = $130 No profit
LPing FRAX/TEMPLE, no change in value = $130 + LP rewards Profit = LP rewards
TEMPLE does a 2x after you swapped 50% for FRAX to deposit in the LP
LPing 50/50 FRAX/TEMPLE (2x) = $183.84 ($53.84 profit) 41% of max profit
Holding 50/50 FRAX/TEMPLE (2x) = $195 ($65 profit) 50% of max profit
Holding only TEMPLE (2x) = $260 ($130 profit) 100% of max profit

In this example, if the value of TEMPLE goes up 2x, we made a profit no matter what; just holding FRAX/TEMPLE would have made us $11.16 more than depositing them in the LP but this does not include the rewards that the protocol paid us for staking. In this example, an 9% loss was incurred instead of just holding the original tokens; thus that is the staking rewards you would need to have earned to counter-balance the loss.