Skip to main content

ORIGINAL RESEARCH article

Front. Blockchain, 14 October 2024
Sec. Blockchain Economics

Arbitrage in automated market makers

  • 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 M>0 is the total liquidity value in the pool, expressed in terms of a currency, say $, available in a two-asset pool XY, where the assets X and Y can be swapped. If x and y are the quantities deposited in the pool, respectively, of X and Y, then

fx,y=k,(1)

where fx,y defines the function of the AMM that needs to take the constant value k>0. This means that if one asset is swapped with the other when x and y are the initial liquidity volumes, and if the liquidity volumes are x and y after the swap, then fx,y=k.

Indeed, while the function f is chosen by the platform, the number k is determined by the amount of liquidity deposited, consistent with f. For example, if fx,y=xy, and x=10=y, then k=100. Therefore, if the liquidity in the pool does not change, any swap between X and Y must keep the liquidity levels of X and Y in such a way that Equation 1 is satisfied. For this reason, the constant k should be more properly written as kxy, to indicate that it depends on the liquidity levels x,y and that for alternative liquidity levels, the constant would be different. This amounts to observing that k may vary with time, and that in general, it could also be indicated kt, where t is time. Indeed, as a follow up to the above example, if now the liquidity is x=100=y, that is scaled up by a multiplicative factor of 10 in both assets, not to change their initial ratio, then k=10,000. It is well known that higher liquidity volumes will change the terms of trade. Indeed, suppose x=10=y; then if 5 units of X are swapped against Y, the new liquidity volumes will be x=15,y=6.67 which means that 5 units of X traded against 3.33 units of Y. However, if instead the liquidity was x=100=y, then 5 additional units of X trade against 4.76 units of Y with the new pair being x=105,y=95.24. That is, the same amount of traded X, 5 units, would swap against a larger amount of Y due to the larger availability of Y.

Therefore, for small traded quantities, assuming fx,y to be partially differentiable by defining fx=fx,yx and fy=fx,yy, and equalizing the total differential of Equation 1 to 0, we obtain that in the CFAMM, the price pxy of Y in terms of X, expressed according to YX, can be found as follows:

fxdx+fydy=0pxy=dydx=fxfy(2)

when the quantity of the two assets is x and y. Assuming fx,fy>0, it follows that dydx<0, that is, if X is deposited, then Y is obtained by the liquidity provider and the contrary. Therefore, pxy=dydx represents the number of Y units that can be obtained with a small amount of X, that is, the price of Y assets in terms of X in the CFAMM.

Similar reasoning could also be applied to the constant function when the asset liquidity and the constant change with time xt,yt and kt, where t is time, to investigate their dynamics. Namely, if now Equation 1 is written as

fxt,yt=kt,(3)

then, assuming the differentiability of all the relevant functions,

dktdt=fxdxtdt+fydytdt,(4)

that is, if x and y experience some small changes with time, then k reacts by adjusting its value accordingly. From Equation 4, it follows that dktdt=0 whenever dxtdt=0=dytdt but also if Equation 2 holds when dxtdt,dytdt>0.

For example, if fx,y=xayb, with a,b>0, then pxy=aybx. Hence, if a=b, then pxy=yx, that is, the price is given by the simple ratio of the two liquidity volumes, regardless of the values of a=b.

2.1 Arbitrage condition

Suppose now the two assets are traded also in other exchange nodes, and that qx$=$X and qy$=$Y are the prevailing market prices, that is, how many $ can be bought with, respectively, one unit of X and Y. Then, the following holds:

xqx$+yqy$=M,(5)

where, as above, M is the total liquidity available in the pool, expressed in $. In analogy with Equation 4, considering also qx$,qy$,M as functions of time, and assuming differentiability of the relevant functions, the dynamics of Equation 5 are given by

dMtdt=dxtdtqx$t+xtdqx$tdt+dytdtqy$t+ytdqy$tdt.

Therefore, Equation 5 can be re-written as

xqx$qy$+y=Mqy$.(6)

It follows that

qxy=qx$qy$(7)

is the prevailing exchange rate in the market, which could also represent a market price between the two assets whenever X and Y are also directly traded against each other in exchange nodes.

Therefore, arbitrage activity between a CFAMM and the market exchange nodes would imply

qxy=qx$qy$=pxy(8)

so that Equation 5 becomes

