---
tags: general
---
# Inbound Protocol
*--work in progress--*
*Inbound Protocol enables liquidity providers (LPs) in Uniswap v2-type AMMs to access and trade a suite of derivatives products based on the two assets composing the AMM pool. Derivatives include a) single asset price exposure, b) impermanent loss protection c) shorts and leverages and d) price floor guarantee.*
While Uniswap V3 brought capital efficiency to the AMM space, its profitability has not been great for retail liquidity providers who lack the experience and expertise to actively manage their liquidity (see [semaji.eth](https://semaji.substack.com/p/in-the-long-run-we-are-all-dead-the?s=r)). Uniswap v2-type AMMs are still the preferred venue for many passive liquidity providers but also for long-tail protocols which find it retail-friendly and convenient for liquidity incentives. In [2022 Q1](https://uniswap.org/blog/fee-returns), 7,660 new pools were deployed on Uniswap V2 while only 859 new pools were deployed on V3. V2 makes up 56% of all DEX transactions on Ethereum vs. 37% for V3 ([observed 08/31/22](https://etherscan.io/stat/dextracker)).
This note describes a new design built on top of V2-type AMMs with the goal of making LPing in AMM more flexible and customized to LP risk preferences and price expectations. The protocol offers LPs four types of derivative products. They can
1) choose in which proportion, from 0 to 100%, they provide the two assets composing the pool
2) short or leverage one of the two tokens
3) buy full protection from IL
4) secure a price floor guarantee for a premium.
<!-- Although impermanent loss (IL) is not eliminated, it is only borne on the upside. Downside IL is fully insured by the other side of the market. -->
For all types of derivatives, LPs deposit their LP tokens (LPT) in two pools. Each pool makes an opposite bet on price direction/volatility. At the end of every period, LPT are algorithmically reallocated between the two pools to match the derivative's payoff. LPs earn a market premium for accepting to provide liquidity on the riskier or less attractive pool. A period lasts several weeks. LPs may however instantaneously open or close their positions by trading pools' share tokens in a secondary market.
## One-sided LP
<!-- Liquidity provision in xyk AMMs is however far from perfect. Liquidity providers (LPs) experience impermanent loss and must hold the pool's two assets in equal value. Many LPs would prefer to choose in which proportion they stake the two assets and be in capacity of changing those proportions at will, just as investors have control over their portfolio's composition. This way, LPs could fit their price exposure to their risk preferences and price expectations. Moreover, in pools composed of a first-rate asset like ETH and a weak and more risky one, LPs are exposed to their quality asset being drained from the pool by the combined effect of a falling price and downward impermanent loss. -->
Investors hold LPT representative of an AMM pool composed of two assets $X$ and $Y$ (with $Y$ the numeraire). They deposit their LPT in a second layer protocol which has two pools: a $X$ pool, and a $Y$ pool. They receive in exchange two new tokens which track the share and performance of the stakings within the two pools. At regular time interval, the price feed is pulled from the AMM oracle to calculate the quantity of LPT transferred between the two pools.
:::info
**Notations**
- $p_t$: date $t$ price of $X$ in terms of $Y$
- $\pi_{t+1} = p_{t+1}/p_t$ price variation rate
- $x_t$: quantities of assets $X$ deposited in the AMM at date $t$
- $y_t$: quantities of assets $Y$ deposited in the AMM at date $t$
- $k = x_t y_t$: AMM invariant
- $q^i_t$: quantity of LP tokens deposited in the $i=X,Y$ pool
- $s_t = q^X_t/q^Y_t$: pool's imbalance
- $W^i_t$: total value deposited (TVD) in the $i=X,Y$ pool at date $t$
:::
Entries and exits from the AMM pool are ignored, as inflows and outflows are accounted in the AMM pool in a manner that LP tokens' value remains unaffected. Assuming the circulating supply of LP tokens is $1$, one LP token is worth (see Appendix A):
$$
2\sqrt{k p_t}
$$
The total value locked (TVL) in the $i=X,Y$ pool is:
$$
W^i_t = 2 \sqrt{k p_t } q^i_t
$$
### Rebalancing
The quantity of LPT is algorithmically rebalanced between the two pools at regular time intervals. The rebalanced quantity depends on the price direction and amplitude. If the price *increases* ($p_{t+1} > p_t$), the losing side is the $Y$ pool. The quantity of LPT in the $Y$ pool is decreased by the rate:
$$
\dfrac{q^Y_{t+1}}{q^Y_t} = \dfrac{1}{\sqrt{\pi_{t+1}}} < 1
$$
If the price *decreases* ($p_{t+1} < p_t$), the loosing side is the $X$ pool. The quantity of LPT in the $X$ pool is decreased by the rate:
$$
\dfrac{q^X_{t+1}}{q^X_t} = \sqrt{\pi_{t+1}}< 1
$$
The rebalancing rule is similar to the one adopted by [Tracer DAO](https://tracer.finance) (v1) and its leveraged perpetual pools (see Appendix E).
### TVL variations
We examine the effect of the rebalancing rule on TVL in the two pools. Two cases are distinguished: when the price increases and when it decreases.
#### Price increase
The fraction of LPT rebalanced from the $Y$ pool to the $X$ pool is computed according to the rebalancing rule with the result that the $Y$ pool TVL remains constant (see Appendix B.1):
$$
W^Y_{t+1} = W^Y_t
$$
This is as if investors in the $Y$ pool held a portfolio fully invested in $Y$. Also, despite the price variation, LPs in the $Y$ pool are immune to impermanent loss (IL).
In the $X$ pool, total value is increased by the transfer from the $Y$ pool:
$$
\dfrac{W^X_{t+1}}{W^X_t} = \sqrt{\pi_{t+1}} +\dfrac{1}{s_t} \big(\sqrt{\pi_{t+1}} - 1 \big)
$$
Price elasticity is approximately:
$$
\dfrac{W^X_{t+1}/W^X_t -1}{\pi_{t+1} - 1} \approx \dfrac{1+s_t}{2s_t}
$$
$X$ pool price elasticity is less than $1$ if $s_t>1$ ($q^X_t > q^Y_t$), equals $1$ in case of no imbalance and is greater than $1$ if $s_t<1$. To understand the effect of $s_t$, note that the quantity of LP tokens $q^Y_t - q^Y_{t+1}$ rebalanced to the $X$ pool does not depend on the size of the $X$ pool but only the $Y$ pool. Hence, the larger (smaller) the $X$ pool compared to the $Y$ pool, the more diluted (concentrated) the transfer among $X$ pool holders.
#### Price decrease
The protocol transfers LP tokens from the $X$ pool to the $Y$ pool according to the rebalancing rule. The variation rate of the TVL in the $X$ pool is (see Appendix B.2):
$$
\dfrac{W^X_{t+1}}{W^X_t} = \pi_{t+1}
$$
It is as if LP in the $X$ pool held a wealth 100% invested in asset $X$. The TVL in the $Y$ pool varies by:
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \sqrt{\pi_{t+1}} + s_t \big( \sqrt{\pi_{t+1}} - \pi_{t+1}\big)
$$
Price elasticity is approximately:
$$
\dfrac{W^Y_{t+1}/W^Y_t -1}{\pi_{t+1} - 1} = 0.5 (1-s_t)
$$
$Y$ pool price elasticity is negative if $s_t>1$ ($q^X_t > q^Y_t$), equals $1$ in case of no imbalance and is less than $1$ if $s_t<1$. The more LP tokens deposited in the $X$ pool compared to the $Y$ pool, the larger the quantity of LP tokens transferred to the $Y$ pool with respect to its size and the higher th return.
<!-- To sum up, $X$ pool holders get always more than what they would obtain in the AMM pool in case of price increase and what they would obtain if they were holding only $X$ in case of price decrease. The bonus rate depends on the imbalance between the value deposited in the two pools. $Y$ pool holders get what they would obtain if they were holding only $Y$ in case of price increase and more than what they would obtain in the AMM pool in case of price decrease. On top of that, all LPs obtain the fees from the AMM pool. -->
### Simulations of return profiles
Returns from staking in the two pools are simulated starting from $p_t=1$ and initially assuming no imbalance ($s_t=1$).
The chart compares the return of staking in the $X$ pool and the return from holding $X$ over a broad range of price variations, from $-50$\% to $+100$\%. The dotted vertical line indicates the initial price ($p_t=1$). Return exactly tracks the $X$ asset in the downside but tend to slightly diverge for large positive price movements due to IL.

<!--Returns to staking in the X side and investing in X -->
The Figure compares the return in the $Y$ side and from holding a portfolio invested in $Y$:

The return from holding $Y$ (the black line) is flat, meaning that the portfolio keeps its value expressed in $Y$ units. The $Y$ side has also a flat profile when the price increases. However, the strategy underperforms for large negative price variations, due to the presence of IL in the AMM pool.
### Impermanent loss
If investors held a portfolio fully invested in $X$ or $Y$, the price elasticity (PE) would be 1 and 0 respectively. However, due to impermanent loss originating from the AMM pool, the PE is less when the price evolves favorably (increases for the $X$ pool and decreases for the $Y$ pool):
| | $X$ pool | $Y$ pool |
| -------- | :--------: | :--------: |
| Price increase | PE < 1 (IL) | PE = 0 (no IL) |
| Price decrease | PE = 1 (no IL) | PE < 0 (IL) |
Since the $Y$ pool in case of price increase and the $X$ pool in case of price decrease are protected from IL, the loss is redistributed to the other side by deduction. In other words the winning side is insuring the losing side from IL. This kind of mutual insurance is valued by investors focusing on downside risk.
### Imbalance premium
Most AMM pools are composed of a first-rate asset (like ETH or USDC) and a weak or risky asset. This will generally be the case of the numerous protocols which incentivize a "[pool 2](https://twitter.com/chainlinkgod/status/1305754494618095616?lang=fr)" Token/ETH.
The protocol encompasses a built-in mechanism to equilibrate the two pools. Without one, most LP tokens would be staked on the same side. Let's suppose that $X$ is the "low quality" asset and $Y$ the first-rate asset. The imbalance ratio is skewed in favor of $Y$:
$$
s_t=q^X_t/q^Y_t < 1
$$
As we have seen in case of price increase, the $X$ pool return rate is a decreasing function of $s_t$, whereas in case of price decrease, the $Y$ pool return rate is an increasing function of $s_t$.
Effect on return of a pools' imbalance ($s_t<1$):
| | $X$ pool return | $Y$ pool return |
| -------- | :--------: | :--------: |
| Price increase | up | no effect |
| Price decrease | no effect | down |
In both cases, an imbalance ratio less than one improves the the weakest pool's return compared to the strongest one. The imbalance ratio will decrease until it reaches an equilibrium value at which point the less demanded side is sufficiently compensated by the other side.
### Simulations with pools imbalance
Previous simulations have been made with the assumption of balanced pools: $q^X_t=q^Y_t$. The next chart presents the return rate under three levels of imbalance: $s_t=0.6$ (more LP tokens in the $Y$ pool), $1$ and $1.5$ (more LP tokens in the $X$ pool). As previously explained, the higher the imbalance ratio, the lower the return rate of the $X$ pool when the price increases.

Conversely, the higher the imbalance ratio, the higher the return rate of the $Y$ pool when the price decreases.

The sensitivity of the expected return to the degree imbalance provides a retroactive loop which function is to clear the market.
### Comparison with the AMM pool
Compared to merely providing liquidity in the AMM pool, staking LP tokens in the $X$ pool gives greater exposure to the $X$ price, as intended:

The first strategy is like holding a 50:50 $X$/$Y$ portfolio with IL on both extremes whereas the second one is like holding a 100% $X$ portfolio with IL concentrated on the gain side.
Conversely, the comparison of the AMM pool return and the $Y$ pool strategy shows no sensitivity to the $X$ price on the upside and less senssitivity on the downside:

<!--This is like a 50:50 $X/Y$ portfolio with IL on both ends and a 100% $Y$ portfolio with IL. -->
One important goal of the protocol is to use smart contract composability to earn AMM transaction fees while being exposed to the preferred price mix. Like liquidity providers earn exchange fees in the AMM pool to compensate for IL, pool owners face the same trade-off in the $X$ and $Y$ pools. The next chart shows the $X$ pool return, except that an annual fee rate of 20\% is earned by liquidity providers.

Since IL only bytes for extreme price variations, the strategy over-performs the holding strategies for a broad range of price variations. The $X$ pool strategy closely follows a vanilla $X$ strategy for this price interval.
For example, an investor looking for a yield for his ETH, can provide liquidity in an AMM pool ETH-USDC, then deposits the LPT in the protocol to long $1\times$ETH. Doing so, he gives up part of the ETH upside in exchange for transaction fees.
The $Y$ pool final wealth with an annual fee rate of 20\% is:

## Short and leveraged pools
The transfer rule can be generalized to allow investors to be exposed to more than $1 \times$ETH price or conversely to short ETH.
### Transfer rule
In case of price *increase*, the transfer rule generalizes to
$$
\dfrac{q^Y_{t+1}}{q^Y_t} = \pi_{t+1} ^{-\gamma}
$$
Previous case holds for $\gamma=0.5$. For $\gamma > 0$, $Y$ pool TVL decreases by (see Appendix B):
$$
\dfrac{W^Y_{t+1}}{W^Y_t} - 1 = \pi_{t+1}^{0.5-\gamma} - 1 \approx (0.5 - \gamma) \big( \pi_{t+1} - 1 \big)
$$
Price elasticity is approximately $0.5 - \gamma$. $X$ pool TVL increases by
$$
\dfrac{W^X_{t+1}}{W^X_t} - 1 = \pi_{t+1}^{0.5} \Big( 1 + \dfrac{1}{s_t} \big( 1 - \pi_{t+1}^{ -\gamma} \big) \Big) - 1
$$
In case of price *decrease*, the generalized transfer rule is
$$
\dfrac{q^X_{t+1}}{q^X_t} = \pi_{t+1}^{\gamma}
$$
The $X$ pool TVL variation rate is:
$$
\dfrac{W^X_{t+1}}{W^X_t} - 1 = \pi_{t+1}^{0.5+\gamma} - 1 \approx (0.5 + \gamma) \big( \pi_{t+1}-1 \big)
$$
Price elasticity is approximately $0.5 + \gamma$. $Y$ pool TVL increases by
$$
\dfrac{W^Y_{t+1}}{W^Y_t} - 1 = \pi_{t+1}^{0.5} \Big( 1 + s_t \big( 1 - \pi_{t+1}^{ \gamma} \big) \Big)
$$
### Example
With $\gamma = 1.5$, $X$ pool investors are exposed to approximately $2\times X$ price:

Price elasticity is $2$ for limited price variations (-/+10%) and decreases for larger price variations.
With the same value $\gamma = 1.5$, $Y$ pool investors are short approximately $1\times X$ price:

Price elasticity is locally -1 for small price variations and decreases for larger price variations.
## Insuring impermanent loss
So far the possibility to insure downside IL has been demonstrated in the case of full exposure to the $X$ asset. Insuring IL in the vanilla AMM pool can also be proposed by using a modified transferring rule. The protocol transfers LPT from one pool to the other by targeting a variation rate of LPT in the $X$ pool:
$$
\dfrac{q^X_{t+1}}{q^X_t} = 0.5 \sqrt{\pi_{t+1}} + \dfrac{0.5-\theta s_t^{\sigma}}{\sqrt{\pi_{t+1}}}
$$
with $\sigma, \theta \geq 0$. A variation rate greater than $1$ implies a transfer from the $Y$ pool to the $X$ pool; lesser than $1$ a transfer in the opposite direction.
$X$ pool TVL variation rate is (see Appendix C.1):
$$
\dfrac{W^X_{t+1}}{W^X_t } = 0.5 \pi_{t+1} + 0.5 - \theta s_t^{\sigma}
$$
For $\theta=0$, the $X$ pool replicates a perfect IL-free $50/50$ portfolio. This is equivalent to providing liquidity in the AMM pool without bearing IL in both downward and upward directions. $\theta s_t^{\sigma} >0$ is therefore the premium that the $X$ pool pays for transferring IL to the $Y$ pool. The premium is increasing with the imbalance ratio to clear the market.
$Y$ pool TVL variation rate is:
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - 0.5 - 0.5 \pi_{t+1} + \theta s_t^{\sigma} \big)
$$
$Y$ pool owners obtain the AMM pool return rate to which is added an insurance premium. As $\pi_{t+1}^{0.5} \approx 0.5 + 0.5 \pi_{t+1}$, the return can be locally approximated by:
$$
\dfrac{W^Y_{t+1}}{W^Y_t} - 1 \approx \pi_{t+1}^{0.5} + \theta s_t^{\sigma+1}
$$
The insurance premium is approximately the product of the insurance rate $\theta$ and the imbalance ratio $s_t$ raised to power $\sigma+1\geq 1$. The higher the insurance rate, or the higher the demand for IL insurance (the higher $s_t$), the more profitable the provision of IL insurance.
The approximation is valid for small price variations. For larger variations, IL begins to bite the AMM return and the transfer may reverse from the $Y$ pool to the $X$ pool. The return profiles for the two pools, with $\theta=0.03$, $s_t=1$ and $\sigma=2$ is:

The $X$ pool replicates a 50/50 portfolio minus a constant insurance premium, here of $3\%$. In exchange of the premium, the $Y$ pool absorbs IL of the $X$ pool. The $Y$ pool return is $3 \%$ higher than holding or the AMM pool and $6 \%$ higher than the $X$ pool return for marginal variations around the initial price. The $Y$ pool remains more profitable than the $X$ pool withing a broad range of price variation rates $[-40\%,+55\%]$. Outside this range, the transfer reverses and goes from the $Y$ pool to the $X$ pool. The return quickly deteriorates due to increasing IL. $Y$ pool owners are shorting volatility.
The market equilibrium is ultimately assured by people moving LPT from one pool to the other. If the market finds the insurance excessively profitable (or not enough), additional LPT will be allocated to the $Y$ pool (the $X$ pool), which result will be an imbalance ratio $s_t<1$ (or $s_t>1$) and a reduced (increased) insurance premium.
In the chart, more investors are willing to take the insured side. The imbalance ratio is greater than $1$, pushing the insurance rate up. The return profiles for the two pools and $s_t=1.5$ becomes:

The fixed insurance premium paid by the $X$ pool is now $\theta s_t^2 = 6.75 \%$ compared to holding. The $Y$ pool return is $6.75 \%$ higher than holding or the return of the AMM pool for limited variations around the initial price. The $Y$ pool remains more profitable than the $X$ pool for price variation rates between $[-60\%,+87\%]$.
Conversely, if providing IL insurance seems excessively profitable for $s_t=1$, the imbalance ratio will decrease below $1$, lowering the insurance cost. For example, for $s_t=0.8$, the insurance rate paid by the $X$ pool would be $1.92 \%$ compared to holding. The $Y$ pool would remain more profitable than the $X$ pool for price variation rates between $[-35\%,+43\%]$.
## Single-sided exposure $\times$ IL protection
The $X$ pool may also get complete exposure to the $X$ asset with IL fully passed through to the $Y$ pool in exchange for an insurance premium. The protocol transfers LPT from one pool to the other by targeting a variation rate of LPT in the $X$ pool:
$$
\dfrac{q^X_{t+1}}{q^X_t} = \sqrt{\pi_{t+1}} - \dfrac{\theta s_t^{\sigma}}{\sqrt{\pi_{t+1}}}
$$
with $\sigma, \theta \geq 0$. $X$ pool TVL variation rate is (see Appendix C.2):
$$
\dfrac{W^X_{t+1}}{W^X_t } = \pi_{t+1} - \theta s_t^{\sigma}
$$
For $\theta=0$, the $X$ pool replicates a perfect IL-free $X$ portfolio. $\theta s_t^{\sigma} >0$ is the premium that $X$ pool owners pay for transferring IL to $Y$ pool owners.
$Y$ pool TVL variation rate is:
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - \pi_{t+1} + \theta s_t^{\sigma} \big)
$$
For parameters $\theta=0.1$, $\sigma=2$ and $s_t=1$, the insurance premium is $10\%$. The $Y$ pool earns a positive premium for price variations between $[-63\%, +73\%]$:

A higher imbalance ratio (here $s_t=1.4$) boosts the the insurance premium yet exposes the $Y$ pool to greater downside risk for large positive preice variaons (more than $80\%$):

Conversely, a low imbalance ratio (here $s_t=0.6$) reduces the insurance premium but gives the $Y$ pool more upside for positive price variations and more downside for negative price variations.
## Floor price guarantee
$X$ pool owners can buy a floor price guarantee for a premium paid to $Y$ pool owners. The derivative resembles a put option. At the beginning of every period, a guaranteed floor price is set as previous settlement price minus a given price variation. Formally, given $p_t$ the settlement price at the time of rebalancing, the floor price is automatically defined as $p_{S}=\pi_Sp_t$ with $\pi_S < 1$ a constant factor. There are two cases: when the guarantee is activated and when it is not.
#### Guarantee activated
The settlement price is below the floor price ($\pi_{t+1} < \pi_S$). The protocol transfers LPT from one pool to the other by targeting a variation rate of LPT in the $X$ pool:
$$
\dfrac{q^X_{t+1}}{q^X_t} = \dfrac{1}{ \sqrt{\pi_{t+1}}} \big( 1 + \delta (\pi_{t+1} - \pi_S) - \theta s_t^{\sigma} \big)
$$
The parameter $\delta$ is the derivative's delta when the guarantee is activated. $X$ pool TVL variation rate is (see Appendix D):
$$
\dfrac{W^X_{t+1}}{W^X_t } = 1+ \delta (\pi_{t+1} - \pi_S) - \theta s_t^{\sigma}
$$
The higher the demand for the protection, the higher $s_t$ and the higher the premium to clear the market.
The final value of the $Y$ pool is:
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - 1 - \delta (\pi_{t+1} - \pi_S ) + \theta s_t^{\sigma} \big)
$$
#### Guarantee not activated
The settlement price is above the floor price ($\pi_{t+1} < \pi_S$). The transfer operates by targeting a variation rate of LP tokens in the $X$ pool:
$$
\dfrac{q^X_{t+1}}{q^X_t} = \dfrac{1 - \theta s_t^{\sigma}}{ \sqrt{\pi_{t+1}}}
$$
$X$ pool TVL varies by:
$$
\dfrac{W^X_{t+1}}{W^X_t } = 1 - \theta s_t^{\sigma}
$$
For price variations below $\pi_S$, the $X$ pool return is flat. The final value of the $Y$ pool is:
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - 1 + \theta s_t^{\sigma} \big)
$$
### Return simulations
The chart shows return profiles for three imbalance ratios ($s_t=0.5, 1$ and $1.5$). Parameters' values: floor price $20\%$ below previous settlement price (here set to $1$), $\theta=0.1$, c) $\sigma=2$ and $\delta=0.5$.

