Skip to main content# When Does The Tail Wag The Dog? Curvature and Market Making

## Abstract

# 1. Introduction

#### Constant function market makers

#### CFMM agents and interactions

#### Price stability

#### Liquidity provider returns

#### Practical observations

#### Uninformed trading

#### Informed trading

#### Relative liquidity of CFMMs

#### Yield farming

#### Summary

# 2. Two asset market model

#### Price impact function

#### No-arbitrage

#### Price stability

#### Liquidity bounds

#### Trade sizes

## 2.1 CFMM Curvature

#### Constant function market makers

#### Marginal prices

#### Marginal prices with fees

#### Constant sum market maker

#### Global bounds on $\mu$ for convex impact

#### Local bounds on $\kappa$ for convex impact

#### Uniswap

#### Two asset Balancer

#### Two asset Curve

## Examples in practice

#### Uniformed trading

#### Curvature

# 3. LP returns and curvature

#### Liquidity provider portfolio value

## 3.1 Uninformed trading and low curvature CFMMs

#### Curvature and profits

#### Discussion

## 3.2 Informed trading

#### Problem setup

#### Informed trader edge.

#### Liquidity provider loss

#### Discussion

# 4. Price stability in general markets

## 4.1 Model description

#### Market model

#### Main goal

#### Assumptions

## 4.2 Stability and curvature

#### Main result

#### Proof of main result

#### Assumptions

#### Extensions

## 4.3 Yield farming subsidy

#### Sufficient subsidy

#### Vampire attacks

# 5. Conclusion and future work

#### Liquidity provider returns

#### Yield farming

#### Future work

# Acknowledgments

## Appendix

# 1. Form equivalence

# 2. Lower bounds for portfolio value with fees

#### Statement

#### Proof

# 3. Relationship between $g$ and curvature of $\psi$

Published onJun 13, 2022

When Does The Tail Wag The Dog? Curvature and Market Making

In this paper, we give a simple but very general definition of ‘price stability’ for a class of markets. This class of markets includes the popular constant function market makers (CFMMs) such as Uniswap, Curve, and Balancer, used extensively in decentralized finance (DeFi), which now have daily trading volumes in the billions of dollars. We show that our definition of price stability is deeply connected to the curvature of the trading function used in the CFMM, making the folk intuition that “flatter CFMMs are more price stable” more concrete. We also show that this definition gives sufficient conditions for the profitability of liquidity providers, and, similar to the classical market microstructure literature, gives bounds on the edge of informed traders and bounds on the losses of liquidity providers. We also show how these bounds help explain some of the behaviors observed in decentralized finance in the second half of 2020, including the rise of ‘yield farming’ and ‘vampire attacks.’

With the advent of Bitcoin and, later, smart contract platforms such as Ethereum, there has been a strong desire for automated censorship-resistant decentralized exchanges (DEXs). As blockchains provide a censorship-resistant means for executing programs in replicated state machines, many early DEX designs focused on emulating conventional market mechanisms. These early attempts implemented data structures from conventional markets, such as limit order books, in smart contracts. However, due to both computational and latency constraints, blockchains often end up being suboptimal for order books.

One solution to this problem is the family of constant function market makers (CFMM) [1], starting with Uniswap [2][3], which were invented as blockchain-native mechanisms for decentralized trading. CFMMs require constant space and time interactions, unlike limit order books which have $O(n)$ space and, in many practical applications, $O(n^2)$ time complexity to process $n$ trades. (There are some implementations achieving asymptotically better results in space, such as [4], but these designs are not, to our knowledge, used in practice.) Constant space and time requirements are ideal for blockchain environments where storage is expensive, as any data stored needs to be replicated and available at all consensus nodes, while compute can be costly for end users due to transaction fees.

CFMMs are a special type of market maker that mediates the interactions between two principal agents: liquidity providers (LPs) and traders. LPs provide capital to the CFMM by locking assets in a smart contract that implements the CFMM. LPs are then incentivized to not withdraw capital in order to earn trading fees from traders who trade against liquidity providers’ locked capital. This is implemented using the following mechanism: when a liquidity provider locks their assets into a CFMM smart contract, the smart contract creates LP shares and sends them back to the LP agent. These LP shares are tokens that are essentially vouchers for the cash flows of the CFMM—they can be redeemed at a future time for the LP’s share of the CFMM’s assets and a pro-rata share of fees. For instance, if an LP provides 10% of the liquidity to a pool, then upon redemption they receive 10% of the assets held in the pool, which includes the fees accrued by the pool during the time the LP remained invested.

In practice, highly liquid CFMMs appear to engender local price stability between pairs of reserve assets. Our basic definitions of price stability in Section 2 imply, roughly speaking, that price stability and liquidity are essentially consequences of the curvature of a CFMM’s trading function—with higher liquidity, measured as total asset value locked in the CFMM, implying lower curvature, which, in turn, implies higher price stability. Issuers of on-chain assets have then used this property to incentivize additional liquidity in low-curvature CFMMs in order to reduce volatility in the targeted assets.

A well-known example involves sUSD, a dollar-pegged ‘stablecoin’ issued through the Synthetix protocol [5]. While sUSD is intended to track the price of US $1, in practice it was quite volatile around this peg, making it less useful to users seeking a stable coin price. In response, in March 2020, Synthetix incentivized the creation of a low-curvature CFMM through Curve [6] that provided trading pairs between sUSD and other, more liquid, stablecoins. Shortly after the deployment of the CFMM, sUSD appeared significantly less volatile. Our framework provides a plausible explanation for this apparent price-stabilizing effect of low-curvature CFMMs, lasting until the summer of 2020. (We discuss the rise of ‘liquidity mining,’ also known as ‘yield farming,’ and its subsequent effects on prices and returns later in this section.)

A central question, answered in [1], is to determine the expected value or payoff of holding LP shares under the assumption of no-arbitrage. This payoff can be used to compare the returns that a CFMM liquidity provider earns to those of a market maker on a traditional exchange (*e.g.*, a limit order book). Unlike limit order books, CFMMs only offer market orders and have deterministic slippage costs. The deterministic nature of slippage in CFMMs often leads to a variety of front-running attacks and deadweight loss that miners and validators can capture at the expense of users [7]. However, this deterministic slippage also makes it easier for LPs to compute their expected payoff or expected loss.

Using some results from mathematical finance [8], it can be shown that Uniswap, the first CFMM to have over $100 million in digital assets, has LP shares that should be thought of as closer to a perpetual options underwriter than a spot trading venue [9]. Combined, these properties suggest that CFMM LPs own a combination of derivative securities on the underlying tokens. With CFMMs that can dynamically adjust, such as Balancer [10], one can arbitrarily tune the payoff function of these derivative securities by adjusting the shape of the CFMM pricing curve [11]. Given that these characteristics deviate from those of conventional spot financial exchanges, it is a natural to ask what happens when a CFMM is the dominant market for a pair of assets.

The intuition for why curvature affects actual market performance comes from empirical observations that CFMMs with lower curvature can increase LP profits for mean-reverting assets. Curve [6], which was designed for trading highly correlated assets by offering lower curvature, was able to attract US $1 billion in liquidity and reach US $350 million in daily trading volume because LPs were able to extract more fees than in Uniswap. On the other hand, Balancer provides an adjustable CFMM curve, whose curvature controls the amount of loss engendered by LPs when large price moves occur.

Using some basic results and definitions, we show in Section 3.1 that assets in which trades are mostly uninformed provide LPs with positive payoff whenever the curvature is low. These results also suggest that the curvature of a CFMM trading function controls how much rebalancing a given CFMM will perform. This provides a clear reason for why certain curves appear to be better in practice for mean-reverting assets (*e.g.*, Curve for stablecoin–stablecoin trades).

Next, we show that, in order for an LP to be profitable, the curvature of a CFMM should be large to account for the amount of information that an informed trader brings to the market. This result is an analogue of classical market microstructure results involving multiplayer games between informed traders and market makers [12][13][14]. Our formulation extends the informed trader framework for Uniswap of [15] to general CFMMs through a two-player game where the informed trader makes a maximum bet [16] on the next market price update given an informational advantage. Using the curvature framework of Section 2, we illustrate a condition (similar to Glosten’s classical bound [14]) that connects the informational edge of the informed trader and the curvature and fees of a CFMM to the payoffs of the informed trader and the LP. We extend this single period model to a multiperiod model and make conjectures about the optimal information flow in a CFMM in Appendix 10.