xpxy+y=Mqy$y=Mqy$xfxfy.(9)

Finally, replacing Equation 9 in Equation 1 provides

fx,Mqy$xfxfy=k.(10)

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 x,y,qy$,qx$ that solve the set of Equations 19? If yes, we then define the solutions as an arbitrage equilibrium (AE). As said above, our main contribution with respect to the received literature will stand in pointing out the equilibrium multiplicity and its implications within the same CFAMM and across different CFAMMs.

Because the system has three equations and four unknowns, it would typically allow for multiple solutions.

To illustrate this point, take again fx,y=xayb. Then, fixing qx$, qy$, and the total liquidity value M, we can solve Equations 19 to obtain

x=Maa+bqx$=yaqy$bqx$,y=Mba+bqy$=xbqx$aqy$,k=aqx$abqy$bMa+ba+b.(11)

The above expressions represent one AE of the pool for a given pair qx$ and qy$ and an overall liquidity level M.

For instance, if M=100,a=1=b,qx$=1, qy$=2, then x=50,y=25, and k=1250.

The interpretation of Equation 11 is immediate; there is a unique AE with M=100,a=1=b,qx$=1, qy$=2 given by x=50,y=25, and k=1250. However, if instead, everything else is the same, and qx$=2, then the unique AE is as before, except that now x=25.

Thus, as M,qx$ and qy$ change, x,y,k would also change. Indeed if M=1000, rather than M=100, then with qx$=1, qy$=2, it follows that x=500,y=250 and k=125,000. Therefore, there exists an infinity of AE, each defined by Equation 11.

To summarize, x and y depend on the prevailing market prices, qx$ and qy$, so they could not be kept under direct control by the CFAMM. Indeed, the market prices are subject to volatility, and their uncertainty would contribute to the equilibrium indeterminacy. If the platform has preferred values for x and y, it will have to intervene in the pool by depositing/withdrawing the desired amount of liquidity in case the providers do not spontaneously do so.

Moreover, Equation 11 implies that the market value, measured in $, of the two assets deposited in the CFAMM must be the same and equal to M2. This is because a=b, and it is immediate to verify that if, for example, a>b, then yqy$<xqx$. Additionally, it is worth noting that, for instance, a>b is neither a necessary nor a sufficient condition for x>y. Indeed, x>y requires ab>qx$qy$, which can be satisfied even with a<b, as long as qx$qy$ is sufficiently small.

Alternatively, if k, rather than M, is fixed, it follows that x,y and M in Equation 11 could be expressed as

x=kaqy$bqx$b1a+b;y=kbqx$aqy$a1a+b;M=a+bkqx$aaqy$bb1a+b,(12a)

which shows that, at an AE, x,y,M are increasing functions of k, concave for a+b>1, linear if a+b=1, and convex for a+b<1. It also shows that x and y are decreasing in their own price and increasing in the other asset’s price. The intuition is immediate and hinges on a substitution effect. If one asset becomes too expensive, then it is convenient to deposit the other asset.

Expression (Equation 12a) clarifies that once the triple k,qx$ and qy$ are fixed, then x and y, hence M, are uniquely determined by the constant product and the arbitrage activity.

Therefore, given the market conditions, by choosing k, the CFAMM could, in principle, control the amount of liquidity in the two asset pools, suggesting that the value of k might, again in principle, become a policy instrument to regulate the system liquidity.

An additional perspective to determine the relationship between k and the other quantities under arbitrage activity is the following. Suppose again, for simplicity, that a=1=b. Then x=ky, which, when replaced into Equation 5, provides

kqx$y+yqy$=M.(12b)

Then, Equation 12b is a quadratic equation that leads to the following two possible solutions when y is solved:

y1,2=MM24kqx$qy$2qy$.(13)

Because xy=k, then M24kqx$qy$=xqx$yqy$20, implying that Equation 13 always admits real number solutions. If M24qx$qy$>k then Equation 13 will have two positive roots. Consider first

y=y1=M+M24kqx$qy$2qy$=xqx$qy$,(14)

then from Equation 14 it follows yx=qx$qy$, which would mean that arbitrage is also satisfied. However, this is impossible because yx=qx$qy$ implies y=xqx$qy$ and, therefore, that y=M2qy$,x=M2qx$, hence M24qx$qy$=k contradicts the initial assumption of M24qx$qy$>k.

