Understanding Permanent Loss
This page uses an extended example to explain the risks of Permanent Loss, especially using Mode Both.
Elsewhere in these docs, it is indicated that Maverick’s Mode Both carries a risk of something called permanent loss. This is a novel concept, and its meaning may not be immediately clear to many users. This page explains how permanent loss can occur. It is intended for educational purposes only, and should not be understood to constitute financial advice.
In order to explain permanent loss, let’s really simplify a liquidity pool. We’ll use slightly rounder numbers than you’ll see in a real liquidity pool. We’ll also imagine simple, linear price movements, rather than the irregular, zigzag patterns that usually happen in reality. And we won’t be taking into account any fees earned, even though in reality any time an LP’s liquidity is used for swaps they earn a fee.
Let’s start by imagining an ABC-XYZ pool–that is, a pool containing the imaginary tokens ABC and XYZ–which starts at a price ratio of 1:1 (so 1 ABC is worth 1 XYZ). We’ll give this pool a bin width of 1%, which means that each bin covers a price range of 0.01 ABC/XYZ. If we also imagine a linear distribution of liquidity in the pool, it would look something like this:
A simplified Maverick AMM pool with imaginary ABC token on the left and imaginary XYZ token on the right.
Suppose Alice deposits an even mixture of ABC and XYZ into this pool–say 10 ABC and 10 XYZ. She selects Mode Both, because she wants to keep her liquidity as active as possible. She has read that this carries an increased risk of loss, but decides to continue anyway.
She deposits her 10 ABC and 10 XYZ into the current active bin. In our simplified model, this bin would cover a range where ABC sells for 1.00-1.01 XYZ and XYZ sells for 0.99-1.00 ABC.
Alice adds 10 ABC and 10 XYZ to the current active bin using Mode Both.
Now imagine that XYZ pumps in the market. In fact, its market value increases to 1.10 ABC. Alice’s pool is currently selling XYZ for 0.99-1 ABC, so traders will come and swap the pool’s XYZ to ABC.
Alice is swapped completely to ABC. To keep the math simple, let’s assume she got 1 ABC for every XYZ that was sold, so she now holds 20 ABC in that bin in this pool.
Traders swap ABC for XYZ and the current active bin (including Alice's liquidity) is swapped completely to ABC. The pool price moves one bin to the right in order to keep servicing swaps.
Once the AMM has sold all the XYZ it has available at 0.99-1 ABC, it will move to the next price range and start selling XYZ for 1-1.01 ABC. Since the market price is 1.10 ABC, traders will continue buying XYZ so long as the pool offers it at a discount.
We can expect the AMM to keep selling through each bin until the pool price is roughly equal to the market price. In this case, this would mean reaching the bin where XYZ = 1.09-1.10 ABC.
Traders continue to swap ABC for XYZ and the price continues to move right into the next bin over.
Since Alice selected Mode Both, the AMM has instructions to move her liquidity to follow the price, so that she can be ready to capture any trades if the price swings back the other way. This means that every time the price moves two bins ahead of Alice’s liquidity, her liquidity is moved one bin closer to the price.
Because Alice chose Mode Both for her liquidity, the AMM moves her liquidity one bin to the right to follow the price.
The end result is Alice’s 20 ABC will be moved by the AMM until it reaches the bin where XYZ = 1.09-1.10 ABC (one tick behind where price moved to). This means Alice’s 20 ABC is available for trades at a price of 0.91-0.92 XYZ. The Mode Both function is essentially offering a discount on Alice’s ABC, in order to make it available for trades ASAP.
The AMM continues to move liquidity to the right to follow the price right during this XYZ pump.
Now let’s assume the price of XYZ suddenly drops. Its market value decreases to 0.9 ABC. Right now, the AMM will buy XYZ for 1.09-1.10 ABC, meaning that traders will come and sell XYZ to Alice’s pool to take advantage of that price.
Once the ABC in the current active bin (which is selling for 0.91-0.92 XYZ) is sold through, the AMM will move to Alice’s bin and start selling the liquidity there–including her 20 ABC. Again, to keep things simple let’s say she gets a price of 0.92 XYZ for her 20 ABC. This leaves her holding 18.4 XYZ.
The market sentiment swings in the other direction, and traders begin swapping XYZ for ABC. The current active bin and Alice's bin are swapped completely to XYZ, and the price continues moving to the left in order to keep servicing swaps.
It may be immediately apparent that Alice has taken a loss here, since she only got 18.4 XYZ for her 20 ABC. For comparison, let’s imagine a world where she had used Mode Static instead of Mode Both. In that world, after the initial XYZ pump that swapped her to 20 ABC, her liquidity would not have moved. It would still be in the bin where the price of ABC = 1.00 - 1.01 XYZ. During this XYZ dump, her ABC would not have been sold until the price reached her bin, at which point she would have got something like 20 XYZ for her 20 ABC.
Maverick calls Alice’s loss “permanent loss,” because (unlike impermanent loss) it is now baked into her liquidity position. By selling low and buying high, Alice has lost some of her liquidity, and this will not be recovered through pool rebalancing.
In fact, permanent loss can actually compound: we said that the market value of XYZ had dumped to 0.9 ABC. This means that the AMM will continue selling through ABC in the pool until the pool price roughly equals the market price. This means when the pool price reaches the bin where XYZ = 0.90-0.91 ABC.
After Alice was sold through to 18.4 XYZ, Mode Both would again have done what it is designed to do: move her liquidity to follow price so that it is available to capture more swaps ASAP. Again, it would have followed one bin behind each price movement as the XYZ price moved down. The end result would be that Alice’s 18.4 XYZ would come to rest in the bin where XYZ = 0.91-0.92 ABC–once again, offering a discount to improve the chances of capturing trades.
Since Alice chose Mode Both, the AMM moves her liquidity to follow price in the opposite direction as well. Her liquidity ends up in the bin directly to the right of the current active bin.
If XYZ pumps again, Alice will quickly be sold through to ABC once again. For simplicity’s sake, let’s say she gets a price 0.92 ABC per XYZ. This leaves her holding 16.928 ABC while XYZ continues to pump.
This is why Mode Both is an especially risky choice for LPing volatile pairs. Every time Mode Both moves an LP’s liquidity, it is essentially offering a discount on their liquidity. The more bins it moves, the bigger the discount. And the more frequent the swings, the more opportunity for these discounts to compound into bigger losses.
If permanent loss is such a risk, why would I use Mode Both?
Mode Both is a better fit for stablecoin pairs. The relatively low volatility of these pairs means that LPs can provide liquidity in a narrow range without being exposed to as much permanent loss. Fees also tend to be higher, which can help offset any loss accrued from LPing. Stablecoin LPs in other range AMMs would have to spend a lot of gas (~800k per rebalance) in order to achieve similar capital efficiency to Mode Both.