Prior work on CFMMs [1][3] has analyzed necessary and sufficient conditions for CFMMs to track an external reference market with infinite liquidity. This model allows one to answer the question of whether CFMMs can serve as price oracles; *e.g.*, difficult-to-manipulate on-chain price feeds that other smart contracts can use. However, the recent advent of incentivized CFMMs (referred to as “yield farming") has led to a number of hundred million dollar markets whose *reference* market is a CFMM with finite liquidity. In fact, Uniswap’s volume of US $440m on August 30, 2020 surpassed that of Coinbase Pro (US $380m), the largest US cryptocurrency market, making a number of markets significantly more liquid on CFMMs than on centralized order books [17][18] (*see* Figure 2). The natural next question to explore is: what happens when a CFMM becomes the *most liquid* market; , when the CFMM is more liquid than the external market?

In order to answer this question, we analyze how a CFMM market interacts with external markets that have finite liquidity. We extend our framework in Section 4 to include any external markets with finite liquidity, such as limit order books or other CFMMs. For instance, the secondary market could be Uniswap and the external market could be a Balancer pool with the same assets, or a centralized exchange, among many other possible combinations.

We also show lower bounds to so-called ‘yield farming’ payoffs that are sufficient to compensate LPs, based on the curvature difference between two markets. Yield farming can be seen as analogous to market-maker subsidies in conventional markets [19]. In yield farming, an LP first supplies reserves to a CFMM containing some token $T$ and a numéraire such as Ethereum (ETH). The LP then locks the corresponding LP shares they receive from the CFMM and receives newly-minted tokens of $T$ over time in return. By locking LP shares in the smart contract, users that provably provide liquidity for the $T$–ETH trading pair are subsidized. In practice, this incentive bootstraps liquidity for token $T$ by incentivizing users to be LPs [20]. We show that the sufficient monetary incentive for enticing LPs to contribute capital can be determined by the curvature of the CFMM.

These results show that curvature is a crucial parameter to tune when designing CFMMs. A number of CFMM designs have been proposed for prediction markets [21], derivatives trading [22][23], and self-balancing ETFs [10]. In each of these applications, a CFMM LP share represents a complex payoff function that changes dramatically based on the expected trading behavior of the assets held within the CFMM. Our results show that the returns and payoffs realized by holders of CFMM LP shares are intrinsically tied to the curvature of the trading function. Moreover, they explain a number of empirical outcomes that have happened throughout the large number of different CFMMs available on Ethereum. CFMM designers need to be cognizant of trade-offs that are made by adjusting curvature, especially as payoff functions become increasingly complex. These results also provide guidance on how to parameterize yield farming incentives to achieve certain liquidity targets. As a number of yield farming assets have failed due to over-incentivization of liquidity [24][25], it is increasingly important to understand how to efficiently incentivize on-chain liquidity. These results provide ways to sensibly optimize incentives to meet liquidity goals.

In this section, we define basic terms and models used throughout the remainder of the paper. In particular, we will define what it means for a market to be ‘stable’ or ‘liquid.’ We note that, while some markets in practice can simultaneously trade $n$ coins for $n$ coins, we will focus on the case where the market only trades two coins, and this is the model we will use in the majority of the paper. (We will sometimes present the $n$ coin generalizations, as in, *e.g.*, Appendix 5 and Appendix 8, when they are simple, but this is the exception rather than the rule.) In this case, we will call one asset the *traded coin*, and this asset is distinct from the *numéraire*, which is the base currency used to measure prices. Unless otherwise specified, all trades (which we will often simply call $\Delta$) are positive when they are buying $\Delta$ amount of the traded asset, and negative when they are selling it.

We will define the *price impact* function $g: \reals \to \reals_{++}$ of a market to be the function that connects the market’s marginal price before the trade, which we will call $m_0$, to the price after the trade. More specifically, we have that $g(0) = m_0$, while $g(-\Delta)$ specifies the CFMM’s marginal price immediately after the trade, which sells $\Delta$ of the traded coin to the market, is performed.

We assume two basic facts about $g$: one, that $g$ is continuous, and, two, that $g$ is nondecreasing. In other words, $g$ is a continuous function that expresses how the market’s price changes after a given trade, with the assumption that trades of size 0 (*e.g.*, null trades) don’t change the market price, and that larger trades lead to higher marginal prices. Note that these assumptions are common in the order-book literature (*see*, *e.g.*, [26]) and true for all CFMMs (*see*, *e.g.*, [1]). Additionally, this assumption is equivalent to the convexity of the quantity function $q(\Delta) = \int_0^\Delta g(t)\,dt$, which is also a common assumption in the classical literature (*see* [27]).

A common way to model interactions between different markets is the assumption of no-arbitrage. One way of stating this assumption is through the existence of an agent, called an *arbitrageur*. This agent is allowed to borrow any amount of coin $\Delta$, trade it between the available markets (to receive some amount of coin, say, $\Delta^a$), and then pay back the borrowed amount $\Delta$, to receive $\Delta^a - \Delta$ profit. If there exists a trade which guarantees that $\Delta^a > \Delta$, we then say that there is an *arbitrage opportunity* which we assume the arbitrageur will execute to receive strictly positive profit.

In our presentation, we will assume that there is an (infinitely-liquid or frictionless) reference market with fixed price $m_a$. (We provide a generalization to reference markets which do not have infinite liquidity in Section 4.) An arbitrageur would then attempt to maximize its profits by trading some amount of coin $\Delta$ between both markets, which would give a total payoff of

$\int_{0}^\Delta (m_a - g(-t))\,dt.$

A necessary condition for this quantity to be maximized is that the marginal price of both markets after the no-arbitrage trade, which we will call $\Delta^\star$, must be equal; *i.e.*, that $\Delta^\star$ must satisfy

$%\label{eq:noarb_condition}
m_a = g(-\Delta^\star),$(1)

which follows from the first-order optimality conditions applied to the arbitrageur’s payoff.

Without loss of generality, we will assume that $m_a \le m_0 = g(0)$. Note that this is always possible in a two-coin economy by changing the choice of the coins to be traded; *i.e.*, by swapping the places of the traded coin and the numéraire, the resulting market prices are $1/m_a \le 1/m_0$, which satisfy the above inequality. Because of this assumption and the fact that $g$ is a nondecreasing function, we will have that $\Delta^\star \ge 0$. (We discuss this assumption further in the case where the market is not infinitely liquid in Section 4.1).

We will say that the price impact function $g$ is $\mu$-*stable* (with $\mu \ge 0$) if it satisfies:

$%\label{eq:mu-stability}
g(0) - g(-\Delta) \le \mu \Delta.$(2)

In other words, we say that the price impact function $g$ for some market is $\mu$-stable whenever a (nonnegative) trade of size $\Delta$ does not change the market’s price by more than $\mu\Delta$. Because $g$ is increasing by assumption, when $\Delta \ge 0$, Inequality 2 is equivalent to the sensitivity-like bounds,

$|g(0) - g(-\Delta)| \le \mu \Delta,$

as both sides are nonnegative.

There are several useful sufficient conditions for Inequality 2 to hold. For example, it suffices that its first derivative is bounded from above by $\mu$ for all $\Delta \ge 0$; ,

$\frac{\partial g(-\Delta)}{\partial \Delta} \le \mu,$

but this is not a necessary condition, as the function $g$ need not be differentiable in its second argument. We show a connection between this sufficient condition and the curvature of a trading function for a given CFMM in Appendix 3; we also discuss explicit bounds for $\mu$ for some CFMMs used in practice, and how they relate to common intuition, in the following section.

We will say that a price impact function for a market is $\kappa$-*liquid* if it satisfies

$%\label{eq:k-liquidity}
g(0) - g(-\Delta) \ge \kappa \Delta.$(3)

In other words, selling $\Delta$ coin to the market decreases the reported price by at least $\kappa\Delta$, which implies that there is some amount of price slippage that is linearly bounded from below by a factor of at least $\kappa$. Additionally, we note that it is possible (and, in fact, common for many markets) that a trading function is both $\mu$-stable and $\kappa$-liquid. In this case, we will always have $\kappa \le \mu$.

It is often the case that bounds of the form of Inequality 3 (and, sometimes, bounds of the form of Inequality 2, as we will see later in this section) are not global, but, instead, hold over some interval of size $L$; , such bounds only hold for trades $\Delta$ which satisfy $0 \le \Delta \le L$. In these specific cases, we will mention the corresponding conditions in the statements, as required for the results to hold for CFMMs in practice. On the other hand, we note that all of the proofs presented have results which immediately carry over in this case, even when the interval is not explicitly mentioned. (We leave such extensions as simple exercises for the reader.)

In decentralized finance, the market we are studying is almost always a *constant function market maker* or CFMM (*see*, *e.g.*, [1] for an introduction). In this case, the market’s behavior is specified by an (often simple) mathematical formula, and often has closed-form solutions for the constants $\mu$ and $\kappa$. In this section, we will give a brief introduction to CFMMs and the notation used throughout this paper, and show how to compute some values of $\mu$ and $\kappa$ for CFMMs used in practice.

A CFMM is an algorithmic market maker [28][29][30] defined by its reserves, specifying how much of each coin is available for trading, and its trading function, which controls whether the market maker will accept or reject a proposed trade. The *reserves* are given by $R \in \reals_+$ for the coin to be traded, and $R' \in \reals_+$ for the numéraire coin, while its *trading function* is given by $\psi: \reals_+^2\times \reals^2 \to \reals$. The trading function maps the pair of reserves $(R, R') \in \reals_+^2$ and a trade, purchasing $\Delta$ of the coin to be traded and $\Delta'$ of the numéraire, $(\Delta, \Delta') \in \reals^2$, to a scalar value.