Instead, considering

y=y2=MM24kqx$qy$2qy$=2qy$y2qy$=y,

the level of y is left undetermined so that x=ky.

In this case, any pair x,y such that xy=k and M24qx$qy$>k would satisfy constant product but could not satisfy arbitrage. Therefore, with two roots, arbitrage would not be obtained.

Finally, the only way for arbitrage to be guaranteed is to have M24qx$qy$=k, that is, when Equation 12 has a unique root, which is a modality to characterize the value of k, hence of x,y,M, and obtain both constant product and arbitrage.

More in general, from fx,y=k, one can find x=gy,k, which, when substituted into Equation 5, gives gy,kqx$+yqy$=M. If this is solvable in y, it provides the level of the two assets’ liquidity that satisfies constant sum but not necessarily arbitrage.

As an additional example, suppose fx,y=x+y=k. Then, x=ky=gk,y and kyqx$+yqy$=M so that y=Max(0,Mkqx$qy$qx$) for qy$qx$, in which case AE will not be achieved. However, if qy$=q=qx$, then any 0ykx satisfies constant sum as well as arbitrage.

Finally, but no less important, AE could also be obtained as the solution to the following minimization problem (Milionis et al., 2024a), with fx,y=xy=k:

minx,yxqx$+yqy$suchthatxy=k,

then

minykqx$y+yqy$.(15)

Differentiating Equation 15 with respect to y, we obtain

kqx$y2+qy$=0,

which, when solved, provides

y=kqx$qy$,

as in Equation 12, for a=1=b. That is, AE obtains when the value of the pool subject to the constant function constraint is minimized for given k, qx$ and qy$.

Likewise, solving the following maximization problem:

maxx,yxysuchthatxqx$+yqy$=M,

for given M, qx$ and qy$ would provide

y=M2qy$,

which is the same solution. To summarize, arbitrage would either minimize M for given k or maximize k for given M.

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: X,Y,Z, which are traded in pairs in the pools XY;XZ;YZ within the same CFAMM. Furthermore, suppose xy,xz,yx,yz,zx,zy are the quantities of the three assets in the three liquidity pools. Then, assuming

fxy,yx=xyyx=kxy,fxz,zx=xzzx=kxz,fzy,yz=yzzy=kzy,

it follows that, at an AE,

qy$qx$=xyyx,qz$qx$=xzzx,qy$qz$=zyyz.(16)

From Equation 16, we also obtain

qy$qz$=zyyz=qy$qx$qz$qx$=xyyxxzzx,(17)

and Equation 17 implies that

zyyxxzzxyzxy=1,(18)

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 kxy, kxz, and kyz, too. Indeed, if Mxy, Mxz, and Myz are the values, in $, of the three liquidity pools, then

kxy=Mxy24qx$qy$;kxz=Mxz24qx$qz$,

and therefore,

Mxy=Mxzkxykxzqy$qz$,(19)

which means that if kxy and kxz characterize the pools XY and XZ, then Mxy and Mxz in the two liquidity pools need to satisfy Equation 19. In particular, Equation 19 suggests that the liquidity value in the pool XY increases linearly with the value in the pool XZ, while it is a concave function of kxykxzqy$qz$.

2.4 Arbitrage equilibrium across multiple CFAMMs

Suppose now that X and Y are traded in two different CFAMMs with different types of constant functions. In one of them, the liquidity pool satisfies fxf,yf=xfyf=kf, while the liquidity pool in the other CFAMM satisfies gxg,yg=xg+yg=kg. As above, arbitrage leads to xf=Mf2qx$,yf=Mf2qy$ and kf=Mf24qx$qy$, and it is immediate to verify that arbitrage activity would lead to qx$qy$=1, xg+yg=Mgqy$=q=qx$ and, hence, to kg=Mgq. Therefore, it follows that for both CFAMMs to satisfy arbitrage, it must be that qx$qy$=1, which may take place only with specific assets, such as, for example, stablecoins. In this case, kf=(Mf2q)2 with xf=Mf2q=yf.

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 g constant function, arbitrage would impose equal asset market prices to all the other CFAMMs trading the same assets. Therefore, with the constant product function, this would imply that xf=yf in equilibrium, which, however, would not be a necessary condition for the constant sum function.

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, X,Y,Z. As we saw above, the three assets could be traded in three different pools, each composed of a pair of assets. In general, with n assets, if all of them are traded against each other, there would be (n2)=nn12 pairs which, for large n, is a large number.

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 XY pool are, respectively, xy=100 and yx=100, while in the pool XZ, the prices are xz=50 and zx=100. Then, assuming both pools adopt the constant product function, kxy=10,000 and kxz=5,000, so that the price of X in terms of Y is xyyx=1 in the first pool, and the price of X in terms of Z is xzzx=0.5 in the second pool. Suppose now that the available amount of X asset in the XY pool becomes xy=110 so that, because the 10 additional units are traded against Y, the volume of the other asset reduces to yx=90.9, keeping their product equal to 10,000. Therefore, a trade in the XY will only affect the price in that pool but not in another pool.

