Notes on the LVR of FM-AMM

0. TL;DR

We introduced and detailed the additional features of FM-AMM, as presented in [CF23]. We modeled the game between CEX-DEX arbitrageurs for arbitrage profit on FM-AMM and then solved it by finding the pure strategy Nash equilibrium. Lastly, we calculated the asymptotic LVR of FM-AMM in theoretical settings and compared its performance against the Uniswap V2-style fixed-rate fee CPMM through numerical simulations. Our observations indicated that the performance is heavily influenced by price volatility, transaction costs, and the size of the liquidity pool, with FM-AMM showing a reduced loss to arbitrageurs under specific conditions.

1. Introduction

Since LVR was introduced in [MMRZ22] and [MMR23], it has quickly become the standard for measuring the performance of AMMs. Numerous attempts have been made to reduce LVR through dynamic fee policies, and this research continues actively. However, batch trade execution has not received much attention, except in [CF23] and [GGMR22]. In [CF23], the authors proposed a function-maximizing automated market maker (FM-AMM), asserting it effectively eliminates LVR, and provided numerical simulations comparing its performance with various Uniswap V3 pools. They later claimed that CoW-AMM (their implementation of FM-AMM) performed well in live settings too, which led to debate on Twitter regarding the legitimacy of their measurement methods. Although the debate focused more on whether markout is a useful metric for measuring performance, the existence of retail order flow and fluctuating transaction costs are also obstacles to precisely comparing their performance. In this article, we analyze the performance of FM-AMM and compare it to CPMM under fixed transaction costs and in the absence of retail order flow conditions like those in [N22] and [E24].

In detail, we slightly modified their design and found a Nash equilibrium in a game where arbitrageurs strategically submit orders to the (slightly modified) FM-AMM to maximize their returns. The game is similar to the liquidity provision game introduced in [MC24], which is a special form of the generalized Tullock contest. The resulting equilibrium has many favorable properties: the solution always uniquely exists, and it is symmetric. Moreover, LVR decays inversely proportionally to the number of participants. This model assumes that the number of arbitrageurs, NN, is pre-determined and transaction cost, cc, is zero. We proceed to a model where the number of participants is determined endogenously according to cc. In this setting, FM-AMM is not always superior; the result now depends on jump size, frequency, and cost. We provide numerical simulation results and suggest that FM-AMM fits well with rollup-based solutions.

2. FM-AMM

In this section we fill the omitted details of FM-AMM introduced in [CF23] to handle the more general case. The underlying AMM curve introduced in [CF23] is:

y_\text{out} = \frac{x_\text{in}}{X + 2x_\text{in}}Y,
yout=xinX+2xinY,

where x_\text{in}xin is the amount of token XX the trader is willing to sell, and y_\text{in}yin is the amount of token YY that she will receive. However, this is the simplest case where only a single side of order is submitted in batch. Authors of original paper handled the case such that both side of orders exist in the same batch by assuming users only specify the amount of token X to buy or sell. Unfortunately, this is hard to implement in fully on-chain manner since whether the trader has enough capital to buy specified amount of token X is not guaranteed before the batch is settled (Selling is not problematic; we can pull the token from trader and keep it by settlement). We generalize the formula to handle broader range of cases. Let X, YX,Y be reserves of pool, TT be total supply of LP tokens before batch settlement, x_\text{in}, y_\text{in}xin,yin be aggregate amount of each token that traders are willing to sell, and x_\text{mint}, y_\text{mint}xmint,ymint be aggregate amount of each token provided from LPs. The fundamental equation we will start with is:

\begin{align}\begin{bmatrix}x_{\text{mint}} \\y_{\text{mint}}\end{bmatrix}&=x_{\text{mint}} \begin{bmatrix}1 \\p\end{bmatrix}+\begin{bmatrix}0 \\2\alpha\end{bmatrix}\\\begin{bmatrix}x_{\text{in}} \\y_{\text{in}}\end{bmatrix}&=x_{\text{in}} \begin{bmatrix}1 \\p\end{bmatrix}+\begin{bmatrix}0 \\\beta\end{bmatrix}\\\begin{bmatrix}x_1 \\y_1\end{bmatrix}&=\begin{bmatrix}x_0 \cdot \frac{y_0 + \alpha + \beta}{y_0 + 2(\alpha + \beta)} \\y_0 + \alpha + \beta\end{bmatrix}\end{align}
[xmintymint]=xmint[1p]+[02α][xinyin]=xin[1p]+[0β][x1y1]=[x0y0+α+βy0+2(α+β)y0+α+β]

