Chapter 4 - How to Hedge IL (Full Range)

How it Works

GammaSwap allows you to get the opposite exposure of a Liquidity Provider turning Impermanent Loss into Impermanent Gain. When you open a perpetual option (Straddle, Long, Short), the protocol burns the LP token and holds onto the underlying tokens in the smart contract. The debt is measured by the Liquidity Invariant - the product in the x * y = k formula. You can think of it like Aave but instead of the borrowed capital going to your wallet it stays in the smart contract. The debt isn't in spot but instead in the value of the LP position.

If there is volatility, the debt becomes relatively cheaper and the trader profits from the difference. The trader owes swap fees that the LP position would have earned + additional fees based on utilization of the pool. The trader is making the bet that Impermanent Loss will be higher than the fees earned or is looking to hedge that exposure.

Think of it this way. Let's say someone borrows $10,000 of ETH and USDC when ETH is $1000.

They would burn $10,000 worth of LP to hold 5 ETH and 5000 USDC in a perpetual option straddle loan. The constant product is x * y = k. X is the supply of ETH, Y is the supply of USDC and K is the constant product. Substititue in the values 5 (ETH) x 5000 (USDC) = 25,000 (K).

Let's exclude fees to borrow and fees that accrue to the LP position for simplicity. Now ETH pumps to $2000 dollars. Remember, the debt of the straddle and the LP position must maintain the constant product K in this case 25,000 so we solve for the new ETH and USDC balances.

Let 𝑥 be the new ETH amount and 𝑦 be the new USDC amount. Since ETH is $2,000 now, the new price implies: x/y = 2000. Meanwhile the constant product stays the same x*y=2500.

Substitute in the values and x=3.53 while y=7071. Therefore, the new portion of the pool holds 3.535 ETH * $2000 = $7,071. Adding the USDC and the total LP is now $14,142.

The portion borrowed out for the straddle did not experience any rebalancing since it was removed from the liquidity pool. The value of the borrowed collateral is 5 ETH * 2000 + 5000 USDC = $15,000. Therefore, excluding fees, the straddle owner has a debt worth $14,142 but the borrowed collateral is worth $15,000. The straddle owner can close the position and profit the difference ($15,000 - $14,142) of $858.

How to Execute the IL Hedge

To execute the IL hedge, you must match your notional straddle position to be the same size as your LP position. Remember providing liquidity is like selling a perpetual short straddle (from Chapter 3) so borrowing liquidity in the form of a straddle will hedge this IL exposure. Example using $10,000 LP deposit in the Aerodrome Basic Volatile ETH/USDC pool where the price is $2,433 ETH.

Liquidity Provider Deposit:

  • 2.05 WETH - ~$4,987

  • 5,016 USDC - ~$5,013

$4,987 + $5,013 = $10,000 He will be earning 13.82% APY but has IL risk if the price of ETH changes. That IL risk can be calculated here.

Now, our good friend Chad is very smart (along with being handsome). He knows that IL can eat into his profits. He wants to hedge his full range LP position. Here is how he will do it. Chad will open a straddle with a notional position of $10,000 with a conservative time to liquidation.

We can see some of the details of the position here that are important for Chad to take into account before opening his position.

We can see the trade position which is a straddle, the deposit value of 251 USDC with moderate leverage gives us a $10k notional LP with 172 days to liquidation. The current borrow APR is 4.13%. A couple things to note here:

  • Leverage is a sliding scale here representing LTV. The higher the LTV, the more capital efficient the position is but the shorter the time to liquidation will be. You can choose whatever leverage you like as long as the notional value matches the LP position.

  • The time to liquidation is not static and can change based on the borrow APR. The formula is Time_to_Liquidation_in_Days = [ln(99.5%/LTV)/Borrow_APR] * 365

To calculate the net yield of the hedged position, it is just Supply APY of the LP position - the Borrow APR. In this case 13.82% - 4.13% = 9.69%. That means Chad is earning 9.69% APY with 50% exposure to ETH and 50% exposure to USDC on his total position ($10k LP + $251 deposit).

Spreadsheet

Although this hedge is relatively simple compared to hedging a concentrated liquidity position, we do have a spreadsheet so you can visualize the hedged values and to see how it replicates a spot portfolio! Full Range IL Hedge Spreadsheet (Straddle + LP) To use the spreadsheet, just add the proper input values. I've added all of the input values from the example here.

The only value that hasn't been discussed here is LIUs which mean Liquidity Invariant Units. They are the constant unit of measurement for debt in the GammaSwap protocol. They can be found in parantheses next to the notional value in the trade UI (highlighted in yellow below).

Last updated