That is, in the XZ pool, the price would still be xzzx=0.5.

Suppose instead that the three assets are part of the same pool, XYZ, where any subset could be traded against the remaining assets. Assume the current liquidity level is xyz=100, yxz=100 and zxy=100. Furthermore, suppose we still have a constant product function

fx,y,z=xyz=100100100=1.000.000=kxyz(20)

and that now in Equation 20 the liquidity of X goes up to xyz=110, where the additional 10 units are traded against Y, which then decreases to yxz=90.9 to keep the product constant at 1,000,000. Therefore, now the updated liquidity volumes become xyz=110, yxz=90.9, and zxy=100.

However, compared to trading in pairwise separate and independent pools, now the trade between X and Y not only affects the price between them but also their prices with respect to Z. Indeed, while before the exchange, they were xyzzxy=1=yxzzxy; after the trade, they are xyzzxy=1.1 and yxzzxy=0.91. That is, the exchange between X and Y would induce an externality on the trading conditions between Z and the other two assets. In particular, now with 1 unit of Z, a user could obtain 1.1 units of X, that is 0.1 more than before, and 0.9 units of Y, namely, 0.1 units less than before, and the opposite for X and Y holders.

In principle, with n>1 different assets, the number of pools for trading assets that could be formed is 2nn+1, which is a potentially large number for large n. In the case that all, or many, of such pools would be formed, then arbitrage within the CFAMM would take place such that trading prices in each pool would equalize.

For example, suppose a CFAMM contains the pairwise pools XY,XZ,YZ and the pool XYZ, with the three of them. Moreover, suppose the four pools adopt the constant product function, with constants kxy,kxz,kyz,kxyz. Then, arbitrage would imply

xyzyxz=qyqx=xyyx;xyzzxy=qzqx=xzzx;yxzzxy=qzqy=yzzy.(21)

Therefore, it follows that the value $ of the three assets in the four pools expressed in $ would be the same. Equation 21 has multiple solutions, one of which would be given by the same quantity for each asset in the four pools; that is, xyz=xy=xz=x,yxz=yx=yz=y,zxy=zy=zx=z, which would imply that

x=kxyzkyz,y=kxyzkxz,z=kxyzkxy.(22)

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 3x,3y,3z would generate a pool that could perfectly scale up the four individual pools with liquidity x,y,z into a single pool three times as large.

We now extend the above considerations to CFAMMs with multiple assets. Suppose X1,..,Xn are n assets traded in a CFAMM and assume that

fx1,..,xn=k(23)

Equation 23 is the generic constant value function with fi=fx1,..,xnxi being the partial derivative with respect to xi, which we assume to exist. Therefore, if qi$ is the price of $ in terms of xi, then arbitrage implies

qi$qj$=fifjforallij.(24)

For example, taking

fx1,..,xf=i=1nxi=k,(25)

then fi=sinxs and fifj=xjxi. Finally,

M=i=1nqi$xi.(26)

Considering Equations 2426 and proceeding in analogy with the case of two assets, we obtain that

xi=Mnqi$(27)

and also that

i=1nMnqi$=Mnn1i=1nqi$=k28,(28)

which, for the benchmark case of qi$=q for all i=1,..,n, would lead to

k=Mqnn=xn,(29)

where x=xi, for all i.

In analogy to Equations 2729, it is immediate to verify that if

fx1,..,xf=i=1nxi=k,(30)

then qi$=q for all i and any non-negative profile x1==xn=x such that Equation 30 is satisfied as an AE and

x=Mnq=knk=Mq.(31)

