- Department of Economics and Statistics, University of Siena, Siena, Italy
One of the most interesting applications of blockchain is given by the automated market makers (AMMs). In the paper, we discuss how arbitrage activity between the AMMs and the other exchange nodes can affect the volumes of assets in liquidity pools of constant function AMMs. In particular, we argue that arbitrage superimposes to the constant function in determining the liquidity volumes within the same AMM and across different AMMs. Yet, despite representing an additional condition in the model, equilibrium arbitrage is typically not unique because it may depend on several elements, such as the amount of liquidity in the system and the number of exchange nodes. Hence, the paper discusses how the constant function and arbitrage jointly determine the relationship across the assets’ liquidity volume in the pool but not a unique value for such volumes unless further constraints are introduced. Therefore, a platform interested in predicting the pool’s liquidity volumes may face indeterminacy as to which equilibrium would prevail. Though arbitrage has been discussed in related literature, equilibrium indeterminacy does not seem to have been pointed out.
1 Introduction
One of the most interesting applications of blockchain is given by the automated market makers (AMMs). These are platforms where tokens, typically cryptocurrencies, can be deposited by liquidity providers, forming liquidity pools, to obtain an interest for such service. The available assets can then be traded against each other through smart contracts at a price that is determined by the amount of liquidity of such assets in the AMM, together with a rule governing their exchange.
A widespread family of AMMs is the so-called constant function AMMs (CFAMMs), whose properties have been extensively studied in the literature (Di and Guida, 2017; Cliff, 2018; Angeris and Chitra, 2020; Angeris et al., 2020; Angeris et al., 2021; Angeris et al., 2022; Aoyagi, 2022; Bartoletti et al., 2022; Fabi et al., 2022; Mohan, 2022; Wang and Krishnamachari, 2022; Fabi et al., 2023; Doe et al., 2023; Xu et al., 2023; Milionis et al., 2024a; Milionis et al., 2024b; Tran et al., 2024). In pairwise liquidity pools with only two assets, the price at which they swap with each other depends on the liquidity volumes currently in the pool. In CFAMMs, the exchange price is characterized by the fact that, when swapping one asset for another, a certain specified function of the assets’ liquidity volumes must be kept at the same value (Fabi and Prat, 2023). That is, before and after the asset exchange, some function must preserve the same value. This is, the function defines the price at which one asset trades with the other. In particular, Uniswap has been the first successful platform to use CFAMM, followed by several others, such as Balancer and Curve.
Therefore, choosing which constant function to adopt is a policy decision taken by the platform because it is selected unilaterally by the AMM. However, the constant function can change its value whenever liquidity providers decide, for example, to deposit units of assets in the pool. Analogous considerations hold when providers decide to withdraw liquidity from the pool. In addtion to constant functions, the arbitrage activity taking place between the CFAMM and the other exchange nodes in the market represents an important additional element to consider when analyzing CFAMMs.
Indeed, arbitrage superimposes to the constant function in determining the CFAMM prices and liquidity volumes. As a matter of fact, it is intuitive to think that the price at which two assets trade in a CFAMM should typically be related to the price charged by other exchange nodes in the market. Looking for the most convenient prices, investors will trade quantities and, in so doing, tend to equalize such prices by exchanging assets in different nodes.
In the article, we investigate how arbitrage activity affects, in equilibrium, liquidity volumes in a CFAMM, where by “equilibrium,” we mean that arbitrage activity has taken place and that trading prices within a CFAMM are equal to the prices prevailing in the market exchange nodes. Although the importance of arbitrage is well known in the CFAMM literature (Aoyagi, 2020; Angeris et al., 2020; Angeris et al., 2021; Mohan, 2022; Tran et al., 2024), to our knowledge, no contribution has presented an articulated analysis of the implications of arbitrage in a variety of contexts, which is the goal of this paper. We think this is very important to envisage how the CFAMM and the market exchange nodes will relate. Yet, as we shall see, although the constant function and the arbitrage activity constrain liquidity pool volumes, arbitrage equilibria are typically not unique unless additional conditions are introduced. Such multiplicity depends on the amount of liquidity in the market, the number of users, their preferences, etc., and it is difficult to obtain uniqueness unless more specific additional conditions are introduced. Together with the equilibrium value determination of liquidity deposits, the issue of indeterminacy is our main contribution to the existing literature. In particular, the analysis suggests that arbitrage activity in a CFAMM can determine the relationship between the amount of assets’ liquidity deposited but not their absolute value. The work is structured as follows. In Section 2, we introduce the basics of CFAMMs and discuss how arbitrage affects price and liquidity volumes. Section 3 concludes the paper.
2 The model
In what follows, we shall begin by considering a CFAMM with liquidity pools composed of two assets. Later, we shall extend the pools to more than two assets. Such pools allow for swapping one asset with the other as well as for depositing liquidity on the part of liquidity providers who can obtain a fee from doing that. First, with no major loss of generality, we assume no fees are paid to liquidity providers or to the platform for swapping assets, etc. Transaction fees will be discussed later.
Suppose
where
Indeed, while the function
Therefore, for small traded quantities, assuming
when the quantity of the two assets is
Similar reasoning could also be applied to the constant function when the asset liquidity and the constant change with time
then, assuming the differentiability of all the relevant functions,
that is, if
For example, if
2.1 Arbitrage condition
Suppose now the two assets are traded also in other exchange nodes, and that
where, as above,
Therefore, Equation 5 can be re-written as
It follows that
is the prevailing exchange rate in the market, which could also represent a market price between the two assets whenever
Therefore, arbitrage activity between a CFAMM and the market exchange nodes would imply
so that Equation 5 becomes
Finally, replacing Equation 9 in Equation 1 provides
Equation 10 lays the ground for the following question. How does arbitrage activity affect the liquidity volumes and the prices in a CFAMM? That is, can the arbitrage condition and the constant function be both satisfied, and how will the liquidity volumes in the pool be influenced? We discuss the issue below.
2.2 Arbitrage equilibrium in CFAMMs
The above question can be rephrased as follows: is it possible to find values for
Because the system has three equations and four unknowns, it would typically allow for multiple solutions.
To illustrate this point, take again
The above expressions represent one AE of the pool for a given pair
For instance, if
The interpretation of Equation 11 is immediate; there is a unique AE with
Thus, as
To summarize,
Moreover, Equation 11 implies that the market value, measured in
Alternatively, if
which shows that, at an AE,
Expression (Equation 12a) clarifies that once the triple
Therefore, given the market conditions, by choosing
An additional perspective to determine the relationship between
Then, Equation 12b is a quadratic equation that leads to the following two possible solutions when
Because
then from Equation 14 it follows
Instead, considering
the level of
In this case, any pair
Finally, the only way for arbitrage to be guaranteed is to have
More in general, from
As an additional example, suppose
Finally, but no less important, AE could also be obtained as the solution to the following minimization problem (Milionis et al., 2024a), with
then
Differentiating Equation 15 with respect to
which, when solved, provides
as in Equation 12, for
Likewise, solving the following maximization problem:
for given
which is the same solution. To summarize, arbitrage would either minimize
2.3 Arbitrage equilibrium, within CFAMMs, with several liquidity pools
A CFAMM typically contains several liquidity pools, where one asset could be traded against different assets. When this is the case, arbitrage implies that the asset quantities in the liquidity pairwise pools must be related in a specific way.
Consider, for example, the following three assets:
it follows that, at an AE,
From Equation 16, we also obtain
and Equation 17 implies that
with Equation 18 also exhibiting multiple solutions. Hence, the asset quantities in the three liquidity pools must stand in a specific relationship when arbitrage takes place, and so
and therefore,
which means that if
2.4 Arbitrage equilibrium across multiple CFAMMs
Suppose now that
Arbitrage equilibrium in different markets for the same pair of assets introduces additional constraints. This suggests that, in general, different CFAMMs trading the same pair of assets could all achieve an AE in their liquidity pool only under very specific conditions on the market prices. In particular, if any CFAMM adopts the
2.5 CFAMMs with multiple assets
We will now consider what happens when more than two assets are traded within the same CFAMM. To see our main point, consider again the simplest case of three assets,
A distinguishing feature of trading pairs of assets is that, typically, the trading price in each pool is independent of the trading price in another pool. For example, suppose the quantities of the two assets in the
That is, in the
Suppose instead that the three assets are part of the same pool,
and that now in Equation 20 the liquidity of
However, compared to trading in pairwise separate and independent pools, now the trade between
In principle, with
For example, suppose a CFAMM contains the pairwise pools
Therefore, it follows that the value $ of the three assets in the four pools expressed in
Based on the above considerations, it is natural to ask if it would make sense for a platform to have separate pools with two assets, three assets, etc. For example, in case the solution is given by Equation 22, having a single pool with three assets and liquidity
We now extend the above considerations to CFAMMs with multiple assets. Suppose
Equation 23 is the generic constant value function with
For example, taking
then
Considering Equations 24–26 and proceeding in analogy with the case of two assets, we obtain that
and also that
which, for the benchmark case of
where
In analogy to Equations 27–29, it is immediate to verify that if
then
where Equation 31 represents a simple linear relationship between k and M.
2.6 Some additional examples of CFAMMs
In the above examples with
Then, the arbitrage condition will lead to
which implies
and so
In the simple case of
then
while
Hence, based on Equations 33–38, Equation 32 becomes Equation 39 below.
Moreover, consider a convex combination, with 0<a<1, of the two expressions used individually as constant functions:
A version of Equation 40 is used by the Curve platform. The discussion shows how finding the equilibrium arbitrage may not always be so immediate. Indeed,
so that arbitrage implies
Equations 40–42 lead to
Equation 43 suggests that
2.7 Transaction fees
As anticipated above, to conclude the paper, we introduce transaction fees to see how they may affect the AE. A simple way to do so in a two-asset liquidity pool is to define
where
namely, now the deposits at an AE increase with the fees because part of the deposited sums will not be available in the pool.
Finally, the constant parameter
To summarise, Equations 44–46 suggest that the fees on the two assets will affect the absolute, and relative size, of their liquidity volumes.
3 Conclusion
In this paper, we discussed how arbitrage activity can affect the liquidity volumes and swap prices in a CFAMM. Indeed, CFAMMs do not typically operate in isolation but within a market where other exchange nodes can trade the same assets. Therefore, arbitrage activity superimposes to the constant function property, establishing the asset trading prices. In the analysis, we argued how the arbitrage equilibrium is not unique for a given CFAMM, as it can be obtained for different levels of liquidity available in the economy as well as with different numbers of exchange nodes trading the same assets.
We considered arbitrage in a variety of circumstances, within the same CFAMM but also across different CFAMMs and exchange nodes. The main intuitive message of the article is that arbitrage represents an additional important constraint to the relevant constant function in determining the trading prices and the deposit volumes in CFAMM liquidity pools.
Data availability statement
The original contributions presented in the study are included in the article/supplementary material; further inquiries can be directed to the corresponding author.
Author contributions
ND: writing–review and editing, writing–original draft, methodology, formal analysis, and conceptualization.
Funding
The author declares that no financial support was received for the research, authorship, and/or publication of this article.
Acknowledgments
I would like to thanks the Associate Editor and the reviewers for constructive comments.
Conflict of interest
The author declares that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.
The author declared that they were an editorial board member of Frontiers, at the time of submission. This had no impact on the peer review process and the final decision.
Publisher’s note
All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors, and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.
References
Angeris, G., Agrawal, A., Evans, A., Chitra, T., and Boyd, S. (2022). “Constant function market makers: multi-asset trades via convex optimization,” in Handbook on blockchain (Springer), 415–444.
Angeris, G., and Chitra, T. (2020). “Improved price oracles: constant function market makers,” in Proceedings of the 2nd ACM Conference on Advances in Financial Technologies, New York, NY, October 21–23, 2020 (Association for Computing Machinery), 80–91.
Angeris, G., Evans, A., and Chitra, T. (2020).When does the tail wag the dog? Curvature and market making, arXivpreprintarXiv:2012.08040.
Angeris, G., Evans, A., and Chitra, T. (2021). Replicating market makers, arXivpreprint arXiv:2103.14769.
Aoyagi, J. (2022). Liquidity provision by automated market makers. Available at: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3674178 (Accessed June 15, 2024).
Bartoletti, M., Chiang, J., and Llluch-Lafuente, A. (2022). A theory of automated market makers in DEFI. Log. Methods Comput. Sci. 18, 1–46. doi:10.46298/lmcs-18(4:12)2022
Cliff, D. (2018). “An open-source limit-order-book exchange for teaching and research,” in Proceedings of the 2018 IEEE Symposium Series on Computational Intelligence, Bangalore, India, November 18–21, 2018 (IEEE), 1853–1860.
Di, P. L., and Guida, F. (2017). A discrete trinomial model for the birth and death of stock financial bubbles. AIP Conf. Proc. 1906, 190007. doi:10.1063/1.5012470
Doe, D. M., Li, J., Dusit, N., Wang, L., and Han, Z. (2023). Incentive mechanism design for mitigating frontrunning and transaction reordering in decentralized exchanges. IEEE Access 11, 96014–96028. doi:10.1109/access.2023.3236891
Fabi, M., Kassoul, M., and Prat, J. (2023). SOK: constant functions market makers. Paris: Blockchain Politechnique. Working Paper 2023-02-07.
Fabi, M., and Prat, J. (2023). The economics of constant functions market makers. Blockchain Politechnique. Working Paper 2023-04-004.
Milionis, J., Moallemi, C., Roughgarden, T., and Zhang, A. (2024a). Automated market making and loss-versus rebalancing, arXiv:2208.06046 [q-fin.MF].
Milionis, J., Moallemi, C. C., and Roughgarden, T. (2024b). “Extended abstract: the effect of trading fees on arbitrage profits in automated market makers,” in Lecture notes in computer science (including subseries lecture notes in artificial intelligence and lecture notes in bioinformatics), 13953, 262–265. doi:10.1007/978-3-031-48806-1_17
Mohan, V. (2022). Automated market makers and decentralized exchanges: a DeFi primer. Financ. Innov. 8, 20. doi:10.1186/s40854-021-00314-5
Tran, T., Tran, D. A., and Nguyen, T. (2024). Order book inspired automated market making. IEEE Access 12, 36743–36763. doi:10.1109/access.2024.3372402
Wang, S., and Krishnamachari, B. (2022). “Optimal trading on a dynamic Curve automated market maker,” in IEEE International Conference on Blockchain and Cryptocurrency, Shanghai, China, May 02–05, 2022 (IEEE).
Keywords: arbitrage, automated market makers, constant functions, equilibrium multiplicity, liquidity pools
Citation: Dimitri N (2024) Arbitrage in automated market makers. Front. Blockchain 7:1455070. doi: 10.3389/fbloc.2024.1455070
Received: 26 June 2024; Accepted: 09 September 2024;
Published: 14 October 2024.
Edited by:
Andrea Pinna, University of Cagliari, ItalyReviewed by:
Matteo Vaccargiu, University of Cagliari, ItalyLuca Di Persio, University of Verona, Italy
Copyright © 2024 Dimitri. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.
*Correspondence: Nicola Dimitri, dimitri@unisi.it