Here, the pp is the clearing price, and \alpha, \betaα,β are the net swap amount for swapping and minting, respectively. In short, among the submitted orders, we swap only part of them, \alphaα and \betaβ, then exchange the rest via p2p without changing the spot price. The fact that

\begin{bmatrix}x_{\text{mint}} \\y_{\text{mint}} - 2\alpha\end{bmatrix}, \begin{bmatrix}x_{\text{in}} \\y_{\text{in}} - \beta\end{bmatrix}, \begin{bmatrix}x_1 \\y_1\end{bmatrix}
[xmintymint2α],[xinyinβ],[x1y1]

are all parallel gives us following matrix equation:

\begin{equation}\begin{bmatrix}2x_0 + 2x_{\text{mint}} & 2x_{\text{mint}} \\2x_{\text{in}} & 2x_{\text{in}} + x_0\end{bmatrix}\begin{bmatrix}\alpha \\\beta\end{bmatrix}=\begin{bmatrix}x_0 y_{\text{mint}} - x_{\text{mint}} y_0 \\x_0 y_{\text{in}} - x_{\text{in}} y_0\end{bmatrix}\end{equation}
[2x0+2xmint2xmint2xin2xin+x0][αβ]=[x0ymintxminty0x0yinxiny0]

Note that the determinant of matrix in LHS is always strictly positive so above equation is not singular. \alpha, \betaα,β are:

\begin{align} (\alpha, \beta) = \left( \frac{\frac{x_{0} y_{mint}}{2} + x_{in} y_{mint} - \frac{x_{mint} y_{0}}{2} - x_{mint} y_{in}}{x_{0} + 2 x_{in} + x_{mint}}, \ \frac{x_{0} y_{in} - x_{in} y_{0} - x_{in} y_{mint} + x_{mint} y_{in}}{x_{0} + 2 x_{in} + x_{mint}}\right) \end{align}
(α,β)=(x0ymint2+xinymintxminty02xmintyinx0+2xin+xmint, x0yinxiny0xinymint+xmintyinx0+2xin+xmint)

The clearing price, p_cpc, is:

\begin{align}p_c = \frac{y_{0} + 2 y_{in} + y_{mint}}{x_{0} + 2 x_{in} + x_{mint}}\end{align}
pc=y0+2yin+ymintx0+2xin+xmint

x_\text{out}, y_\text{out}xout,yout are:

\begin{align}(x_\text{out}, y_\text{out}) &=\left( \frac{y_{in} \left(x_{0} + 2 x_{in} + x_{mint}\right)}{y_{0} + 2 y_{in} + y_{mint}}, \ \frac{x_{in} \left(y_{0} + 2 y_{in} + y_{mint}\right)}{x_{0} + 2 x_{in} + x_{mint}}\right) \\&= \left(\frac{y_\text{in}}{p_c}, p_c x_\text{in} \right) \\\end{align}
(xout,yout)=(yin(x0+2xin+xmint)y0+2yin+ymint, xin(y0+2yin+ymint)x0+2xin+xmint)=(yinpc,pcxin)

It is straight forward to find x_2, y_2x2,y2, the reserves after minting LP tokens, and tt, the newly issued LP token amount, so we would skip on them here.

Above construction charges no fee. To keep price same even after charging fee, we will take 1/(1 + \gamma)1/(1+γ) portion of input and \gammaγ portion of output as fee. So the effective fee rate will be \frac{2 \gamma}{1+ \gamma}2γ1+γ, which is approximately 2 \gamma2γ. Considering arbitrageurs it may better to take fee fully on input, though.

3. Model

In this section, we describe the model upon which our analysis is based. We model a normal form game involving strategic arbitrageurs. This means that each player is unaware of the bids of others, and all bids are submitted simultaneously. Additionally, each player’s bid is never censored. Although this assumption does not perfectly reflect the current state of blockchains, ongoing cryptographic developments and improved market designs, such as inclusion lists, will help bridge the gap between theory and reality. This formulation is almost the same as that of [CM24]; the only difference is that players now “take” mispriced liquidity instead of providing it to the AMM.

