MEXC Research: Protection Markets: AC’s Impermanent Loss Insurance Protocol for Uniswap V3 LPs
Impermanent loss is a type of loss that is usually encountered during liquidity mining on Uniswap or other DEXs. Deviations in the token price cause this loss. When the price returns to normal, this impermanent loss will be reversed too. What we are discussing in this article is impermanent profit/loss, not actual loss.
Suppose we deposit a pair of cryptocurrencies to provide liquidity in Uniswap. Even if one cryptocurrency’s price increases compared to its initial valuation, the total value of the assets after a withdrawal is less than that of holding both currencies directly. The amount that is missing is impermanent loss. The greater the deviation in price, the greater the loss, and may also result in actual loss, especially when a cryptocurrency is paired with a stablecoin.
Here’s An Example
Firstly, the automated market makers’ (AMM) feature is to collect all the assets into the liquidity pool and calculate the price automatically according to a particular algorithm. Uniswap is calculated by the constant product formula: X*Y=K. Thus, without relying on market makers, it is able to trade in real-time and fairly.
In short, as a liquidity provider, when the price falls, not only will the capital be at a loss, but it also forces an increase in position; On the contrary, when the price rises, it will be forced to reduce the position.
Consider a scenario where we are mining in the ETH-USDT pool on Uniswap. The pool has 100 ETH and 40,000 USDT, of which the number of tokens we invested in mining accounts for 1%, i.e., 1 ETH and 400 USDT. Constant product is 100*40,000=400,000.
For the sake of simplicity, we assume that no one is going to carry out deposit and withdrawal operations. The calculations also did not account for the mining revenue.
In the beginning, the price of ETH is 1ETH = 400USDT.
Later, the ETH price rises by 50%. After the increase, 1ETH = 600USDT.
Under a normal holding scenario, we will hold 1ETH+400USDT, that is, 600+400 equals 1,000 USDT.
Even if ETH’s price rises, according to the constant product calculation, 400,000/600 ≈ 81.6, our proportion is 1%, so we can extract assets of 0.81 ETH+489.9 USDT ≈ 979.79 USDT. Compared to the original 1,000 USDT, the loss is about 2%.
On March 24, Uniswap introduced Uniswap V3 via Twitter, announcing that the Layer1 Ethereum mainnet will launch in May and deploy Layer2 on Optimism.
Uniswap V3 introduces aggregated liquidity, range orders, and fee tiers. In short, users can expect to have lower Gas prices for Uniswap transactions and significantly higher capital efficiency than v2. At the same time, Uniswap introduces Layer2 and NFT.
The following section mainly introduces aggregated liquidity.
Liquidity providers (LPs) can fine-tune the price range of its capital allocation. Positions are aggregated into a pool to form a portfolio curve for users to trade.
In Uniswap V2, liquidity is evenly distributed according to the x*y=k price curve, and assets can be traded at all prices (0 to infinity). However, for some pools, the liquidity of most asset changes will not be used. For example, the liquidity of DAI/USDC only reserves about 0.5% of the funds for transactions between $0.99 USD and $1.01 USD, where the LP hopes to have the most transaction volume and obtain the most fees within this price range.
In Uniswap V3, LPs can focus assets within a customized price range, provide greater liquidity within the expected price range, and customize personalized price curves against their own preferences.
LPs can combine any number of different positions in a pool. For example, LPs in the ETH/USDT pool can allocate 10,000 USDT to ETH with a price range of 1,000–2,000 USDT and another 500 USDT to 1500–1750 USDT. This results in ETH in the price of 1000–2000 USDT to have its liquidity increase significantly, while in the price range of 1500–1750 USDT, the liquidity decreases.
Although users can focus their funds in the most active trading ranges to obtain the maximum profit and compensate for some impermanence losses, the impermanent losses is still present.
On July 3, Andre Cronje shared a prototype on Twitter called ProtectionMarket.sol, a pay-as-you-go protection market for impermanent losses on Uniswap. The contract specifies a pERC20 token, which functions as an independent protection market to protect against impermanent losses, with premiums determined by supply and demand.
There are two types of participants in the protection market, protectors and hedgers. These participants participate in the protection market for a specific Uniswap pool and define one of the two assets as a RESERVE, typically the unstable cryptocurrencies. In this market, both participants provide the RESERVE tokens to smart contracts and earn fees in return for providing insurance to hedgers by allowing them to exercise protection contracts to compensate for impermanent losses.
The following is a diagram of how the contract operates:
1. Protectors and hedgers both deposit reserve assets RESERVE in the contract.
2. Hedgers are offered some fees to purchase protection against impermanent losses.
3. Once paid, hedgers can exercise their contracts and close their insurance positions at any time.
4. Protectors and hedgers can withdraw their liquidity as long as they have enough liquidity to cover their hedge positions.
Because impermanent losses are offset by protection when prices rise or fall, profits may be made, that is, as compensation for impermanent losses.
For hedgers, a portion of the fee is provided to protect themselves from potential impermanent losses. When the insurance contract is closed, the hedger will receive (reserve assets + profit — fees)
For the protector, no profit will be generated; after closing the insurance, the (reserve assets + fees — profit) will be obtained.
The profit function is the blue curve below and is a function of price change. The red line shows the change in the profit function if the price change is compensated 1 to 1. For example, for a 20% price drop, compensation for impermanent losses (which can be interpreted as profit) is about 10%, but for a 20% rise, compensation is slightly less than 10%.
When the price changes slightly, there will be no impermanent loss and therefore no profit in the contract. As relative prices change, your impermanent losses increase, but you will reap profits.
Note that this profit function assumes a constant product function market and may actually need to be hedged in a well-liquidized market.
Protection Markets introduces an insurance mechanism for impermanent losses, offsetting them with fees and compensation. Based on the V3, liquidity providers may be able to make greater profits, enabling developers, traders, and liquidity providers to participate in a secure and robust market.