Impermanent Loss Insurance (Protection Markets) for Uniswap v3 LP’s

Gamma Strategies
Gamma Strategies
Published in
7 min readJul 4, 2021

--

Explaining in economic terms the recent smart contract Andre Cronje released ProtectionMarket.sol for teams to utilize.

Subscribe to our Active Assets Weekly Substack newsletter here.

Impermanent loss (IL) is top of mind for liquidity providers (LP), as its effects induce volatility in the returns to LP’ing, particularly for assets whose prices tend to diverge. As interest in liquidity provision has risen, innovations to deal with this risk have begun to be developed, and in this Gamma Strategies post we are going to review a recently shared contract by Andre from Yearn, Protection Markets.

A tweet on July 3rd by Andre Cronje shared a prototype for a pay-as-you-go insurance market for impermanent loss on Uniswap called, ProtectionMarket.sol. The contract specifies a pERC20 token which functions as a self-contained insurance market for protection against impermanent loss, with premiums determined by supply and demand.

Protection Market

Suppose you are interested in LPing in a WETH/USDC Uniswap v3 pool to earn the swap fees, but are concerned about potential severe price movements which could lead you to experience significant impermanent loss during your investment horizon. The prototype ProtectionMarket.sol contract offers the possibility to create a market where you can hedge this IL by supplying additional WETH to this market and protecting the exchange rate at which you supplied your assets from IL. This is done in exchange of an insurance premium, which is paid while the protection is active, as a variable % APY determined by supply and demand.

In this market there are two types of participants, Protectors and Hedgers. These agents participate in a insurance market over a specific Uniswap pool, and define one of the two assets as the RESERVE. In this market, both agents supply the RESERVE token to the smart contract, and earn fees as a reward for providing protection to Hedgers against impermanent loss, by allowing them to excercise the insurance contract, which compensates for the impermanent loss incurred.

A schematic diagram of the functioning of the contract is provided below:

  1. Both Protectors and Hedgers deposit RESERVEinto the contract
  2. Hedgers purchase protection from impermanent loss, by pre-supplying some fees earned by Protectors
  3. Hedgers can exercise their contract whenever they want, as long as they have paid their fees, and close their insurance position
  4. Both Protectors and Hedgers can withdraw their liquidity, as long as there is enough liquidity to cover the hedging positions
Diagram of ProtectionMarket.sol

Impermanent Loss Calculation

The contract allows you to protect a portion of the liquidity provided from IL, in exchange of constantly accruing fees. This mechanism pools different protection providers’ liquidity, spreading the risk of this hedge over all participants, while providing a new stream of revenue for defi, hedging fees (premiums in insurance speak), which are dynamically updated based on supply and demand.

When you execute the protect function you are effectively purchasing insurance against any impermanent loss that you may incur, compensating you for the price difference minus fees. The IL is calculated with respect of the price when you purchased protection, and does not refer to a specific position in the liquidity pool, allowing for maximum composability.

After purchasing the insurance and providing some pre-reserved fees, you are able to call the exercise function and execute your insurance contract, where your reserves will be modified by the following amount, which denotes the compensation for IL:

Profit function of ProtectionMarket.sol

Where p_0 is the price for a swap when you got your contract, and p_1 the price now, therefore the profit is a function of the price change, connecting the value of your position to impermanent loss.

Assuming decimals = 18, the profit function looks like the curve in blue below, as a function of the relative price change. In red I also show what the profit function would look like if it would compensate a price change 1 for 1, to show that for a 20% price decrease, the impermanent loss compensation is about 10%, but a bit less for 20% price increase.

The function overall behaves as you would expect, if prices do not move, you do not incur impermanent loss and thus the contract does not pay off anything, and as the relative price moves, the higher your impermanent loss. Note that this profit function assumes a constant product function market, so appropriately hedging a concentrated liquidity position will require some further effort.

Fee Structure & Economics

Fees are continuously compounded as a percentage of the hedged amount that is determined as an APY of utilization, the ratio of hedged liquidity (totalHedged) to overall liquidity in the pool (totalProtection) similar to Compound borrowing markets’ interest rates:

Compound USDC Supply Market Interest Rate Model on July 4, 2021

As the demand for hedging services increases, utilization should increase as well as the earned fee. This would incentivize more protection providers to supply into the pool, adding to the solvency of the insurance program. The Protection Market contract makes sure that the total amount hedged is at most the size of the full liquidity of the pool. This gives a significant amount of cover for hedgers even for extreme degrees of impermanent loss.

The most relevant parameters that determine whether Protection Markets are an economically viable proposition are the parameters of the fee function, and the size of the reserved fee requirement. These would have to be carefully calibrated in order to entice both protection providers and hedgers to supply to the pool.

In economic theory, insurance is evaluated by whether or not it is actuarially fair, that is, whether the fees paid reduce the variability of the potential outcomes enough (in this case, the impermanent loss accrued for providing liquidity) to make it worthwhile. Given the significant price movements we see on digital assets, the required fee could end up being substantial. However, it is difficult to estimate what would be reasonable without letting the market figure it out.

Usage for Liquidity Providers

Using a Protection Market for a liquidity position is a potential enhancement that can reduce the volatility of the return of the LP strategy, given the customizable exposure to impermanent loss that concentrated liquidity provides.

In this section we will present some preliminary analysis of the hedging ratio required to insure an LP position on Uniswap v3. Suppose liquidity is provided at price P over the range [p_a,p_b], and that prices change to p_1=k⋅p_0, the impermanent loss as a % change was derived as:

A comparison to the profit function of Protection Market that we looked at before would be useful in order to understand the amounts of hedging that would be required. Assume p_0=2100, and LPing over the [2000,2200] range, the following picturedisplays IL vs. the profit function of Protection Market.

Given the virtual liquidity provided by the concentrated liquidity feature of Uniswap v3, a relatively smaller hedging position needs to be established to cover for impermanent loss of a larger LP position when the range is relatively narrow as in this example.

In order to quantify the hedging ratio, consider computing the units of hedging q required to cover for a percentage change of IL k=p1⋅p0 (assuming no cost of maintaining the position):

Hedge Ratio Calculation
Hedge Ratio Calculation for Narrow Range

Taking the Protection Market profit function, you would need to purchase 0.05 units of insurance for each unit of your position. As a sanity check, consider an alternative, wider, LP range where you are exposed to less impermanent loss [100,15000], with the same initial price would require the following hedge ratios:

Hedge Ratio Calculation for Wide Range

Concluding Thoughts & Implementation

Impermanent Loss Protection Markets are a critical service that we expect to be highly demanded by Liquidity Providers. We are working with Visor to implement this service for their positions. This would provide an automated way to improve the risk profile of LP strategies on Uniswap v3. The pricing of this protection will be key, and the careful calibration of the fee system will be paramount to its adoption and success.

Every week Gamma Strategies publishes analysis and metrics of active asset management within DeFi:

Subscribe to our weekly Substack newsletter and follow us on Twitter

--

--

Gamma Strategies
Gamma Strategies

An organization dedicated to researching and funding ‘Active LP’ strategies.