3.1. Automated Market Maker

For the AMM, we will use the FM-AMM introduced in Section 2. Note that the AMM itself is not a player; we assume that the LPs of the AMM are passive investors who will not take any action in the short term.

3.2. Arbitrageurs

We assume that all players are homogeneous. They are risk-neutral and can execute trades of any size and in any direction on CEX without any slippage. Their sole goal is to maximize profit.

3.3. Strategic Game of Liquidity Taking

First, we solve the game with NN players where NN is given exogenously, without considering transaction costs. Then, we introduce a strictly positive transaction cost cc and derive NN from the equilibrium condition. We will restrict our interest to conditions with positive trading fees, which guarantees the uniqueness of the equilibrium. Players observe the pool reserves XX, YY, and the external true price PP. Then, they submit bids (x_i, y_i)(xi,yi), which are the amounts of tokens to sell to the pool. The clearing price will be:

\begin{align}P_c = \frac{Y + 2\sum^N_{i=1} y_i }{X + 2\sum^N_{i=1} x_i} \tag{1} \\\end{align}
Pc=Y+2Ni=1yiX+2Ni=1xi(1)

The utility function is the arbitrage profit after charging the swap fee (and transaction cost, if applicable). The utility of player ii, U_iUi, is:

\begin{align}R_i = -(1 + \gamma)(P x_i + y_i) + (1 - \gamma)\left(\frac{P}{P_c}y_i + P_c x_i\right) \tag{2}\end{align}
Ri=(1+γ)(Pxi+yi)+(1γ)(PPcyi+Pcxi)(2)

Now, we are ready to find the equilibrium.

4. Equilibrium Analysis

4.1. NN is Determined Exogenously, and Transaction Cost cc is Zero

We first introduce the following lemma:

\text{Lemma. The player } i\text{'s best response is submitting a bid with at least one 0 component, that is, either } (x_i, 0) \text{ or } (0, y_i).
Lemma. The player i's best response is submitting a bid with at least one 0 component, that is, either (xi,0) or (0,yi).

The proof is straightforward. Assume (x_i, y_i)(xi,yi) and (x'_i, y'_i)(xi,yi) result in the same clearing price. Then x_i \leq x'_ixixi if and only if y_i \leq y'_iyiyi. Combining these and subtracting the utility of one from the other yields the desired result.

Meanwhile, the first order condition and the profitability condition give us that the best response is, when P_{-i}Pi is defined as P_{-i} = \frac{Y + 2\sum^N_{j \neq i} y_j }{X + 2\sum^N_{j \neq i} x_j}Pi=Y+2NjiyjX+2Njixj, submitting x_ixi or y_iyi such that the following holds:

\begin{align}P_c =\begin{cases}\sqrt{\frac{1 - \gamma}{1 + \gamma} P P_{-i}} & \text{if } \frac{1 - \gamma}{1 + \gamma} P \geq P_{-i} \\\sqrt{\frac{1 + \gamma}{1 - \gamma} P P_{-i}} & \text{if } \frac{1 + \gamma}{1 - \gamma} P \leq P_{-i}\end{cases}. \tag{3}\end{align}
Pc=1γ1+γPPiif 1γ1+γPPi1+γ1γPPiif 1+γ1γPPi.(3)

Otherwise, it is better not to submit any order (i.e., bid). One can think of \frac{1+\gamma}{1-\gamma}P_{-i}1+γ1γPi and \frac{1-\gamma}{1+ \gamma}P_{-i}1γ1+γPi as the threshold prices such that arbitrage becomes profitable. Note that this holds for every ii, so P_{-i} = P_{-j}Pi=Pj for every ii and jj, which tells us the equilibrium is symmetric and always exists.

From now on, we only consider the external price to be sufficiently higher than the pool’s spot price, Y/XY/X. The opposite case can be solved in a similar manner. It is clear that x_\text{eq} = 0xeq=0 for the case we are dealing with. Then, (3)(3) is equivalent to:

\begin{align}\frac{Y + 2Ny_\text{eq}}{X} = \sqrt{\frac{1-\gamma}{1+\gamma}P\cdot \frac{Y + 2 (N-1) y_\text{eq}}{X}} \tag{4}\end{align}
Y+2NyeqX=1γ1+γPY+2(N1)yeqX(4)

Solving (4)(4) yields that

\begin{align}y_\text{eq} = \frac{1}{4N^2}\left[ (N - 1) \cdot \frac{1-\gamma}{1+\gamma} \cdot PX -2NY + \sqrt{(N-1)^2 + 4N \cdot \frac{Y}{X} \cdot \frac{1+\gamma}{1-\gamma} \cdot \frac{1}{P}} \cdot \frac{1-\gamma}{1+\gamma}\cdot PX \right] \tag{5}\end{align}
yeq=14N2[(N1)1γ1+γPX2NY+(N1)2+4NYX1+γ1γ1P1γ1+γPX](5)

From now on, we will proceed with radical approximations due to its complexity. Although we do not provide any rigorous proof for the validity of such approximations, we will see it works well in the simulations later. Let P_0 = \frac{Y}{X}P0=YX and \varepsilon = \frac{1-\gamma}{1+\gamma} \cdot \frac{P}{P_0} - 1ε=1γ1+γPP01, that is, the price difference between the threshold price and the external price. Approximating y_\text{eq}yeq with \varepsilonε through a Taylor series gives us a simpler form:

\begin{align}y_\text{eq} &= \frac{Y}{4N^2}\left[ (N-1) \cdot (1+ \varepsilon) - 2N +(1+\varepsilon)\sqrt{(N-1)^2 +\frac{4N}{1+\varepsilon}}\right] \tag{6} \\&\approx \frac{Y}{2(N+1)} \varepsilon + o(\varepsilon^2) \tag{7}\end{align}
yeq=Y4N2[(N1)(1+ε)2N+(1+ε)(N1)2+4N1+ε]Y2(N+1)ε+o(ε2)(6)(7)

Using (7)(7), one can compute the profit of individual arbitrageurs and the total loss of the AMM against arbitrageurs:

\begin{align}ARB &\approx L\sqrt{P_0}\cdot\left(\frac{1+\gamma}{2(N+1)^2}\right)\cdot\varepsilon^2 \tag{8} \\LVR &\approx (1+\gamma)\cdot L\sqrt{P_0}\cdot\left(\frac{N}{2(N+1)^2}\right)\cdot\varepsilon^2 \tag{9}\end{align}
ARBLP0(1+γ2(N+1)2)ε2LVR(1+γ)LP0(N2(N+1)2)ε2(8)(9)

Thus, assuming the transaction cost is 00, for any NN, every NN arbitrageur will submit identical bids and they will share the profit equally, while each individual arbitrageur’s profit will decay by O(N^{-2})O(N2). Moreover, as N N goes to infinity the clearing price P_cPc converges to threshold price, and therefore the stationary distribution of price discrepancy will be as same as that of fixed fee rate CPMM in [MMR23].

4.2. Transaction Cost is Not Free, and the Number of Arbitrageurs is Determined Endogenously

Now we extend the model in 4.1 to a more realistic one by adopting a nonzero transaction cost cc. The utility function remains the same as in (2)(2), except we have an additional term -cc. Since this term disappears when we take the derivative, the best response remains the same as long as it is profitable. Thus, the solution is not much different from (7)(7), except NN is replaced with N^{*}N, where N^{*}N is the largest integer that satisfies L\sqrt{P_0}\cdot\left(\frac{1+\gamma}{2(N^{*}+1)^2}\right)\cdot\varepsilon^2 \geq cLP0(1+γ2(N+1)2)ε2c. Then, the LVR will be:

\begin{align}LVR &\approx (1+\gamma) \cdot L \sqrt{P_0} \cdot\varepsilon^2 \cdot \frac{N^{*}}{2(N^{*}+1)^2} \tag{10} \\&\approx cN^{*} \tag{11} \\&\approx c \left \lfloor \varepsilon\sqrt{\frac{1+\gamma}{2c} \cdot L \sqrt{P_0}}- 1 \right\rfloor \tag{12} \\&\leq \varepsilon\sqrt{(1+\gamma)2c \cdot L \sqrt{P_0}} \tag{13}\end{align}
LVR(1+γ)LP0ε2N2(N+1)2<

Source
Disclaimer: The content above is only the author's opinion which does not represent any position of Followin, and is not intended as, and shall not be understood or construed as, investment advice from Followin.
Like
Add to Favorites
Comments