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, N, is pre-determined and transaction cost, c, is zero. We proceed to a model where the number of participants is determined endogenously according to c. 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:
where x_\text{in} is the amount of token X the trader is willing to sell, and y_\text{in} is the amount of token Y 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, Y be reserves of pool, T be total supply of LP tokens before batch settlement, x_\text{in}, y_\text{in} be aggregate amount of each token that traders are willing to sell, and x_\text{mint}, y_\text{mint} be aggregate amount of each token provided from LPs. The fundamental equation we will start with is:
Here, the p 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
are all parallel gives us following matrix equation:
Note that the determinant of matrix in LHS is always strictly positive so above equation is not singular. \alpha, \beta are:
The clearing price, p_c, is:
x_\text{out}, y_\text{out} are:
It is straight forward to find x_2, y_2, the reserves after minting LP tokens, and t, 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) portion of input and \gamma portion of output as fee. So the effective fee rate will be \frac{2 \gamma}{1+ \gamma}, which is approximately 2 \gamma. 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 N players where N is given exogenously, without considering transaction costs. Then, we introduce a strictly positive transaction cost c and derive N 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 X, Y, and the external true price P. Then, they submit bids (x_i, y_i), which are the amounts of tokens to sell to the pool. The clearing price will be:
The utility function is the arbitrage profit after charging the swap fee (and transaction cost, if applicable). The utility of player i, U_i, is:
Now, we are ready to find the equilibrium.
4. Equilibrium Analysis
4.1. N is Determined Exogenously, and Transaction Cost c is Zero
We first introduce the following lemma:
The proof is straightforward. Assume (x_i, y_i) and (x'_i, y'_i) result in the same clearing price. Then x_i \leq x'_i if and only if y_i \leq y'_i. 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} is defined as P_{-i} = \frac{Y + 2\sum^N_{j \neq i} y_j }{X + 2\sum^N_{j \neq i} x_j}, submitting x_i or y_i such that the following holds:
Otherwise, it is better not to submit any order (i.e., bid). One can think of \frac{1+\gamma}{1-\gamma}P_{-i} and \frac{1-\gamma}{1+ \gamma}P_{-i} as the threshold prices such that arbitrage becomes profitable. Note that this holds for every i, so P_{-i} = P_{-j} for every i and j, 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/X. The opposite case can be solved in a similar manner. It is clear that x_\text{eq} = 0 for the case we are dealing with. Then, (3) is equivalent to:
Solving (4) yields that
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} and \varepsilon = \frac{1-\gamma}{1+\gamma} \cdot \frac{P}{P_0} - 1, that is, the price difference between the threshold price and the external price. Approximating y_\text{eq} with \varepsilon through a Taylor series gives us a simpler form:
Using (7), one can compute the profit of individual arbitrageurs and the total loss of the AMM against arbitrageurs:
Thus, assuming the transaction cost is 0, for any N, every N arbitrageur will submit identical bids and they will share the profit equally, while each individual arbitrageur’s profit will decay by O(N^{-2}). Moreover, as N goes to infinity the clearing price P_c 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 c. The utility function remains the same as in (2), except we have an additional term -c. 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), except N is replaced with N^{*}, where 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 c. Then, the LVR will be:
4.3. Comparison with CPMM
The derivation of the LVR for CPMM has already been studied extensively, so we will simply present the result:
where \gamma is the fee rate taken from the input and \varepsilon is again the price difference between the external price and the threshold price, in this case, \frac{P_0}{1-\gamma}. In short, the LVR of CPMM grows faster than that of FM-AMM as \varepsilon (the price difference) and L\sqrt{P_0} (the initial pool size) grow. From this, we can predict that the performance of FM-AMM will be better in larger pools compared to CPMM.
FM-AMM performance is affected by the transaction cost c, while CPMM is not affected as long as the arbitrageur’s profit is greater than c. This implies that FM-AMM suits well with rollup settings that have longer block times (resulting in higher volatility between blocks) and low transaction costs.
5. Simulations
Due to the nonzero transaction cost, finding an analytic solution for instantaneous LVR or the stationary distribution of price discrepancy is no longer straightforward. Therefore, we proceed with numerical simulations. You can check the code used here. This code is largely copy-pasted with minor tweaks from this source. Swap fees are fixed at 0.3% across all simulations (i.e., \gamma_\text{FMAMM} = 0.0015, \gamma_\text{CPMM} = 0.003).
5.1. Distribution of LVR
In this section, we observe the distribution of LVR under several cases without iterating over many parameters. Note that the variance is always greater in FM-AMM; this is because the price is not corrected perfectly under the nonzero transaction cost condition.
The conditions of the first case are L1 (12-second block time), $10 transaction cost, with 5% daily volatility and $100M pool size.
The second is L1, $10 transaction cost, with 10% volatility and $100M pool size.
As predicted, FM-AMM outperforms CPMM as volatility increases.
Next one is L1 with congestion; transaction cost went up to $30.
This fits to our prediction well, too. As tx cost increases FM-AMM loses more than CPMM.
The last result is L1 with congestion, but with smaller liquidity ($10M).
This result is a bit contradictory to our initial guess: usually, smaller liquidity conditions are more favorable to CPMM, as LVR per pool value of FM-AMM increases as the pool value gets smaller. To clarify this, we will run simulations over various parameters and compare the performances.
5.2. Performance Comparisons
Below are the numerical simulations of LVR for CPMM and FM-AMM under various parameters. Swap fees are set at 0.3% for both of them. Blue regions indicate where CPMM performs better, while grey regions indicate where FM-AMM performs better. Note that the results in the low volatility and high-cost regions are not as reliable due to the very few trades occurring in these conditions.
First is the cases for L1:
Following are the special cases for based rollup (tx cost = $0.05, block time = 12 sec) and typical L2s (tx cost = 0.01, block time = 2 sec), respectively:
5.3. Discussion
It is clear that FM-AMM performs better under certain conditions, including L2s and L1 with low transaction costs, and this partially explains why the results in [CF23] was rather mixed and defer by each pair. Due to its nature of forcing competition over price between arbitrageurs, it performs well even in high volatility conditions. Notably, this is achieved without raising the swap fee, which typically results in losing retail order flow. Thus, FM-AMM can lose less to arbitrageurs while not sacrificing retail order flow.
6. Conclusion
As the authors of [CF23] claimed, FM-AMM indeed achieves superior performance under certain conditions, even without raising swap fees. It suits L2s particularly well. However, our analysis is based on several non-realistic assumptions, especially the (short-term) censorship resistance assumption and simultaneous bid submission. Future research will focus on more relaxed conditions to provide a more comprehensive evaluation.
7. References
[MMRZ22] J. Milionis, C. C. Moallemi, T. Roughgarden, and A. L. Zhang. Automated Market Making and Loss-Versus-Rebalancing, arXiv preprint arXiv:2208.06046, 2022.
[MMR23] J. Milionis, C. C. Moallemi, and T. Roughgarden. Automated Market Making and Arbitrage Profits in the Presence of Fees, arXiv preprint arXiv:2305.14604, 2023.
[GGMR22] G. Ramseyer, M. Goyal, A. Goel, and D. Mazières. Augmenting Batch Exchanges with Constant Function Market Makers, arXiv preprint arXiv:2210.04929, 2022.
[CF23] A. Canidio and A. Fritsch. Arbitrageurs’ profits, LVR, and sandwich attacks: batch trading as an AMM design response, arXiv preprint arXiv:2307.02074, 2023.
[CM24] D. Crapis and J. Ma. The Cost of Permissionless Liquidity Provision in Automated Market Makers, arXiv preprint arXiv:2402.18256, 2024.
[N22] A. Nezlobin. Ethereum Block Times, MEV, and LP returns, Medium article Ethereum Block Times, MEV, and LP returns, 2022
[E24] A. Elsts. CEX/DEX arbitrage, transaction fees, block times, and LP profits, Ethresearch Forum article CEX/DEX arbitrage, transaction fees, block times, and LP profits, 2024