When a CFMM has reserves $(R, R')$, any agent may propose a trade $(\Delta, \Delta')$. By definition, the CFMM accepts the trade whenever

$\psi(R, R', \Delta, \Delta') = \psi(R, R', 0, 0).$

The CFMM then pays out $\Delta$ of the traded coin to the trader and receives $\Delta'$ of the numéraire. This results in the following update to the reserves: $R \gets R - \Delta$ and $R' \gets R' + \Delta'$. (Negative values of $\Delta$ and $\Delta'$ reverse the flow of the coin.)

For notational convenience, we will abuse notation slightly by writing $\psi(\Delta, \Delta')$ for $\psi(R, R', \Delta, \Delta')$, such that the function $\psi(\cdot, \cdot)$ implicitly depends on the reserve values $(R, R')$ in the remainder of the paper. Additionally, because our focus is on the two coin case and not the general $n$ coin case, we use different notation than [1] to prevent overly-cumbersome proofs and results. We show the exact connection between both forms in Appendix 1.

Given a CFMM with trading function $\psi$, the marginal price at these reserves is given by [1]:

$%\label{eq:g_def}
g(\Delta) = -\frac{\partial_1\psi(\Delta, \Delta')}{\partial_2\psi(\Delta, \Delta')},$(4)

where $\partial_i\psi$ denotes the partial derivative of $\psi$ with respect to the $i$th argument and $\Delta'\in \reals$ is the (usually unique) solution to

$\psi(\Delta, \Delta') = \psi(0, 0),$

for a given $\Delta \in \reals$. Note that this is only defined whenever $\Delta \le R$ and $\Delta' \ge -R'$; *i.e.*, when there are enough reserves to complete the trade. Because it is often the case that $\psi$ satisfies the condition $\Delta' = \int_0^\Delta g(t)\,dt \le R'$, even as $\Delta \downarrow-\infty$, we will consider these bounds to be implicit, unless otherwise stated.

While it is possible to implicitly include fees in the definition of the CFMM’s trading function, it is often simpler to include the fee explicitly. In many cases such as Uniswap, Balancer, and Curve, the fee is given by some number $0 < \gamma \le 1$ such that $(1-\gamma)$ is the percentage fee taken for each trade, and the fee-less CFMM, with trading function $\psi$, is modified in the following way [1]:

$\psi^f(\Delta, \Delta') = \psi(\gamma\Delta, \Delta') = \psi(0, 0),$

where $\psi^f$ is the CFMM trading function with fees, for trades which sell some amount of coin $\Delta \le 0$ to the CFMM. The reserves are updated in a similar way as the original CFMM. We note that the case where $\Delta \ge 0$ can be derived by appropriately exchanging the traded coin and the numéraire. The directionality here comes from the fact that fees are usually charged ‘on the way in,’ or, in other words, asymmetrically charged to the coin being sold to the CFMM (*see*, *e.g.*, Appendix 1).

In this case, we can write the marginal price of a given trade of size $\Delta \le 0$ after fees in terms of the marginal price of the original CFMM, since

$g^f(\Delta) = -\frac{\partial_1\psi^f(\Delta, \Delta')}{\partial_2\psi^f(\Delta, \Delta')} = -\frac{\partial_1\psi(\gamma\Delta, \Delta')}{\partial_2\psi(\gamma\Delta, \Delta')} = \gamma g(\gamma \Delta),$

where $\Delta'$ is the (usually unique) solution to $\psi(\gamma\Delta, \Delta') = \psi(0, 0)$, and, as before, $\Delta \le 0$; , we are selling the coin to be traded to the CFMM.

Given that we can express the price impact function $g^f$ with fees in term of the fee-less price impact function $g$, the next problem is to find bounds of the form of Inequality 2 for fee-less CFMMs, which we show for a few special cases.

The simplest example of a CFMM is the constant sum market maker, whose trading function is the *constant sum* trading function:

$\psi(\Delta, \Delta') = (R-\Delta) + (R'+\Delta').$

In this case, the marginal price is, from Equation 4:

$g(\Delta) = 1,$

whenever $-R' \le \Delta \le R$ and is otherwise undefined. We then have the following bound, whenever $0 \le \Delta \le R'$:

$g(0) - g(-\Delta) = 0 \le \mu \Delta,$

with curvature bound $\mu = 0$. (This is simply due to the fact that a constant sum market maker always reports a fixed price, so long as it has nonzero reserves.) Similarly, we also have $\kappa = 0$, on the same interval, by the same argument.

While the constant sum market maker has a simple enough trading function that it can be analyzed directly, analyzing other trading functions in the same way can quickly lead to very complicated results. A useful and simple condition applies in the common case that the price impact function, $g$, is a differentiable convex function. In this case, we have that, for all valid $\Delta$,

$g(-\Delta) \ge g(0) - g'(0)\Delta,$

where $g'(0)$ is the derivative of $g$ evaluated at zero, by the first-order condition for convexity [31]. This can be written as

$%\label{eq:convex-bounds}
g(0) - g(-\Delta) \le g'(0)\Delta.$(5)

Setting $\mu = g'(0)$ yields the desired result. When $g$ is differentiable, taking the limit as $\Delta \downarrow 0$, shows that this is the tightest possible bound on $\mu$ over any nonzero interval size. (If $g$ is not differentiable, we can take $\mu$ to be the largest subgradient of $g$ at $0$, which is the tightest possible bound by the same argument.)

On the other hand, given any interval of size $L \ge 0$, we can give a $\kappa$-liquidity bound for $g$, by noting that, because $g$ is convex, the definition of convexity gives the following inequality:

$g(-\Delta) = g\left(\left(1-\frac{\Delta}{L}\right)0 + \frac{\Delta}{L}(-L)\right) \le \left(1-\frac{\Delta}{L}\right)g(0) + \frac{\Delta}{L}g(-L).$

A basic rearrangement shows:

$g(0) - g(-\Delta) \ge \left(\frac{g(0) - g(-L)}{L}\right)\Delta,$

and setting $\kappa = (g(0) - g(-L))/L$ gives the result. Since the bound is tight at $\Delta = 0$ and $\Delta = L$, this $\kappa$ yields the tightest possible bound along this interval.

One of the simplest nontrivial convex bounds is the bound for Uniswap (or constant product market maker) with no fees, where we can write

$%\label{eq:uniswap-marginal}
g(\Delta) = \frac{k}{(R - \Delta)^2},$(6)

and $k = RR'$ is the product constant [3].

If $R > \Delta$ (, there are enough reserves to carry out a trade of size $\Delta$) this function is a convex function, as $x \mapsto 1/x^2$ is convex over the positive reals. Using Inequality 5, we have, for all $\Delta \ge 0$,

$g(0) - g(-\Delta) \le 2\frac{k}{R^3}\Delta = 2\frac{g(0)}{R}\Delta = \mu\Delta.$

In the special case where the marginal price at the zero trade is $g(0) = 1$ (as is common with stablecoin–stablecoin markets), which happens when $R = R'$, we can re-write $\mu$ in terms of the portfolio value of the reserves as

$\mu = \frac{4}{P_V},$

where the portfolio value is given by $P_V=g(0)R + R' = 2R$.

Similarly, for any interval size $L \ge 0$, we have

$\kappa = \frac{k}{L}\left(\frac{1}{R^2} - \frac{1}{(R+L)^2}\right) = \frac{g(0)}{L}\left(1 -\frac{1}{(1 + L/R)^2}\right).$

Note that both $\mu$ and $\kappa$ both decrease when $R$ increases as liquidity is added (*e.g.*, via Uniswap’s `addLiquidity`

function) for a fixed price $g(0)$ and interval size $L$. In other words, Uniswap’s effective curvature *decreases* as the reserves increase, as one might intuitively expect. We can interpret this as, for a fixed trade cost, larger trades can take place in Uniswap with higher reserves. An alternative interpretation is that the cost of manipulation also increases in the reserve size $R$. These results were proven in [3] using different techniques which do not easily generalize to other CFMMs.

For Balancer (which is also sometimes called the constant mean market maker [3], or the geometric mean market maker [11]) with two assets and weight $\tau \in (0, 1)$, we have the trading function

$\psi(\Delta, \Delta') = (R - \Delta)^{\tau}(R' + \Delta')^{1-\tau}.$

Let $\xi = \frac{\tau}{1-\tau}$ for notational convenience, then:

$g(\Delta) = \frac{d \Delta'}{d\Delta} = \left(\frac{\tau}{1-\tau}\right) \frac{k^{1/(1-\tau)}}{(R-\Delta)^{1 + \tau/(1-\tau)}} = \frac{\xi k^{\xi/\tau}}{(R-\Delta)^{1+\xi}}.$

Note that when $\tau=\frac{1}{2}$ then $\xi = 1$ and this price impact function is equal to Uniswap’s, generalizing Result 6. This function is convex since $x \mapsto x^{-(1+\xi)}$ is convex over the positive reals for any $\xi > -1$. This implies

$g(0)-g(-\Delta) \leq \xi(1+\xi)\frac{ k^{\xi/\tau}}{R^{2+\xi}}\Delta = (1+\xi)\frac{g(0)}{R}\Delta = \mu\Delta.$

As with Uniswap, we can derive a simple expression for $\mu$ in terms of the portfolio value in the special case where $g(0) = 1$:

$\mu=\frac{1}{\tau (1-\tau) P_V}$

where the portfolio value is given by $P_V = g(0)R + R' = R/\tau$. (Note that the expression for $\mu$ is symmetric about $\tau=1/2$, even though the portfolio value $P_V$ is not.)

Similarly, for any interval of size $L$, we have that

$\kappa = \frac{\xi k^{\xi/\tau}}{L}\left(\frac{1}{R^{1+\xi}} - \frac{1}{(R+L)^{1+\xi}}\right) = \frac{g(0)}{L}\left(1 - \frac{1}{(1 + L/R)^{1+\xi}}\right)$

As before, we have that both $\mu$ and $\kappa$ are decreasing functions in the reserves $R$ for a fixed marginal price $g(0)$ and interval length $L$. We can additionally recover the Uniswap bounds on $\kappa$ and $\mu$ by setting $\tau = 1/2$, or, equivalently, $\xi = 1$.

Another very popular CFMM is Curve [32], with trading function

$\psi(\Delta, \Delta') = \alpha ((R - \Delta) + (R'+\Delta')) - \beta ((R-\Delta)(R'+\Delta'))^{-1}.$

It is worth noting that, as $\alpha/\beta$ becomes large, then $\psi$ is approximately close to the trading function for the constant sum market maker. Similarly, as $\alpha/\beta$ becomes small, $\psi$ becomes similar to the Uniswap trading function (*see*, *e.g.*, Figure 3, which shows that $\mu$ for Curve converges to the curvature constants for constant sum as $\beta \downarrow 0$ and Uniswap as $\beta \uparrow\infty$). One can imagine variations on Curve where the product term is replaced by the reciprocal of the weighted geometric mean, as with Balancer, or a number of other functions.

The marginal price function for Curve is relatively complicated, but can be derived with some work (*see* [1]):

$g(\Delta) = \frac{\alpha(R - \Delta)(R' + \Delta') + \beta(R - \Delta)}{\alpha(R - \Delta)(R' + \Delta') + \beta (R' + \Delta')},$

where

$\Delta' = R' + \frac{1}{2\alpha}\left(\sqrt{(\alpha(R -\Delta) - k)^2 - 4\alpha\beta (R - \Delta)^{-1}} - (\alpha(R - \Delta) -k) \right),$

and we have defined $k= \psi(0, 0) = \alpha(R + R') - \beta (RR')^{-1}$ for notational convenience. From Figure 4 we see that $g$ is indeed convex for a number of parameters $\beta$ (setting $\alpha = 1$ without loss of generality, as $g$ is homogeneous of degree zero with respect to $(\alpha, \beta)$). Proving that $g$ is convex is rather more involved; we provide a proof in Appendix 4.

While, in general, $\mu=g'(0)$ can yield complicated expressions for Curve, the special case where $g(0)=1$, which often holds approximately in practice, can be written as a simple function of the portfolio value:

$\mu = \frac{32\beta}{8\beta P_V+ \alpha P_V^4},$

where $P_V = g(0)R + R' = 2R$. This provides a simple expression for the maximum slippage a trader can expect for a given trade size when assets on Curve are trading at their peg.

One of the simplest examples of curvature impacting trading performance is in stablecoin trading venues. Stablecoins, which are assets that aim to be approximately pegged to a fiat numéraire such as the US dollar, are assets with an approximately constant price due to their peg. However, their prices and outstanding supply often differ for systematic reasons. For instance, one type of asset might only be centralized and only allowed to be created by non-US entities (*e.g.*, Tether), whereas another asset is more decentralized (*e.g.*, MakerDAO). The former stablecoin might have a small number of large institutions using the coin whereas the latter is likely to have more small participants. If this is the case, it will naturally be easier to perform bigger trades in the former currency. A CFMM designed for stablecoin–stablecoin trading, such as Curve, needs to have curvature that is adapted for these types of trading.

Generally speaking, the trading of stablecoins for stablecoins tends to be uninformed. That is, users often trade these stablecoin pairs because a specific smart contract or exchange that they want to interact with only allows the use of a particular stablecoin. There is no information about the direction of trading and, given the ease of creation-redemption arbitrage for stablecoins, there is little use in trying to predict stablecoin prices [33][34].

Intuitively, then, venues for stablecoin–stablecoin trades should have relatively low-curvature trading functions, which would entice traders due to the small price slippage, and entice liquidity providers due to the small opportunity cost. Taking this idea to its extreme, one might argue that assets that are supposed to be the same value should be traded on a CFMM with zero curvature. An example of such a market is mStable, which uses the constant sum trading function presented in Section 2.1. These curvature-less markets have trouble responding to price, as they effectively quote a fixed price for any trade performed. In practice, as illustrated in Figure 7, we see that Curve generates almost an order of magnitude more in trading fees for LPs than mStable. This is driven by two phenomena. First, a zero-curvature AMM will end up less liquid in practice because it quickly runs out of reserves as price fluctuates. In the case of mStable, there is a chronic shortage of Dai for trades as Dai is frequently trading above its peg [35][36]. Second, LPs face maximal opportunity cost relative to a low-curvature CFMM with the same assets and fees. Most of the trading volume and liquidity provision on mStable appears instead to be driven by *yield farming*. We discuss such incentives in more detail later in Section 4.3.

Empirically, it has been observed that returns to LPs in CFMMs are closely tied to both the shape of the CFMM trading curve and the properties of the price process of the two assets. Curve’s advantage over Uniswap for mean-reverting, low volatility assets led to it attracting significantly more trading volume for certain assets. As shown in Section 2.1, Curve has a low curvature regime around a particular price and a high curvature region far away from this price. This design was chosen to optimize profits earned by LPs for mean reverting assets while allowing traders to place large orders when assets are near their mean. A natural question to ask is: how much does adjusting the curvature of a CFMM for such assets affect LP returns?

The LP portfolio value is defined as the value of coins that an LP has locked in a CFMM. If a user owns a fraction $b \in [0,1]$ of the LP shares in a CFMM, then they own the right to claim $bR$ of asset 1 and $bR'$ of asset 2, where $R$ and $R'$ are, as before, the reserves of the CFMM. In this subsection, we will formalize the heuristic arguments of [32][37] which show that LP portfolio values are directly affected by the curvature of a trading function. We will also generalize these claims to generic price processes interacting with CFMMs by considering adverse selection towards LPs. In particular, we will consider how LP returns are affected by *informed traders*, who have an estimate for the probability distribution of future prices. These results will illustrate that the design of efficient CFMMs for a variety of markets depends on how the curvature is adjusted to ensure that LPs can be profitable. In particular, we will see that, for stablecoins, where most trades are uninformed, low curvature improves performance and LPs still come out with positive profit even for large trades, while markets where there exist informed traders with a bigger edge, higher curvature is preferable to prevent LP losses.

In this scenario, we consider a trader who wishes to buy some amount of coin $\Delta \ge 0$ from the market. Such purchases will cause some amount of slippage in the reported price $g$, causing some loss to the LP, which may be recouped with fees. The question is, assuming that this CFMM is the only available market, what is the largest trade that a trader can perform such that a liquidity provider still has positive payoff from the trade?

Formally, suppose that an LP provides all of the assets $R, R' \in \reals_+$ to a CFMM with $\mu$-stable price impact function $g$. We assume that the CFMM charges some fee $(1-\gamma)$, but this fee is not included in $g$. The no-fee portfolio value of this CFMM is:

$g(0)R + R'.$

After a price change to $m_a = g(-\Delta) \le g(0)$, the opportunity cost (sometimes called the ‘impermanent loss’) of this portfolio is given by

$\underbrace{(g(-\Delta)(R + \Delta) + R'- \Delta')}_\text{LP portfolio value} - \underbrace{(g(-\Delta)R + R')}_\text{Equivalent portfolio value} = g(-\Delta)\Delta - \Delta',$

and, by definition of marginal price

$\Delta' = \int_0^{-\Delta} g(t)\,dt.$

Since $g$ is a nonincreasing function, we have

$\Delta' = \int_0^{-\Delta} g(t)\,dt \le g(0)\Delta,$

so,

$g(-\Delta) \Delta - \Delta' \ge (g(-\Delta) - g(0))\Delta \ge -\mu \Delta^2,$

is a lower bound on the opportunity cost. Here, the second inequality follows from the definition of $\mu$-stability.

On the other hand, if $g$ is a marginal price function with some fee $0 < \gamma \le 1$, the value of fees earned is at least $(1-\gamma)\Delta g(-\Delta) = (1-\gamma)\Delta m_a$, where $m_a$ is the new price (*see* Appendix 2 for a general statement and proof), so LPs are guaranteed to make a profit whenever

$(1-\gamma)\Delta m_a > \mu\Delta^2,$

which happens when

$%\label{eq:trade-bound}
\Delta < \frac{(1-\gamma)m_a}{\mu}.$(7)

This inequality shows that a sufficient condition on the trade size for which LPs still make a profit is inversely proportional to the curvature bound on the CFMM. Additionally, using this formula, we can compute a lower bound on the rate of growth of profits for LPs as a function of fees and curvature, given a distribution of trades, $\mathbb{P}[\Delta \leq x]$. An extension of this result can provide a discrete time, curvature-based analogue of [38] that generalizes to a number of CFMMs other than Uniswap.

Another interpretation of Inequality 7 is that, as the effective curvature decreases, traders can perform large trades, while liquidity providers still come out ahead, relative to an equivalent portfolio which simply holds $R$ of the traded coin and $R'$ of the numéraire. Note that this inequality comes from the fact that the trade does not depend on the future price of the coin, which we will call an ‘uninformed’ trade, and such trades are, as discussed previously, very common in stablecoin–stablecoin pairs.

On the other hand, liquidity provider losses change drastically when we have an agent who attempts to maximize their profits given information about future prices. In order to model this phenomenon, we need to describe a participant other than the LP, who has some amount of knowledge of future prices. Analogous to [15] and the classical market microstructure models [13][12], we will consider a market with an LP and an informed trader under the assumption of no-arbitrage. We will construct a two-player game between an informed trader who can predict the next price update of some external market with non-trivial edge, and a liquidity provider whose funds are locked in the CFMM. Using this game, we will show a profit (or loss) lower bound for both LPs and informed traders, akin to those used to describe market maker profits in open limit order books [14][13]. From this lower bound, we will show that informed traders need less of an informational edge to guarantee that trading with a lower curvature CFMM has profits as large as trading with a higher curvature CFMM.

In this game, we have two agents: a liquidity provider and an informed trader, where the informed trader is allowed to trade with the CFMM, while the liquidity provider has its assets locked in the reserves of the CFMM.

We will assume that the CFMM, with fee-less marginal price function $g$ (such that the marginal price with fees is $g^f(-\Delta) = \gamma g(-\gamma \Delta)$ with $\Delta \ge 0$) and the reference market both start at some fixed price $m_0 = \gamma g(0)$. We will also assume the function $g$ is $\mu$-stable and $\kappa$-liquid in some interval $0 \le \Delta \le L$. The informed trader then knows that the reference market price will decrease to some amount $m_1 \le m_0$ with probability $\alpha$ or stay at $m_0$ with probability $(1-\alpha)$. By no-arbitrage, any price discrepancies between the CFMM and the reference market are immediately removed, so the informed trader must make a trade which maximizes the expected profit, before the trader is able to see the new price.

The expected edge of an informed trader under this framework is given by

$E_V(\Delta) = \underbrace{\int_0^{\Delta} \gamma g(-\gamma t) \,dt}_\text{total profit for trading $\Delta$} - \underbrace{(\alpha m_1\Delta + (1-\alpha)m_0\Delta)}_\text{expected profit for holding $\Delta$ asset}.$

We can rewrite this in a slightly simpler form by noting that, by assumption, $m_0 = \gamma g(0)$, so

$E_V(\Delta) = \gamma\int_0^{\Delta} (g(-\gamma t) - g(0))\,dt + \alpha(m_0 - m_1)\Delta.$

Using the fact that $g$ is $\mu$-stable, we have $g(-\gamma t) - g(0) \ge -\mu\gamma t$, and that

$E_V(\Delta) \ge \alpha(m_0 - m_1)\Delta - \frac12 \mu\gamma^2\Delta^2.$

Taking the supremum of both sides over $\Delta \ge 0$ (since an informed traders seek to maximize their profit) gives that

$E_V^\star \ge \frac{\alpha^2(m_0 - m_1)^2}{2\mu\gamma^2}.$

Here, the surprising fact that the fee $\gamma$ appears in the denominator (versus, as one might expect, in the numerator) happens because the price $m_0 = \gamma g(0)$ depends implicitly on the fee. This result holds independent of the interval size $L$ if $g$ is $\mu$-stable for all $\Delta \ge 0$. Note that, if $\mu$ is very small (*i.e.*, the CFMM has low curvature) then $E_V^\star$ is large; similarly, given two CFMMs, one with lower and one with higher curvature, $\alpha$, the edge, needs to be larger in the CFMM with higher curvature to achieve the same lower bound for the payoff.

We can similarly get a lower bound on the expected loss of an LP since it is equal to $-E_V(\Delta)$:

$-E_V(\Delta) = \gamma\int_0^{\Delta} (g(0) - g(-\gamma t))\,dt - \alpha(m_0 - m_1)\Delta,$

but, if $\Delta \le L$, we have that $g(0) - g(-\gamma t) \ge \gamma \kappa t$, and so

$-E_V(\Delta) \ge \frac12 \kappa\gamma^2 \Delta^2 - \alpha(m_0 - m_1)\Delta.$

Minimizing both sides gives

$%\label{eq:adverse}
-E_V^\star \ge -\frac{\alpha^2(m_0 - m_1)^2}{2\kappa \gamma^2}$(8)

whenever $\alpha(m_0 - m_1) \le L\kappa \gamma^2$ (*i.e.*, when the unconstrained minimum lies in the interior of the interval $[0, L]$) and is otherwise bounded by $-E^\star_V \ge \kappa\gamma^2 L^2/2 - \alpha(m_0 - m_1)L$. We will mostly consider the first case in the following discussion, since we can often expand the interval $L$ to be large enough to contain this bound. (Note also that Equation 8 is equivalent to giving an upper bound on the expected value of an informed trader.)

This matches the empirical observation that lower curvature CFMMs tend to have higher liquidity for assets that do not require much information to trade whereas LPs of higher-curvature CFMMs lose less to informed traders. This result illustrates that unlike common wisdom in the CFMM design space, one need not only have an optimal fee to maximize LP returns, but one needs to adjust the curvature as well.

Moreover, this result represents an analogue of classical microstructure results that show that the shape of an order book gives bounds on adverse selection. Glosten [14] showed that when one considers market makers who have to quote prices on multiple markets, then the shape of the order book impacts how liquidity changes in response to adverse selection. In Figure 8, we see two different shapes for an order book, one approximately concave (the unshaded bars) and one convex (the filled in region). When a market maker observes or realizes adverse selection costs, they make a market more illiquid (*e.g.*, by canceling orders) to force active traders to pay a higher impact cost to market makers. This leads to the higher curvature, concave shape seen in Figure 8. Equation 8 then suggests that market makers in CFMMs can replicate the same effect by increasing the curvature, therefore increasing the curvature lower bound, $\kappa$.

In this section, we will describe price stability when arbitrageurs trade between two markets, each with different curvature bounds; , when both markets have finite liquidity. This stability result provides a quantitative explanation for the stability phenomenon of Figure 1. Given that the empirically observed sUSD price instability was due to liquidity incentives (yield farming), it is natural to expect that there is a relationship between curvature and the precise costs of a stability incentive. In other words, the question we seek to answer is: how much do we need to pay LPs for providing liquidity? We describe this connection precisely in Section 4.3, which shows that there is an optimal liquidity subsidy for a CFMM that interacts with an external market with different curvature.

Here, we will define the market model used throughout the remainder of this section. In our model, we have two available markets: the external market (whose price fluctuates due to extrinsic demand) and the secondary market (which we will assume is a CFMM, though the model holds more generally), along with an arbitrageur agent which seeks to maximize their profit by exploiting the difference in price between these two markets.

We describe a relatively simple, but very general, model of the *external market* and how it interacts with the given CFMM. In particular, the external market reports some strictly positive price $m_0 \in \reals_{++}$ at the start of the round. The basic model of interactions between the markets and the arbitrageur proceeds as follows:

At the round start, the quoted external market price is $m_0^e$, while the secondary market price is $m_0^s$.

An arbitrageur then trades with the external market and the secondary market (which will usually be a CFMM). This results in a new external

*and*secondary market price $m_a$ which are equal since no-arbitrage has been enforced.The external market price then changes from the no-arbitrage price $m_a$ to a new price by some process modeling external influences. Step 1 is repeated with the new external and secondary market prices.

In fact, in our presentation, we will not assume anything about the dependence of the new price on $m_a$ or even on $m_0^e$ or $m_0^s$, which means that the results here hold for essentially all (reasonable) models of exogenous price changes for the external market price.

We will show that, even when the external market price $m_0^e$ differs widely from the secondary market price $m_0^s$, the (new) arbitraged market price $m_a$ does not differ too much from the previous secondary market price $m_0^s$. Written out, we wish to find conditions such that, even when the price difference between both markets before no-arbitrage, $m_0^e - m_0^s$, is large, the difference between the no-arbitrage price and the secondary market’s price $m_a - m_0^s$ is small, in a precise sense. This would imply that even though the external market price deviates from the secondary market price $m_0^e - m_0^s$, the secondary market is able to force the new no-arbitrage price, $m_a$, back to a price that was close to its previous value, $m_0^s$.

In this set up, the external market will have a price impact function $f$ which is, as before, continuous and nondecreasing. We will define the initial price of the external market as $m_0^e = f(0)$. Additionally, we will assume the external market is $\kappa$-liquid, with a slightly different definition than the one given in Section 2.1: we will say an external market is $\kappa$-liquid if it satisfies, for $\Delta \ge 0$,

$f(\Delta) - f(0) \ge \kappa \Delta.$

This differs from the original definition given in Section 2.1 because, here, $\Delta$ is the amount *purchased* from the external market, rather than the amount sold to it. In this case, if $f$ is a differentiable convex function, we have that $\kappa = f'(0)$ is the tightest possible constant $\kappa$ satisfying this condition and is a global bound (holding for all $\Delta \ge 0$) which follows immediately from the first-order convexity conditions.

As before, we will simply assume that the secondary market, with continuous, nondecreasing price impact function $g$, is $\mu$-stable with the usual definition given in Section 2.1. We will similarly define $m_0^s = g(0)$.

In this section, we derive the main result for general, continuous price impact functions, satisfying the conditions outlined previously.

Assume the price impact function of the primary market, $f$, is $\kappa$-liquid (in the sense above) and that the price price impact function of the secondary market, $g$, is $\mu$-stable. We will show that the secondary-market’s price change is bounded in the following way:

$%\label{eq:main}
m_0^s - m_a \le \frac{\mu}{\kappa}(m_0^s - m_0^e).$(9)

Note that because both sides of the inequality are nonnegative, Inequality 9 can also be written as

$|m_0^s - m_a| \le \frac{\mu}{\kappa}|m_0^s - m_0^e|.$

In other words, the no-arbitrage price change is at most a factor of $\mu/\kappa$ from the difference between the primary and secondary markets. This quantity (and therefore the price change after arbitrage) is small whenever the secondary market is very liquid ($\mu$ is small), or when the external market is very illiquid ($\kappa$ is large). While apparently simple, we show in Section 4.3 that this result can be applied to many useful circumstances.

By assumption, we have

$f(0) = m_0^e \le m_0^s = g(0),$

so $f(0) \le g(0)$. Then, if we can find any $\Delta \ge 0$ that satisfies

$%\label{eq:continuity-bound}
f(\Delta) \ge g(-\Delta),$(10)

then there exists some $0 \le \Delta^\star \le \Delta$ such that

$f(\Delta^\star) = g(-\Delta^\star),$

by the continuity of $f$ and $g$. As before, the no arbitrage price $m_a$ is defined as $m_a = f(\Delta^\star) = g(-\Delta^\star)$.

To show that there exists a $\Delta$ satisfying Inequality 10, note that any $\Delta \ge 0$ which satisfies

$%\label{eq:assumption}
m_0^e + \kappa \Delta \ge m_0^s,$(11)

automatically satisfies Inequality 10 since

$f(\Delta) \ge f(0) + \kappa \Delta = m_0^e + \kappa \Delta \ge m_0^s = g(0) \ge g(-\Delta)$

where the first inequality follows from Inequality 3, the second inequality follows from Inequality 11, while the last inequality follows from the fact that $g$ is a nondecreasing function.

In order to satisfy Inequality 11, we can easily choose

$\Delta = \frac{m_0^s - m_0^e}{\kappa}.$

Such a $\Delta$ will then satisfy Inequality 10. This, in turn, implies that a no-arbitrage trade $\Delta^\star$ satisfies $0 \le \Delta^\star \le \Delta$, and

$m_0^s - m_a = g(0) - g(-\Delta^\star)
\le g(0) - g(-\Delta) \le \mu \Delta = \frac{\mu}{\kappa}(m_0^s - m_0^e).$

Here, the first equality follows from the definition of $m_0^s$ and $g$, while the first inequality follows from the monotonicity of $g$ and the second inequality follows from Inequality 2. The resulting inequality is the one given in Inequality 9.

While the assumption that $m_0^e \le m_0^s$ might appear restrictive, it is actually fully general. For example, if $f(\Delta)$ and $g(-\Delta)$ specify the price of an asset $A$ with respect to a tradeable asset $B$, after buying $\Delta$ amount of asset $A$ from the primary (or secondary) market, then the amount of asset $B$ traded with each market is given by the quantity functions

$p(\Delta) = \int_0^\Delta f(t)\,dt, \qquad q(-\Delta) = \int_0^\Delta g(-t)\,dt.$

On the other hand, we may ask what the price of asset $B$ is with respect to asset $A$ after buying some amount $\Delta'$ of asset $B$. The quantity of asset $A$ received for $\Delta'$ of asset $B$ is easily seen to be $p^{-1}(\Delta')$ for the primary market and $q^{-1}(\Delta')$ for the secondary market. Both exist because $f$ and $g$ are strictly positive which implies that $p$ and $q$ are strictly monotonic. This implies that the respective price (using implicit differentiation) is given by

$(p^{-1}(\Delta'))' = \frac{1}{p'(p^{-1}(\Delta'))} = \frac{1}{f(p^{-1}(\Delta'))} = \frac{1}{f(\Delta)},$

where we have defined $\Delta = p^{-1}(\Delta')$, and similarly for $q$. So, if $m_0^e \ge m_0^s$, we may always ‘swap’ asset $A$ for asset $B$ in this sense, such that the resulting marginal prices are given by $1/m_0^e \le 1/m_0^s$, and enforce no-arbitrage conditions over coin $B$, instead.

As with Section 2.1, may not be the case that constants $\mu$ or $\kappa$ exist for trades of all possible sizes. In general, such constants do exist for trades of bounded size, say $0 \le \Delta \le L$. In this case, the main result extends immediately in the following way: for any prices satisfying

$%\label{eq:condition}
m_0^s - m_0^e \le \kappa L,$(12)

we have

$m_0^s - m_a \le \frac{\mu}{\kappa}(m_0^s - m_0^e).$

The proof of this statement is identical to the one above, with the additional condition that the primary and secondary market prices differ by no more than $\kappa L$.

One of the main drivers of the growth in CFMM usage in 2020 was *yield farming*. Yield farming, which is similar to maker–taker rebates in traditional trading [19], involves subsidizing the provision of liquidity for a newly-issued crypto asset. Suppose that some asset is issued at time $t_0$ by a smart contract and that it has an inflation schedule $i_t \in \reals_+$, where $i_t$ is the number of units of X produced at time $t$. In order to incentivize liquidity between the new asset and a numéraire, the smart contract reserves some percent (say, $\ell_t$) of inflation for liquidity provision. If a user creates LP shares for a CFMM, which trades this coin and then stakes (or, in other words, locks) these shares into a smart contract, then they receive some amount of this coin from the smart contract for providing liquidity. For instance, if there are 100 LP shares locked into the contract and a single user created ten of these locked shares, they might receive $\frac{10}{100}i_t\ell_t$ units of the new asset at time $t$. By subsidizing liquidity, the smart contract issuing the new coin can ensure that users can trade the new asset while also ensuring that liquidity providers have lower losses. The main loss that CFMM liquidity providers face is ‘impermanent loss’ or losses due to the concavity of the portfolio value of an LP share; *see*, *e.g.*, [9] for the specific case of Uniswap. One can also directly show these losses occur by using the definition of the portfolio value in [1].

A protocol designer would then want to ensure that LPs are compensated enough, say, by some amount $R_\ell$ in the traded coin, to have nonnegative profit after a no-arbitrage trade with the external market; , we need to guarantee that the portfolio value of an LP, after arbitrage and subsidy, is nonnegative. To do this, note that the opportunity cost or ‘impermament loss’ of being an LP in the secondary market is given by (in a similar way to Section 3.1):

$\begin{aligned}
m_a\Delta - \int_0^{-\Delta} g(-t)\,dt \ge (m_a - g(0))\Delta = (m_a - m_0^s)\Delta,\end{aligned}$

where we have used the fact that $g$ is nondecreasing, and $g(0) = m_0^s$ by definition. Applying Inequality 9 gives

$%\label{eq:il_subsidy}
(m_a - m_0^s)\Delta \ge - \frac{\mu}{\kappa}(m_0^s - m_0^e) \Delta \ge -\frac{\mu}{\kappa^2}(m_0^s - m_0^e)^2,$(13)

where we have used the fact that the no-arbitrage trade satisfies $\Delta \le (m_0^s - m_0^e)/\kappa$. Therefore, to incentivize LPs to continue adding liquidity to the $\mu$-stable secondary market, assuming an external market that is $\kappa$-liquid, it suffices to subsidize the LPs by some amount

$R_\ell' = \frac{\mu}{\kappa^2}(m_0^s - m_0^e)^2,$

in the numéraire. Alternatively, they can be subsidized by at least

$\frac{R_\ell'}{m_a} = \frac{\mu}{\kappa^2 m_a}(m_0^s - m_0^e)^2 \le \frac{\mu m_a}{\kappa}\left(\frac{m_0^s}{m_a} - 1\right)^2$

in the traded coin, since $m_0^e \le m_a \le m_0^s$. In other words, the total quantity of subsidy is proportional to the curvature of the secondary market, and inversely proportional to the curvature of the external market. If we define $h = m_0^s/m_a - 1$ to be the percentage change of the asset price (note that $h \ge 0$ since $m_a \le m_0^s$) then we have simple expression for the amount of subsidy that is sufficient, in the traded asset, which we will define as:

$%\label{eq:il_growth}
R_\ell' = \frac{\mu m_a h^2}{\kappa^2}.$(14)

This gives a simple condition which guarantees that liquidity providers have nonnegative returns for providing liquidity. In particular, we note that more subsidy has to be provided as $h$ becomes large (*i.e.*, the price is changing with large drift) or when $\mu/\kappa^2$ is large (*i.e.*, the secondary market, for which the LPs are providing liquidity for, is very illiquid when compared to the external market). In general, this means that how much subsidy one might need to provide depends not just on the drift of the asset, but also the relative curvature of the two markets.

In the summer of 2020, a number of protocols forked the codebases of popular CFMMs such as Uniswap. To entice liquidity providers to migrate to their new CFMMs, these ‘clones’ provided liquidity incentives via native governance tokens. These tokens allow holders to adjust parameters, such as fees and curvature, in CFMMs. The most notable example was Sushiswap that was able to attract billions of dollars of liquidity from Uniswap using this form of incentive, often called a “vampire attack" [39]. To successfully entice LPs to migrate to an otherwise identical CFMM, what is a sufficient amount of liquidity incentive?

Consider two otherwise identical CFMMs with different value of locked reserves. We assume the larger CFMM is the external market, while the smaller CFMM is the a secondary market. Suppose that the total value of reserves is initially $P_V^e$ for the external market and $P_V^s$ for the secondary market and that $P_V^e=cP_V^s$ for some $c \geq 1$. Before the price update of the external market, the LP can either invest $P_V^e$ into the secondary market or invest $\frac{1}{c}P_V^e$ in the external market. Because the two markets are initially identical save for the value of reserves, this implies $cR_s= R_e$ and $cR'_s=R'_e$. We denote the original no-arbitrage price by $m_0^a$, such that $P_V^e=m_0^aR+R'_e$. The price of the external market is then updated to some value $m_0^e \leq m_0^a$. After the price change to the final no-arbitrage price $m_a = g(-\Delta) \le g(0)$, the opportunity cost of providing liquidity to the smaller CFMM is given by

$P_V^s(-\Delta)-\frac{1}{c}P_V^e(\Delta) \geq g(-\Delta)(R_s+\Delta)+
\\
(R'_s-\Delta'_s)-
g(-\Delta)(R_s+\frac{1}{c}\Delta)+(R'_s-\frac{1}{c}\Delta'_e)
\\
=\frac{c-1}{c}g(-\Delta)\Delta+\frac{1}{c}\Delta'_e-\Delta'_s$

Assuming that liquidity increases with reserves, we have $\Delta'_e \geq \Delta'_s$ and therefore,

$\frac{c-1}{c}g(-\Delta)\Delta+\frac{1}{c}\Delta'_e-\Delta'_s \geq \frac{c-1}{c}\left(g(-\Delta)\Delta-\Delta'_e\right) \geq \frac{c-1}{c} (m_a-m_0^s)\Delta.$

Applying Equation 13,

$\frac{c-1}{c} (m_a-m_0^s)\Delta \geq - \frac{c-1}{c}\frac{\mu}{\kappa^2}(m_0^s - m_0^e)^2$

Therefore, to entice LPs to leave the external market for the secondary market, it suffices to provide a subsidy of

$R_\ell' = \frac{c-1}{c}\frac{\mu}{\kappa^2 m_a}(m_0^s - m_0^e)^2,$

in the numéraire or, an amount of

$R_\ell = \frac{c-1}{c}\frac{\mu m_a h^2}{\kappa^2}.$

would suffice in the traded asset. (Here, $h = m_0^s/m_a - 1$ as before.) The subsidy is decreasing as the secondary markets approaches the reserves of the external market; *i.e.*, when the vampire attack is successful and the secondary market overtakes the external market.

In this paper, we have given a simple definition of price sensitivity, and shown how it relates to several important notions, including the ‘shape’ of the CFMM, liquidity provider returns, and the expected edge of informed traders. We have also shown how to perform some basic extensions which can then be used to describe a variety of important phenomena such as yield farming and vampire attacks.

There has been much empirical evidence suggesting that the return profile of a CFMM liquidity provider depends on the shape of the CFMM’s trading function. We studied the LP returns under three different scenarios: uninformed trading, informed trading, and yield farming. Some of the results presented take inspiration from the traditional market microstructure literature and consider the return profile of informed traders. These traders can be viewed as bringing information to the market by placing a bet on the next price update that will take place in the CFMM. We were able to use no-arbitrage to derive lower bounds on the liquidity provider loss (and, conversely, lower bounds on the edge trader’s expected profit) akin to that in the classical literature to connect curvature to the informed trader’s informational edge. The results from this section provide a simple economic interpretation of curvature as the amount of information an informed trader needs to achieve a certain profit (given a fixed edge and market price).

We extended the definition to also include interacting markets with finite liquidity. These notions of shape or curvature could then be used to capture how a single trade on a market with finite liquidity affects prices on another market with finite liquidity. Using these definitions for curvature, we were able to bound the tracking error when an arbitrageur trades between a pair of markets with different curvatures. When specialized to CFMMs, the results presented generalize some of the results of [3][1] to the case where the market is not infinitely liquid.

We used this to analyze the yield farming phenomenon, where protocols began providing subsidies to liquidity providers. Here, we showed a lower bound to the amount of subsidy needed to pay liquidity providers to account for their ‘impermanent loss’ when compared to a market with bounded liquidity, which depended on the curvature of both markets and the rate of growth of the asset. Combined, these results suggest that the curvature of a CFMM needs to be optimized to avoid adverse selection while also capturing trading volume and fees related to asset price growth.

This work can be extended in a number of ways. On the practical side, many of the results presented here only work in two dimensions (*e.g.*, two asset trading). Generalizing our results to $n$ dimensions would be a useful but potentially difficult problem. For example, it is not clear how to define $\mu$-stability in higher dimensions for general CFMMs, without giving overly-restrictive definitions or overly-pessimistic bounds. Moreover, even though we give some sufficient conditions on the curvature of a ‘good’ CFMM for certain applications, it is still an open question for how to take a given price process, represented, say, as an Itô process or a jump-diffusion process, and then construct a ‘good’ CFMM. If this were found, then one could take historical data for a crypto asset and construct an optimized CFMM for trading this asset. Finally, it is clear that dynamic CFMMs [11][40][41][35][42], *i.e.*, CFMMs whose trading functions vary in time according to either a stochastic or control mechanism, continuously affect the curvature of the trading function. Given the results of this paper, a natural extension to inquire about is: how should one design an optimal control mechanism to replicate a desired payoff or behavior? The results of this paper suggest that the trade-off between adverse selection and payoff growth are extremely important to such designs, especially for products with sharp payoffs or time decay (*e.g.*, barrier options).

The results of Section 4.3 intimate that there is such a mapping, akin to super replication results from traditional mathematical finance. We suspect that some of our conjectures in Appendix 8, regarding the superhedging of contingent claims specified by CFMM portfolio values, is likely to be a problem with connections to such results.

The authors would like to thank Yi Sun, Ciamac Moallemi, Hsien-Tang Kao, Victor Xu, Rei Chiang, and Adam Lerer for helpful comments and suggestions. We also would like to thank Matteo Liebowitz of Uniswap for providing data.

In [1], the trading function is defined as a function $\varphi: \reals^n_+ \times \reals^n_+ \times \reals^n_+ \to
\reals$, which maps the reserves, *input trades*, and *output trades* to a real value. In this paper, we do not make an explicit distinction between the input and output trades; these are, instead, specified by the sign of the trade amounts $\Delta$ and $\Delta'.$ In this case, we can make the following equivalences between the trade $(\Delta, \Delta')$ (the notation as used in this paper) and the input trade $\Delta^0 \in \reals_+^2$ and output trade $\Lambda^0 \in \reals_+^2$ as used in [1], for $n=2$:

$\Delta^0 = ((-\Delta)_+, (\Delta')_+), \quad \Lambda^0 = ((\Delta)_+, (-\Delta')_+),$

while the reserves are simply $R^0 = (R, R')$. We then have

$\varphi(R^0, \Delta^0, \Lambda^0) = \psi(R, R', \Delta, \Delta'),$

as expected. The update equations remain identical, since $R^0 \gets R^0 + \Delta - \Lambda$ is equivalent to $R \gets R - \Delta$ and $R' \gets R' + \Delta'$, which means that all results from [1] hold as stated.

The analysis of CFMMs with fees is often much harder than the analysis of fee-less CFMMs. This construction gives a simple lower bound which shows that it often suffices to consider a fee-less CFMM with fees taken separately; *i.e.*, it often suffices to consider a CFMM where the fee is not reinvested into the reserves, but is instead given to LPs directly.

For simplicity, we will use the notation from [1], which results in a simple proof for any number of coins $n$ (*see* Appendix 1).

Let $\varphi: \reals^n_+ \times \reals^n_+ \times \reals^n_+ \to \reals$ be a trading function for a CFMM that can be written as (with some slight abuse of notation):

$\varphi(R^0, \Delta^0, \Lambda^0) = \varphi(R^0 + \gamma\Delta^0 - \Lambda^0),$

where $R^0 \in \reals_+^n$ are the reserves, $\Delta^0 \in \reals_+^n$ is the input trade, and $\Lambda^0 \in \reals_+^n$ is the output trade. We will assume that $\varphi$ is increasing in its arguments, and let $0 < \gamma \le 1$ such that $(1-\gamma)$ is the fee taken for the CFMM. (*see*, *e.g.*, [1].) In this case, we will consider the resulting portfolio value of an LP at some cost vector $c \in \reals_+^n$. We will then show that the portfolio value of the LP after any feasible trade $(\Delta^0, \Lambda^0)$ is at least as large as the equivalent portfolio value at the previous reserves with an extra factor of $(1-\gamma)c^T\Delta$.

The proof is nearly immediate. Let $R^1 = R^0 + \Delta^0 - \Lambda^0$ be the post-trade reserves and $R^0$ be the pre-trade reserves, then

$c^TR^1 = c^T(R^0 + \Delta^0 - \Lambda^0)
\\
= c^T(R^0 + \gamma \Delta^0 - \Lambda^0) + (1-\gamma)c^T\Delta^0 \ge c^TR^\star + (1-\gamma)c^T\Delta^0,$

where $R^\star$ is the solution to the fee-less portfolio-value problem [1],

$%\label{eq:pv}
p_{R^0}(c) = \inf_{\psi(R) \ge \psi(R^0)} c^TR,$(15)

with variable $R \in \reals_+^n$. Note that the second inequality follows since, by definition, $(\Delta^0, \Lambda^0)$ is a feasible trade only when

$\psi(R^0 + \gamma\Delta^0 - \Lambda^0) \ge \psi(R^0),$

and so $R = R^0 + \gamma\Delta^0 - \Lambda^0$ is a feasible point for the portfolio-value Problem 15. Repeatedly applying this statement to any number of feasible trades $(\Delta^k, \Lambda^k)$ yields the following lower bound for the portfolio value at time $k$:

$c^TR^k \ge p_{R^0}(c) + (1-\gamma)\sum_{k=1}^n c^T\Delta^k.$

In many cases, because we are interested in finding a lower bound to the portfolio value of liquidity providers, it will often suffice to use this statement in order to achieve a reasonable lower bound. This allows us to side-step the potentially very complicated analysis of CFMMs with fees and the fees’ interactions with the CFMM’s reserves.

From Equation 4, we can write,

$g(\Delta) = \frac{\frac{\partial \psi}{\partial\Delta}}{\frac{\partial \psi}{\partial\Delta'}} = \frac{\frac{\partial \psi}{\partial\Delta'} \frac{\partial\Delta'}{\partial \Delta}}{\frac{\partial \psi}{\partial\Delta'}} = \frac{d \Delta'}{d \Delta}$

Given a CFMM invariant function, given initial reserves, $\psi(\Delta, \Delta')$, we can write:

$\frac{\partial \psi}{\partial \Delta} = \frac{\partial \psi}{\partial \Delta'} \frac{\partial \Delta'}{\partial \Delta} = \frac{\partial \psi}{\partial \Delta'} g(\Delta)$

Therefore, $g(\Delta) = \left(\frac{\partial \psi}{\partial \Delta'}\right)^{-1} \frac{\partial \psi}{\partial \Delta}$. Thus $\mu$-stability condition, for sufficiently smooth $g$, relies on the first derivative of $g$:

$\begin{aligned}
\frac{d g}{d \Delta} &= -\left(\frac{\partial \psi}{\partial \Delta'}\right)^{-2} \left(\frac{\partial \psi}{\partial \Delta \partial \Delta'}\right)\left(\frac{\partial \psi}{\partial \Delta}\right) + \left(\frac{\partial \psi}{\partial \Delta'}\right)^{-1} \frac{\partial^2 \psi}{\partial \Delta^2} \\
&= \left(\frac{\partial \psi}{\partial \Delta'}\right)^{-1} \left(g \frac{\partial\psi}{\partial\Delta\partial\Delta'} + \frac{\partial^2 \psi}{\partial \Delta^2}\right)\end{aligned}$