where Equation 31 represents a simple linear relationship between k and M.

2.6 Some additional examples of CFAMMs

In the above examples with fx,y=xayb and fx,y=x+y, we saw that there exists a liquidity pool such that the arbitrage condition is satisfied. In what follows, we discuss some additional constant functions. Consider, for example, the following function:

fx,y=xa+yb=kwith0<a<b<1.(32)

Then, the arbitrage condition will lead to

qy$qx$=axa1byb1qy$byb1=qx$axa1,(33)

which implies

x+byb1axa1y=Mqx$(34)

and so

axa+byb=Mqx$axa1.(35)

In the simple case of a=b,

axa+ya=ak=Mqx$axa1(36)

then

x=Mkqx$11a,(37)

while

y=Mkqy$11a.(38)

Hence, based on Equations 3338, Equation 32 becomes Equation 39 below.

Mkqx$a1a+Mkqy$a1a=k.(39)

Moreover, consider a convex combination, with 0<a<1, of the two expressions used individually as constant functions:

fx,y=axy+1ax+y=k.40

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,

fx=ay+1a,fy=ax+1a,(41)

so that arbitrage implies

x+ax+1aay+1ay=Mqx$anday+1aax+1ax+y=Mqy$,(42)

Equations 4042 lead to

x=Max0,M2qx$1aqx$qy$2aqx$;y=Max0,M2qy$+1aqx$qy$2aqy$.(43)

Equation 43 suggests that qx$>qy$ implies x<y, while qx$<qy$ implies x>y. Finally, for qx$=q=qy$, then x=M2q=y; that is, not only the values but also the two assets’ quantities should be the same.

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 M as follows:

xqx$1τx+yqy$1τy=M,(44)

where 0<1τx, 1τy<1 are, respectively, the share of deposits x and y available after having paid transaction fees. That is, if liquidity providers deposit x,y, then what remains available in the pool is a share of them. Considering again the function fx,y=xayb: with transaction fees, it would become fx,y=x1τxay1τyb, and the AE solutions are given by

x=Maa+bqx$1τx=yaqy$1τybqx$1τx;y=Mba+bqy$1τy=xbqx$1τxaqy$1τy,(45)

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 k is given by

k=aqx$1τxabqy$1τybMa+ba+b.(46)

To summarise, Equations 4446 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.

CrossRef Full Text | Google Scholar

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.

Google Scholar

Angeris, G., Evans, A., and Chitra, T. (2020).When does the tail wag the dog? Curvature and market making, arXivpreprintarXiv:2012.08040.

Google Scholar

Angeris, G., Evans, A., and Chitra, T. (2021). Replicating market makers, arXivpreprint arXiv:2103.14769.

Google Scholar

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).

Google Scholar

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

CrossRef Full Text | Google Scholar

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.

CrossRef Full Text | Google Scholar

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

CrossRef Full Text | Google Scholar

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

CrossRef Full Text | Google Scholar

Fabi, M., Kassoul, M., and Prat, J. (2023). SOK: constant functions market makers. Paris: Blockchain Politechnique. Working Paper 2023-02-07.

Google Scholar

Fabi, M., and Prat, J. (2023). The economics of constant functions market makers. Blockchain Politechnique. Working Paper 2023-04-004.

Google Scholar

Milionis, J., Moallemi, C., Roughgarden, T., and Zhang, A. (2024a). Automated market making and loss-versus rebalancing, arXiv:2208.06046 [q-fin.MF].

Google Scholar

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

CrossRef Full Text | Google Scholar

Mohan, V. (2022). Automated market makers and decentralized exchanges: a DeFi primer. Financ. Innov. 8, 20. doi:10.1186/s40854-021-00314-5

CrossRef Full Text | Google Scholar

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

CrossRef Full Text | Google Scholar

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).

CrossRef Full Text | Google Scholar

Xu, J., Paruch, C., Cousaert, S., and Feng, J. (2023). SOK: decentralized exchanges (DEX) with automated market maker (AMM) protocols. ACM Comput. Surv. 55, 1–50. doi:10.1145/3570639

CrossRef Full Text | Google Scholar

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, Italy

Reviewed by:

Matteo Vaccargiu, University of Cagliari, Italy
Luca 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, ZGltaXRyaUB1bmlzaS5pdA==

Disclaimer: 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.