The lower the relative demand for hedging the $X$ pool, the higher the imbalance ratio $s_t$, the higher the premium paid to the $Y$ pool. The $Y$ pool protects the $X$ pool from a price fall on the downside but also from IL on the upside. The $Y$ pool has an opposite price-return relation (here for $s_t=1.3$):

When the price stays in some limits, the $X$ ppol pays the insurance premium to the $Y$ side. When it breaks the floor or strongly increases, the transfer reverses. Compared to the hedged side, the hedging side loses when the price escapes the range $[-29\%,+88\%]$.
## Use cases
The protocol offers five identified use cases:
1) Portfolio management
LPs can hold a portfolio invested in the two assets with different weights than 50:50. They can also actively manage their holdings by rebalancing their LP tokens from one pool to another.
2) IL insurance
Impermanent loss heavily hits return to providing liquidity in AMM pools. A [recent paper](https://arxiv.org/ftp/arxiv/papers/2111/2111.09192.pdf) analyzed 17 AMM pools between May 5th 2021 and September 20th 2021, and found that IL generally outweighed the fees.
We propose two IL insurance schemes. In the first one, investors choosing to long $1 \times$ETH are protectd from IL on the downside but not on the upside. Multiple studies have shown that investors value much more downside protection than upside one. Here insurance is a natural by-product of the rebalancing rule. By focusing on downside IL, the risk is mutualized by the transfer of wealth from non impacted to impacted LPs.
Il can also be insured in the vanilla AMM market. Investors who seek a protection from IL accepts to forego part of the AMM return to the other side. The insurance rate clears the market by responding to relative demand in the two pools.
Insuring IL is [tricky](https://medium.com/gamma-strategies/impermanent-loss-insurance-protection-markets-for-uniswap-v3-lps-20d661f61883) and despite a huge latent demand, a simple and viable solution has so far failed to emerge. Bancor's design consisting in subsidizing IL by distributing its own token may [break](https://blog.bancor.network/market-conditions-update-june-19-2022-e5b857b39336) and lead to a [death spiral](https://twitter.com/hasufl/status/1540715231160274944). <!--In addition, Bancor's efforts to compensate upside IL is both questionable and costly. -->
[Squeeth](squeeth.opyn.co/) enables hedging Uniswap positions. The protection provides hedge for Uniswap v3 LPs, whereas the transfer mechanism applies to Uniswap v2 LPs. The protection provided by Squeeth is not perfect, involves multiple and [complex steps](https://medium.com/opyn/hedging-uniswap-v3-with-squeeth-bcaf1750ea11) and must be managed frequently to offset price movements. Here LP only needs to deposit their LP tokens in the $X$ pool. The protection is perfect for any duration. Only the insurance premium may vary after each rebalancing.
3) Liquidity incentives
For defi protocols, incentivizing liquidity for its own token is expensive and not enough targetted. A recent [case study](https://alexkroeger.mirror.xyz/HoTLzeiTUBn7c-uZoVcZ6PO9AlGrVQI_4WYDSeJFTiA) about Compound shows that among top 100 accounts who farmed COMP, only 19% have kept greater than 1% of the COMP they claimed and only 1 address from the top 100 ever voted on a Governor Bravo proposal. Emission rate must be high enough to make up for potential losses. Long term, the incentives are inflationary. Moreover, using Uniswap V3 to incentivize liquidity has proved [challenging](https://medium.com/@revert_finance/onetickdao-eth-and-the-narrow-rangers-f9a376f7f0c9).
Here the LP market is segmented into two distinct populations:
- those who believe in the protocol take the TOKEN side. They bear IL only on the upside, but to a limited extent due to pool imbalance
- those who seek a return for their ETH take the ETH side. Their ETH are protected in case the price of ETH price decrease, but can be reduced in case ETH price increase, relative to TOKEN price.
In AMM markets, those two populations are pooled together, which is not efficient. In addition, the protocol can concentrate the rewards where they matter by incentivizing only the TOKEN side.
4) Shorts and leverage
The protocol allows users to leverage more than $1 \times$ or short the price.
5) Floor price guarantee
<!--
## Conclusion
The protocol allows investors depositing their $X$/$Y$ LP tokens to approximately replicate two single-asset portfolios, a $X$ portfolio and a $Y$ portfolio, while earning transaction fees from the AMM pool. Both strategies are exposed to IL inherited from the AMM pool but concentrated on the gain domain. Downside IL is insured by the other side of the AMM pool.
Just as assets $X$ and $Y$ have an equilibrium price which convince investors to hold the total supplies, a 2S AMM has a variable return rate which incentivize investors to spread their LP tokens over the two pools. When one asset is perceived as of lower quality, LPs earn an extra return for accepting to deposit their tokens in the corresponding pool.
-->
## Appendix
### A. AMM mechanism
AMMs are financial exchanges which match bids and asks with liquidity providers (LPs). LPs act as passive market makers in Uniswap V2-type AMM. They deposit pairs of tokens of equivalent amount in dedicated pools and accept to take the other side of all trades according to a constant product formula. The platform charges a small fee on trades redistributed to LPs based on their share of the pool.
Let us consider a pool which allows the exchange of tokens X and Y and stores $x$ X and $y$ Y. Before any trade, the contract computes the product $k = xy$ and offers to exchange any quantity $\Delta x$ against $\Delta y$ preserving the constraint:
$$
(x+\Delta x) (y+ \Delta y) = k
$$
If $(x,y,k)$ denotes the initial protocol's state, the state transits after the trade to $(x',y',k)$ with $x'=x+\Delta x$ and $y'=y+\Delta y$ and $x' y' = k$. The market price $p$ of $X$ expressed in units of $Y$ is the negative of the first derivative of $y=k/x$ computed in state A = $(x,y,k)$:
$$
p = - \dfrac{\partial y}{\partial x} = \dfrac{k}{x^2} = \dfrac{y}{x}
$$
The exchange rate stays close to the equilibrium price thanks to arbitrageurs. The market value of the assets held in the pool is the quantities expressed in terms of the numeraire (here asset Y): $V^P = px+y$. Since the protocol sticks to the constraint $px = y$, regardless of market price $p$, the pool is always invested 50:50 in the two assets. The market value of the two assets in the pool can be expressed in terms of $p$ and $k$ from the two constraints $xy=k$ and $p=y/x$. We obtain $y=\sqrt{kp}$ and $x= \sqrt{k/p}$ and
$$V^p = px+y = 2\sqrt{kp}$$
### B. One-sided LP formulas
#### B.1 Price increase
Arbitrageurs realign the protocol's exchange rate, so that LPT are now worth $2\sqrt{p_{t+1} k}$. A fraction of LPT are transferred from the $Y$ pool to the $X$ pool in accordance with the target quantity of LP tokens in the $Y$ pool:
$$
q^Y_{t+1} = \pi_{t+1}^{-\gamma} q^Y_t
$$
Total value deposited in the $Y$ pool decreases to:
$$
W^Y_{t+1} = 2 \sqrt{k p_{t+1} } q^Y_{t+1}
= 2 \sqrt{k p_{t+1} } \pi_{t+1}^{-\gamma} q^Y_t
= W^Y_t \pi_{t+1}^{0.5-\gamma}
$$
The variation rate is:
$$
\dfrac{W^Y_{t+1}}{W^Y_t} - 1 = \pi_{t+1}^{0.5-\gamma} - 1 \approx (0.5 - \gamma) \big( \pi_{t+1} - 1 \big)
$$
The price elasticity of the $Y$ pool's value is approximately $0.5 - \gamma$. $\gamma = 0.5$, implies a price elasticity of 0 both in the exact and approximate formulas.
In the $X$ pool, total value is increased by the transfer from the $Y$ pool:
$$
\begin{aligned}
W^X_{t+1} & = \big( q^X_t +( q^Y_t - q^Y_{t+1} ) \big) 2 \sqrt{ k p_{t+1} } \notag \\
& = q^X_t 2 \sqrt{ k p_t} \pi_{t+1}^{0.5} \Big( 1 + \dfrac{q^Y_t}{q^X_t} \big( 1 - \pi_{t+1}^{ -\gamma} \big) \Big) \notag \\
& = W^X_t \pi_{t+1}^{0.5} \Big( 1 + \dfrac{1}{s_t} \big( 1 - \pi_{t+1}^{ -\gamma} \big) \Big)
\end{aligned}
$$
With $\gamma = 0.5$:
\begin{align}
\dfrac{W^X_{t+1}}{W^X_t} &= \pi_{t+1}^{0.5} +\dfrac{1}{s_t} \big(\pi_{t+1}^{0.5} - 1 \big) \\
&\approx 1 + 0.5 \big(\pi_{t+1} - 1 \big) +\dfrac{1}{2s_t} \big( \pi_{t+1} - 1 \big) \\
&= \pi_{t+1} + \dfrac{1-s_t}{2s_t} \big( \pi_{t+1} - 1 \big)
\end{align}
Price elasticity is approximately:
$$
\dfrac{W^X_{t+1}/W^X_t -1}{\pi_{t+1} - 1} = \dfrac{2 \gamma +s_t}{2s_t}
$$
which is equal to $\gamma +0.5$ with no imbalance and $(1+s_t)/2s_t$ for $\gamma=0.5$.
The new imbalance ratio is:
\begin{aligned}
s_{t+1} &= \dfrac{q^X_{t+1}}{q^Y_{t+1}} = \dfrac{q^Y_t}{q^Y_{t+1}} \dfrac{q^X_t}{q^Y_t} \dfrac{q^X_t+q^Y_t-q^Y_{t+1}}{q^X_t} \\
&= \pi_{t+1}^{\gamma} s_t \Big(1+s_t^{-1} - \pi_{t+1}^{-\gamma} s_t^{-1} \Big) \\
&= \pi_{t+1}^{\gamma} (1+s_t) - 1
\end{aligned}
With $\gamma = 0.5$:
$$
\dfrac{s_{t+1}}{s_t} = \dfrac{W^X_{t+1}}{W^X_t}
$$
#### B.2 Price decrease
The protocol transfers the LP tokens from the $X$ pool to the $Y$ pool by targeting the $X$ pool's variation rate:
$$
\dfrac{q^X_{t+1}}{q^X_t} = \pi_{t+1}^{\gamma}
$$
TVD in the $X$ pool is reduced by:
$$
W^X_{t+1} = \sqrt{p_{t+1} k} q^X_{t+1} = \sqrt{p_{t+1} k} \pi_{t+1}^{\gamma} q^X_t
= W^X_t \pi_{t+1}^{0.5+\gamma}
$$
The variation rate is:
$$
\dfrac{W^X_{t+1}}{W^X_t} - 1 = \pi_{t+1}^{0.5+\gamma} - 1 \approx (0.5 + \gamma) \big( \pi_{t+1}-1 \big)
$$
The price elasticity of the $X$ pool's value is approximately $0.5 + \gamma$. The formula is exact for $\gamma = 0.5$:
$$
\dfrac{W^X_{t+1}}{W^X_t } = \pi_{t+1}
$$
The value taken from the $X$ pool is added to the $Y$ pool:
$$
\begin{aligned}
W^Y_{t+1} & = q^Y_{t+1} 2 \sqrt{ k p_{t+1} } = \big( q^Y_t +( q^X_t - q^X_{t+1} ) \big) 2 \sqrt{ k p_{t+1} } \notag \\
& = q^Y_t 2 \sqrt{ k p_t} \pi_{t+1}^{0.5} \Big( 1 + \dfrac{q^X_t}{q^Y_t} \big( 1 - \pi_{t+1}^{ \gamma} \big) \Big) \notag \\
& = W^Y_t \pi_{t+1}^{0.5} \Big( 1 + s_t \big( 1 - \pi_{t+1}^{ \gamma} \big) \Big)
\end{aligned}
$$
With $\gamma = 0.5$:
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - \pi_{t+1} \big)
$$
\begin{align}
\dfrac{W^Y_{t+1}}{W^Y_t } &= \pi_{t+1}^{0.5} \Big( 1 + s_t \big( 1 - \pi_{t+1}^{0.5} \big) \Big) \\
&\approx 1 + 0.5 (\pi_{t+1}-1) (1-s_t)
\end{align}
Price elasticity is approximately:
$$
\dfrac{W^Y_{t+1}/W^Y_t -1}{\pi_{t+1} - 1} = 0.5 - \gamma s_t
$$
which is equal to $0.5-\gamma$ with no imbalance and $0.5 (1-s_t)$ for $\gamma = 0.5$.
The new imbalance ratio is:
\begin{aligned}
s_{t+1} &= \dfrac{q^X_{t+1}}{q^Y_{t+1}} = \dfrac{q^X_{t+1}}{q^X_t} \dfrac{q^X_t}{q^Y_t} \dfrac{q^Y_t}{q^Y_t+q^X_t-q^X_{t+1}} \\
&= \pi_{t+1}^{\gamma} s_t \Big(1+s_t - \pi_{t+1}^{\gamma} s_t \Big)^{-1}
\end{aligned}
### C. IL insurance
The protocol transfers LP tokens from one pool to the other by targeting a variation rate of LP tokens in the $X$ pool:
$$
\dfrac{q^X_{t+1}}{q^X_t} = \delta \pi_{t+1}^{\gamma} + (\omega -\theta s_t^{\sigma}) \pi_{t+1}^{-0.5}
$$
$X$ pool TVL varies by:
\begin{aligned}
W^X_{t+1} &= 2\sqrt{p_{t+1} k} q^X_{t+1} = 2\sqrt{ p_{t+1} k} (\delta \pi_{t+1}^{\gamma} + (\omega-\theta s_t^{\sigma})\pi_{t+1}^{-0.5}) q^X_t \\
&= 2 \delta \sqrt{p_{t+1} k} \pi_{t+1}^{\gamma} q^X_t + (\omega-\theta s_t^{\sigma}) \pi_{t+1}^{-0.5} 2\sqrt{p_{t+1} k} q^X_t \\
&= \delta W^X_t \pi_{t+1}^{0.5+\gamma} + (\omega-\theta s_t^{\sigma}) W^X_t
\end{aligned}
Variation rate is:
$$
\dfrac{W^X_{t+1}}{W^X_t} = \delta \pi_{t+1}^{0.5+\gamma} + \omega-\theta s_t
$$
For $\gamma = 0.5$:
$$
\dfrac{W^X_{t+1}}{W^X_t } = \delta \pi_{t+1} + \omega - \theta s_t^{\sigma}
$$
The final value of the $Y$ pool is:
$$
\begin{aligned}
W^Y_{t+1} & = q^Y_{t+1} 2 \sqrt{ k p_{t+1} } = \big( q^Y_t +( q^X_t - q^X_{t+1} ) \big) 2 \sqrt{ k p_{t+1} } \\
& = \big( q^Y_t + q^X_t - ( \delta \pi_{t+1}^{\gamma} + (\omega-\theta s_t^{\sigma}) \pi_{t+1}^{-0.5}) q^X_t \big) 2 \sqrt{ k p_{t+1} } \\
& = q^Y_t 2 \sqrt{ k p_t} \pi_{t+1}^{0.5} \big( 1 + s_t - \delta \pi_{t+1}^{\gamma} s_t - (\omega-\theta s_t^{\sigma}) \pi_{t+1}^{-0.5} s_t \big) \\
& = W^Y_t \pi_{t+1}^{0.5} \Big( 1 + s_t \big( 1 - \delta \pi_{t+1}^{\gamma} - (\omega-\theta s_t^{\sigma}) \pi_{t+1}^{-0.5} \big) \Big)
\end{aligned}
$$
With $\gamma = 0.5$:
\begin{align}
\dfrac{W^Y_{t+1}}{W^Y_t } & = \pi_{t+1}^{0.5} \Big( 1 + s_t \big( 1 - \delta \pi_{t+1}^{0.5} - (0.5-\theta s_t^{\sigma}) \pi_{t+1}^{-0.5} \big) \Big) \\
& = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - \delta \pi_{t+1} - 0.5 + \theta s_t^{\sigma} \big)
\end{align}
### C.1 Equally weighted portfolio
For $\delta =\omega= 0.5$, the $X$ pool is exposed to a synthetic portfolio composed in equal part of $X$ and $Y$.
$X$ pool TVL variation rate is:
$$
\dfrac{W^X_{t+1}}{W^X_t } = 0.5 \pi_{t+1} + 0.5 - \theta s_t^{\sigma}
$$
$Y$ pool TVL variation rate is:
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - 0.5 \pi_{t+1} - 0.5 + \theta s_t^{\sigma} \big)
$$
### C.2 Single-sided staking
For $\delta = 1$ and $\omega=0$, the $X$ pool is exposed to a synthetic $X$ portfolio. $X$ pool TVL variation rate is:
$$
\dfrac{W^X_{t+1}}{W^X_t } = \pi_{t+1} - \theta s_t^{\sigma}
$$
$Y$ pool TVL variation rate is:
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - \pi_{t+1} + \theta s_t^{\sigma} \big)
$$
### D. Floor price guarantee
Given $p_t$ the settlement price at the time of rebalancing, the next floor price is automatically defined as $p_{S}=\pi_Sp_t$.
#### D.1 Protection activated ($\pi_{t+1} \geq \pi_S$)
Transferring rule:
$$
\dfrac{q^X_{t+1}}{q^X_t} = \pi_{t+1}^{-0.5} \big( 1 + \delta (\pi_{t+1} - \pi_S) - \theta s_t^{\sigma} \big)
$$
$X$ pool TVL varies by:
\begin{aligned}
W^X_{t+1} &= 2\sqrt{p_{t+1} k} q^X_{t+1} = 2\sqrt{ p_{t+1} k} \big( \pi_{t+1}^{-0.5} \big( 1 + \delta (\pi_{t+1} - \pi_S) - \theta s_t^{\sigma} \big) q^X_t \\
&= W^X_t \pi_{t+1}^{0.5} \big( \pi_{t+1}^{-0.5} \big( 1 + \delta (\pi_{t+1} - \pi_S) - \theta s_t^{\sigma} \big)
\end{aligned}
Variation rate is:
$$
\dfrac{W^X_{t+1}}{W^X_t } = 1+ \delta (\pi_{t+1} - \pi_S) - \theta s_t^{\sigma}
$$
The final value of the $Y$ pool is:
$$
\begin{aligned}
W^Y_{t+1} &= q^Y_{t+1} 2 \sqrt{ k p_{t+1} } = \big( q^Y_t +( q^X_t - q^X_{t+1} ) \big) 2 \sqrt{ k p_{t+1} } \\
& = \Big( q^Y_t + q^X_t - \pi_{t+1}^{-0.5} \big( 1 + \delta (\pi_{t+1} - \pi_S) - \theta s_t^{\sigma} \big) q^X_t \Big) 2 \sqrt{k p_{t+1}} \\
& = q^Y_t 2 \sqrt{ k p_t} \pi_{t+1}^{0.5} \Big( 1 + s_t - \pi_{t+1}^{-0.5} \big( 1 + \delta (\pi_{t+1} - \pi_S) - \theta s_t^{\sigma} \big) s_t \Big) \\
\end{aligned}
$$
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - 1 - \delta (\pi_{t+1} - \pi_S ) + \theta s_t^{\sigma} \big)
$$
#### D.2 Protection not activated ($\pi_{t+1} < \pi_S$)
Transferring rule:
$$
\dfrac{q^X_{t+1}}{q^X_t} = \pi_{t+1}^{-0.5} (1 - \theta s_t^{\sigma} )
$$
$X$ pool TVL varies by:
\begin{aligned}
W^X_{t+1} &= 2 \sqrt{p_{t+1} k} q^X_{t+1} = 2 \sqrt{ p_{t+1} k} \pi_{t+1}^{-0.5} (1 - \theta s_t^{\sigma} ) q^X_t \\
&= 2 \sqrt{ p_t k} q^X_t \pi_{t+1}^{0.5} \pi_{t+1}^{-0.5} (1 - \theta s_t^{\sigma} ) \\
&= W^X_t -\theta s_t^{\sigma} W^X_t
\end{aligned}
Variation rate:
$$
\dfrac{W^X_{t+1}}{W^X_t } = 1 - \theta s_t^{\sigma}
$$
Final value of the $Y$ pool:
$$
\begin{aligned}
W^Y_{t+1} & = q^Y_{t+1} 2 \sqrt{ k p_{t+1} } = \big( q^Y_t +( q^X_t - q^X_{t+1} ) \big) 2 \sqrt{ k p_{t+1} } \\
& = \Big( q^Y_t + q^X_t - \big( \pi_{t+1}^{-0.5} (1 - \theta s_t^{\sigma} \big) q^X_t \Big) 2 \sqrt{ k p_{t+1} } \\
& = q^Y_t 2 \sqrt{ k p_t} \pi_{t+1}^{0.5} \Big( 1 + s_t - \pi_{t+1}^{-0.5} (1 - \theta s_t^{\sigma}) s_t \Big) \\
& = W^Y_t \pi_{t+1}^{0.5} \Big( 1 + s_t \big( 1 - \pi_{t+1}^{-0.5} (1 - \theta s_t^{\sigma} \big) \Big)
\end{aligned}
$$
$$
\dfrac{W^Y_{t+1}}{W^Y_t } = \pi_{t+1}^{0.5} + s_t \big( \pi_{t+1}^{0.5} - 1 + \theta s_t^{\sigma} \big)
$$
### E. Comparison with Tracer DAO perpetual pools
The framework is formally close to the perpetual pool protocol [Tracer DAO](https://pools.tracer.finance/) V1 (rebranded Mycelium since July 2022). A main difference is that in Tracer, staked tokens are non-structured assets like USDC or ETH, whereas they are LP tokens here. In Tracer's leveraged perpetual pools (LPP), traders get exposure to leveraged underlying asset, long or short (see [documentation](https://docs.tracer.finance/)). LPPs create derivative tokens that do not expire and cannot be liquidated.
There are two pools in which traders can take leveraged long ($L$) and short ($S$) positions, and two types of asset:
- a base asset $X$ which serves as collateral in the two pools
- the quote asset $Y$ which can be any derivative with an accessible price feed
Here, the base assets are AMM LP tokens and the price feed is given by the AMM oracle from which the LP tokens are derived.
$q^L_t$ and $q^S_t$ are the quantities of $X$ deposited in pools $L$ and $S$ at date $t$. Traders who put their assets in the $L$ pool are leveraged long $X$ and those who deposit in the $S$ pool are leveraged short $X$, both in terms of the quote asset $Y$. $p_t$ is the price of $X$ in terms of $Y$.
#### D.1 Price increase
When the price increases ($p_{t+1} > p_t$), the Tracer DAO (V1) smart contract transfers the quantity $q^S_{t+1} - q^S_t$ of $X$ from the pool $S$ to the pool $L$, so that the short pool ends up with less $X$:
$$
\begin{equation}
q^S_{t+1} = \pi_{t+1}^{-\gamma} q^S_t < q^S_t
\end{equation}
$$
$\gamma > 0$ is the leverage parameter. Given a price variation, the higher $\gamma$, the larger the transfer to the other side. The value of the short side is reduced by
\begin{equation*}
\dfrac{q^S_{t+1}}{q^S_t} - 1 = \pi_{t+1}^{-\gamma} - 1 \approx -\gamma \big( \pi_{t+1} - 1 \big)
\end{equation*}
The leverage parameter $\gamma$ is a measure of price elasticity. A one percent price increase leads to approximately a $\gamma$ percent decrease in value on the short pool (moreover, the smaller the price variation, the better the approximation). In Tracer DAO, leverage can be $1 \times$ ($\gamma=1$) or up to $3 \times$ ($\gamma=3$). In the protocol, $\gamma=0.5$.
The value of the $L$ pool is increased by
$$
\dfrac{q^L_{t+1}}{q^L_t} - 1 = \dfrac{1}{s_t} \big( 1- \pi_{t+1}^{-\gamma} \big) = \dfrac{1}{s_t} \bigg( 1 - \dfrac{q^S_{t+1}}{q^S_t} \bigg)
$$
with $s_t = q^L_t/q^S_t$ the pool's imbalance. The variation rate is not exactly the decrease rate of the $S$ pool due to a composition effect. If the collateral is concentrated in the long side ($s_t > 1$), $L$ pool return rate is less than minus $S$ pool return rate, as the transfer is diluted over a larger quantity of collateral tokens. The opposite is true if collateral is concentrated in the short side.
#### D.2 Price decrease
When the price decreases ($p_{t+1} < p_t$), the smart contract transfers from the $L$ pool to the $S$ pool the quantity
$$
q^L_{t+1} - q^L_t = q^L_t \Big( \dfrac{ p_{t+1}}{p_t} \Big)^\gamma - q^L_t
$$
The value of the $L$ pool is reduced by
$$
\dfrac{q^L_{t+1}}{q^L_t} - 1 = \pi_{t+1}^\gamma - 1 \approx \gamma \big( \pi_{t+1} - 1 \big)
$$
The value of the $S$ pool is increased by
$$
\dfrac{q^S_{t+1}}{q^S_t} - 1 = s_t \big( 1- \pi_{t+1}^\gamma \big) = s_t \Big( 1 - \dfrac{q^L_{t+1}}{q^L_t} \Big)
$$
Following a similar reasoning, if the collateral is concentrated in the $S$ pool ($s_t < 1$), the $S$ pool return rate is less than minus the $L$ pool return rate. The opposite is true if the collateral is concentrated in the $L$ pool.
#### D.3 Mixed strategies
Investors can combine the two strategies by depositing $X$ in the two pools. When the price increases, investing $\alpha$ in $\gamma \times$short and $(1-\alpha)$ in $\gamma \times$long gives one period later:
\begin{align}
P_{t+1}(\alpha) & = \alpha \pi_{t+1}^{-\gamma} + (1 -\alpha ) \Big( 1 + \dfrac{1}{s_t} \big( 1- \pi_{t+1}^{-\gamma} \big) \Big) \\
& = \dfrac{ (1 -\alpha ) (1 + s_t)}{s_t} - \dfrac{1 -\alpha (1 + s_t)}{s_t} \pi_{t+1}^{-\gamma}
\end{align}
The position is delta neutral for $\alpha = 1/(1 + s_t)$ whatever the leverage parameter $\gamma$:
$$
P_{t+1} \Big( \dfrac{1}{1 + s_t} \Big) = 1
$$
In this case portfolio's shares replicate pool's shares, thereby eliminating the effect of the imbalance factor $s_t$:
$$
\alpha = \dfrac{q^S_t}{q^S_t+q^L_t}
$$
When the price increases, the same strategy yields:
\begin{align}
P_{t+1}(\alpha) & = \alpha \Big( 1 + s_t \big( 1 - \pi_{t+1}^{ \gamma} \big) \Big) + (1-\alpha) \pi_{t+1}^{\gamma} \\
% & = (1-\alpha) \Big( \dfrac{p_{t+1}}{ p_t} \Big)^{0.5+\gamma} + \alpha + \alpha s_t - \alpha s_t \Big(\dfrac{p_{t+1}}{ p_t} \Big)^{ 0.5 + \gamma} \\
& = \alpha (1+ s_t) + (1-\alpha - \alpha s_t) \pi_{t+1}^{\gamma}
\end{align}
The position is delta neutral for the same portfolio share:
$$
P_{t+1} \Big( \dfrac{1}{1 + s_t} \Big) = 1
$$
### F. Timeline
Investors can pre-deposit and pre-withdraw their LP tokens during a pre-commitment period which ends before the rebalancing event, after which their LP tokens are transferred to the selected pool.

Their price exposition is determined by a time-weighted average price (TWAP) provided by the AMM. The price variation $p_{t+1}/p_t$ used in the rebalancing formula is the ratio of two TWAPs. In the diagram, Rebalancing(2) uses as input
$$
\dfrac{\text{Twap(2)}}{ \text{Twap(1)}}
$$
Smoothing the price variation over a sufficiently long time interval is necessary to prevent a malicious actor to manipulate the AMM oracle and the transferred amount from one pool to the other one. Once moving average is computed and LP tokens are rebalanced, the protocol includes in the pool the pre-deposited funds and withdraws the pre-withdrawn funds.
## Table of contents
[toc]
---