Bitget App
Trade smarter
Buy cryptoMarketsTradeFuturesCopyBotsEarn
Negative Price AMM ±⟨DiracAMM⟩

Negative Price AMM ±⟨DiracAMM⟩

CointimeCointime2023/12/15 07:44
By:Cointime

Repost from Ethresearch By v-for-vasya: “Negative Price AMM ±⟨DiracAMM⟩” The full report and all related findings are available on the official website of Ethresearch.

We discover that negative liquidity is possible and construct an AMM to access the negative domain by allowing the price to go negative. The invariant for a negative price happens to be the formula for a circle and the liquidity distribution happens to have a power law tail. You can interact with and compare it to an RMM  here . Most interesting points are outlined below with link to paper at the end.

Negative Price AMM ±⟨DiracAMM⟩ image 0

Screenshot 2023-12-14 at 2.05.07 AM2294×1734 172 KBFigure 1:Two negatively priced assets can be exchanged between each other for a positive price. An impossible task in tradfi, requiring a fiat numeraire to act as an intermediary.

Summary:Swapping and liquidity provision transactions of a Concentrated Circular Market Maker (CCMM) are obfuscated using Fully Homomorphic Encryption ( FHE ) to mitigate MEV in the public mempool by combining game theory with the Kelly criterion. Liquidity of the CCMM is adjusted using a scale parameter and can be modified with a hook in Uniswap v4. We show how it is possible to enter the negative liquidity domain with the CCMM.

Negative Liquidity

If we look at a Constant Product Market Maker (CPMM) such as Uniswap, we can see that it happens to provide liquidity in the negative domain. Take the  Uniswap Invariant  with liquidity L

xy=L2

introducing price p as p=y/x and y=px

xpx=L2

solving for x

x=√L2p

note the appearance of a negative sign

x=±L√p.

It’s just difficult to access this negative liquidity in Uniswap due to the invariant being a hyperbola. By pressing the invariant against the axes, concentrating liquidity, and folding it on itself we can travel to the  negative domain . A liquidity provider may become a liquidity taker with the following invariant where z is a scale parameter

(x−z)2+(y−z)2=z2.

We like to call it the DiracAMM (Paul Dirac discovered anti-matter with a similar trick by seeing that energy √E2 could have a negative value in the  energy-momentum relation ). One can program the invariant to not provide liquidity after touching the axes though, in which case its liquidity distribution L happens to be the Student’s-t distribution with degree of freedom df=2, a special case of a power law tail where the law of large numbers has no predictive capacity on the  variance .

LStudent−t(x)=1(1+x2)23

LP Payoffs

If price, following a power law, is allowed to flow into the negative, as is empirically observed with  various   assets , then the LP payoff function happens to resemble a collection of non-linear payoffs.

Negative Price AMM ±⟨DiracAMM⟩ image 1

f43072×1536 396 KB

But it’s not necessary though for the underlying price to be negative for this AMM to be useful. Rather, one suggestion is to use the price of $0 as an offset from the current underlying price of, let’s say $100 . A negative 1 price indicates a decline of the underlying from $100 to $99. If the CCMM has one asset that can not go negative, such as a stablecoin, then it can only have LP payoffs 2A2 and 2B2, but by borrowing the LP position through a lending protocol one could mimic the payoffs of 2D2 and 2C2 respectively.

MEV approach with Kelly Criterion and FHE

Since a gain and a loss can be defined as an offset with a CCMM, we can combine it with the game theory behind rational MEV decision makers who follow the Kelly criterion, a strategy that ensures long-term optimal geometric growth

f∗=p−1−pb

where f∗ represents a MEV extractor’s portfolio allocation in a MEV attack with the probability of success p and betting odds b. By targeting Kelly-neutrality we set a MEV extractor’s Kelly betting amount f=0 at an increased gas cost by rearranging for the following equality to hold

p=1−pb.

We do so by introducing two encrypted boolean values ( ebool)  for swapping Bswap=[0,1] and providing liquidity BLP=[0,1] going into the mempool. Where the boolean value can mean 1 for swap x for y and 0 for swap y for x (or remove and re-add liquidity for BLP). We can also encrypt the swap quantity dx (or dy) as  euints , thereby making it unclear what the betting odds b (gain and loss relationship) are.

E⟨Bswap/LP⟩=1−E⟨Bswap/LP⟩E⟨Gain⟩E⟨Loss⟩=1−0.5xx=0.5

Setting the expected value of a MEV extractor’s Kelly bet E⟨f∗⟩ = 0. Targeting Kelly-neutrality could be a useful mechanism for MEV. We noticed that with FHE we can selectively target just the variables we want to obfuscate enough without having to encrypt everything and think that this approach could be useful to others looking into MEV.

Further work

An approach to avoid negative prices for the underlying could be to construct a passive wall of liquidity, a liquidity fingerprint that asymmetrically increases non-linearly as price approaches zero, denting price impact. The super-heavy tailed distributions like the  Log-Cauchy distribution  with concentration parameter c come to mind with liquidity fingerprint in price space being

LLog−Cauchy(p)=1πpcln(p)2+c2.

Negative Price AMM ±⟨DiracAMM⟩ image 2

f441920×1920 236 KB

This is a very interesting liquidity fingerprint because it captures what we see in crypto where some tokens stay where they are, the majority approach the zero bound, and a select few fly towards the right tail. One of the mathematical challenges here being that liquidity spikes to infinity at 0 though.

0

Disclaimer: The content of this article solely reflects the author's opinion and does not represent the platform in any capacity. This article is not intended to serve as a reference for making investment decisions.

PoolX: Locked for new tokens.
APR up to 10%. Always on, always get airdrop.
Lock now!

You may also like

Flash Thursday: Buy crypto with a credit/debit card for zero fees

Every Thursday, enjoy zero fees when using your local fiat currency with a credit or debit card ( Visa, Mastercard, Google Pay Apple Pay)! Buy Crypto Promotion period: Every Thursday 8:00 PM – Friday 8:00 PM (UTC+8) Promotion rules Sign up for a Bitget account or log in to your existing account. Na

Bitget Announcement2024/11/28 04:10

Chill Guy (CHILLGUY): The Meme Coin That’s All About Taking It Easy

What is Chill Guy (CHILLGUY)? Chill Guy (CHILLGUY) is a meme coin on Solana that embodies the spirit of calmness and simplicity. The meme coin is inspired by a viral meme of a relaxed, low-key dog. It’s a meme that has taken the internet by storm, celebrating the art of not worrying. The character

Bitget Academy2024/11/28 03:47