SSRN Id3722714

Download as pdf or txt
Download as pdf or txt
You are on page 1of 56

AUTOMATED MARKET MAKERS AND DECENTRALIZED EXCHANGES: A DEFI PRIMER

VIJAY MOHAN1
RMIT Blockchain Innovation Hub, RMIT University
& Lattice Analytics Pty Ltd
Email: [email protected]

First version: 30th October 2020


Second version: 13th April 2021
Third version: 28th September 2021
This version: 24th November 2021

Abstract
Recent advancements in decentralized finance (DeFi) have resulted in a rapid increase in the
use of Automated Market Makers (AMMs) for creating decentralized exchanges (DEXs). In
this paper, we organize these developments by treating an AMM as a neoclassical black-box
characterized by the conversion of inputs (tokens) to outputs (prices). The conversion is
governed by the technology of the AMM summarized by an ‘exchange function’. Various types
of AMMs are examined, including: Constant Product Market Makers; Constant Mean Market
Makers; Constant Sum Market Makers; Hybrid Function Market Makers; and, Dynamic
Automated Market Makers. The paper also looks at the impact of introducing concentrated
liquidity in an AMM. Overall, the framework presented here provides an intuitive geometric
representation of how an AMM operates, and a clear delineation of the similarities and
differences across the various types of AMMs.

Keywords Decentralized finance (DeFi); automated market maker (AMM); decentralized


exchange (DEX); smart contract; Ethereum

1 I thank four anonymous referees for their comments and suggestions for improving the content in this paper
and eliminating errors. This paper is the outcome of numerous insightful discussions on DeFi over the course of
several months with colleagues at RMIT’s Blockchain Innovation Hub. The author would like to take the
opportunity to thank the multidisciplinary cohort of academics at the Hub for this: Darcy WE Allen, Chris Berg,
Sinclair Davidson, Oleksii Konashevych, Aaron M Lane, Elizabeth Morton, Kelsie Nabben, Vy Nguyen, Imon Palit,
Marta Poblet, Jason Potts, Ellie Rennie, Sarah Sinclair and Stuart Thomas.

Electronic copy available at: https://ssrn.com/abstract=3722714


AUTOMATED MARKET MAKERS AND DECENTRALIZED EXCHANGES: A DEFI PRIMER
Vijay Mohan

1. Introduction
1.1 DeFi, DEXs and AMMs
The latest new thing in the blockchain space is decentralized finance (DeFi) which, broadly,
refers to financial digital applications built on decentralized blockchain networks. According
to one source, at the time of writing, the value of cryptocurrency locked in DeFi applications
is USD 89.23 billion, having more than quadrupled over a one-year period.2 In contrast to
traditional finance that is facilitated by centralized agencies, such as banks and stock
exchanges, the promise of DeFi is the elimination of centralized third-parties that act as
intermediaries in financial transactions.
While it is not clear at this stage whether DeFi will replace traditional financial institutions
with their decentralized substitutes, or even if many of the start-ups in this area will
eventually survive, the rapidly escalating advancements in DeFi applications suggest that
there is a need to step back and correlate ideas in this area with traditional concepts in
economics and finance. This paper represents an attempt at examining new developments in
DeFi using an old tool in economics – the neoclassical black-box. In doing so, we show that
the graphical and mathematical methods familiar to generations of students of economics
can provide broad insights into certain aspects of DeFi, and that many recent experiments in
DeFi are applications of more general production technologies. Ultimately, the motivation
here is to introduce these ideas to DeFi aficionados who are interested in an economic theory
perspective, and to present some wonderful new applications of old tools to economists,
especially students and educators.3
The application of DeFi that this paper focuses on is decentralized exchanges (DEXs). In
contrast to an over-the-counter (OTC) market that enables direct trading between two
agents, an exchange is an institution which standardizes assets and trading rules for multiple
participants. To do so, an exchange must provide mechanisms to maintain liquidity of assets
and to determine prices for assets. A stock exchange, for example, implements this through
an order book system, where buyers and sellers submit ‘orders’: prices and volumes for an
asset they would like to buy or sell. The trading price is determined by matching orders.
Typically, orders are public information, allowing market participants to gauge information
about interest in an asset and the price at which it is trading. In a centralized exchange, orders
are maintained and implemented by a central authority (say, the New York Stock Exchange).

2 See https://defipulse.com, accessed on 20th September, 2021.


3
To cater to audiences from both the DeFi community and economics, by and large the paper presumes
familiarity with the jargon of neither. The only assumed knowledge is some acquaintance with the concept of a
blockchain and the basic techniques of calculus.

Electronic copy available at: https://ssrn.com/abstract=3722714


A DEX provides agents with the opportunity to exchange one asset for another without a
centralized third-party responsible for overseeing trading activity. The cryptocurrency space
has been dominated by centralized exchanges in the past, many of whom, such as Mt. Gox,
met with disastrous downfalls and losses that have, if anything, only strengthened the resolve
to make DEXs work. Schär (2021) and Pourpouneh et al (2020) list the various pros and cons
of centralized and decentralized exchanges. Specifically, centralized exchanges can be easier
to implement but suffer from a number or drawbacks: traders lose custody of assets and must
trust the exchange to not seize assets; they can be susceptible to security threats due to a
single point of attack; and, centralized exchanges for cryptocurrencies have been subject to
little regulation. DEXs, on the other hand, do not rely on trust in, or security of, a single
centralized party as traders retain custody of assets and smart contracts execute trades. They
are, however, harder to design and implement, and can charge higher fees to attract liquidity.
DEXs can be implemented in different ways. Some replicate the order book format of a
centralized exchange. One way to do this is through an on-chain order book where every
order is recorded on the blockchain, but this can be expensive. An alternative approach
involves constructing an off-chain order book, which only uses the blockchain for settlement,
but orders are recorded elsewhere (possibly by some centralized third-party). This is less
expensive, but also less decentralized and secure compared to an on-chain order book (Schär,
2021; Pourpouneh et al, 2020).
Instead of using an order book, more recent attempts at establishing DEXs have revolved
around the use of automated market makers (AMMs), which is the subset that this paper
focuses on. Following Hanson (2003) and Hanson (2007), AMMs first gained popularity in
prediction markets for aggregating predictions of agents into prices. In general, a market
maker is an institution that stands ready to buy or sell an asset, making a profit from the bid-
ask spread: the difference between the ask or offer rate (the rate at which the market maker
sells an asset) and the bid rate (the rate at which the market maker buys an asset). An AMM
automates this by allowing traders to place orders with the AMM, which then algorithmically
provides a price. It is worth reiterating how this process is distinct from the order book system
that requires matches between price and volume orders provided by buyers and sellers. With
a market maker, an agent trades with the market maker by selecting a quantity of an asset to
trade at a price specified by the market maker. This is particularly beneficial in thin markets
where there are few buyers and sellers, so that there may be a wide gap between the
maximum price any buyer is willing to pay and the minimum price any seller is willing to
accept, thereby causing no trades to occur. When a market maker acts as the counterparty
to all trades, liquidity can be provided even when markets are thin.
Traders on a DEX are interested in swapping one token for another with the AMM. So, the
question that arises is: who exactly provides liquidity for an AMM to act as a DEX? The answer
is that owners of various tokens do so by placing their tokens within a liquidity pool in the

Electronic copy available at: https://ssrn.com/abstract=3722714


AMM; the quantities of tokens in a liquidity pool are its reserves.4 In return, liquidity providers
are typically entitled to a share of the fees paid by traders for exchanging tokens. Returns in
the form of trading fees are the main incentive for agents to act as liquidity providers.
In an order book system, the matching of orders by buyers and sellers (that is, the forces
of demand and supply) produces a price. In an AMM, prices are determined algorithmically;
what guarantees, then, that the AMM prices reflect demand and supply conditions in the
wider market for cryptocurrencies? For example, suppose there exists another exchange – an
‘external’ or ‘reference’ market – that prices some token, say ABC token, at 2 XYZ tokens. If a
trader wants to swap between ABC and XYZ tokens at the AMM, the AMM’s algorithm should
set a price close to the price in the external market. There are, in fact, a couple of different
ways in which the price in the AMM can be made to align with that of the external market.
The first, and most common, is through the process of arbitrage, wherein arbitrageurs buy
and sell assets across markets to take advantage of price differentials and make (risk-free)
profits. In doing so, arbitrageurs cause an alignment of prices. The second is by allowing the
reference market to act as an oracle, which is essentially an external source of information
used by the AMM to set its price.

1.2 Smart contracts


Smart contracts are at the heart of DeFi applications and, consequently, current DeFi
platforms are being built predominantly on Ethereum’s smart contract-based blockchain. 5
Smart contracts were first introduced by Szabo (1996), along with a working definition: “A
smart contract is a set of promises, specified in digital form, including protocols within which
the parties perform on these promises” [emphasis added]. Closer examination of this
definition reveals two distinct aspects of a smart contract: a legal contractual aspect and a
technological aspect. The contractual aspect of a smart contract arises from the concepts of
‘promise’ and ‘performance’ contained in the definition. Presumably, promises are based on
intention and performance will involve consideration, so one could compare this to a
standard contract as defined by the legal profession. But the definition also suggests that the
contract is ‘digital’ and includes ‘protocols’ (read: algorithms), which provides a distinct
technological twist to the definition.
Using Szabo’s (1996) definition, therefore, one can come away with different impressions
of a smart contract, depending on which facet one wishes to emphasize. In this paper, we do
not approach a smart contract from a legal point of view, not least because the literature on
the issue of how standard contract law applies to smart contracts warrants its own separate
study. Nor do we focus on issues that economists typically examine in contract theory:

4 Of course, a single agent is free to perform both functions – provide liquidity and trade – on an AMM.
5 See https://ethereum.org (accessed 20th September, 2021), and https://ethereum.org/en/whitepaper/
(accessed 20th September, 2021) or Buterin (2014).

Electronic copy available at: https://ssrn.com/abstract=3722714


asymmetric information (the complete contract literature), or property rights and
organizational boundaries (the incomplete contract literature). Rather, for the purpose of this
paper, the most fruitful avenue is to focus on technological aspects of a smart contract. As a
definition, the US National Institute of Standards and Technology defines a smart contract as
“A collection of code and data (sometimes referred to as functions and state) that is deployed
using cryptographically signed transactions on the blockchain network.”6 Similarly, the
Ethereum whitepaper states that, “Smart contracts, cryptographic ‘boxes’ that contain value
and only unlock it if certain conditions are met, can also be built on top of the platform, with
vastly more power than that offered by Bitcoin scripting because of the added powers of
Turing-completeness, value-awareness, blockchain-awareness and state.”7
The Ethereum network has two types of accounts: externally owned accounts (EOAs) and
contract accounts (or smart contracts). EOAs in Ethereum are standard cryptocurrency
accounts and are characterized by three elements: a private key, a public key and a balance
of the cryptocurrency native to the blockchain, which in the case of Ethereum is Ether (ETH).
The public key is used to generate an address that identifies an EOA in the network, and the
private key, known only to the holder of the account, is used to (cryptographically) authorize
transactions. Thus, one agent can use her private key to authorize the transfer of a certain
amount of ETH to another agent on the network. When the transaction is added to a block,
the blockchain state is updated and the EOAs of both agents change to reflect the transaction.
In contrast, a smart contract is characterized by an address, a balance and code. A number of
features follow. First, the absence of a private key associated with a smart contract implies
that no agent on the network can authorize a change to the smart contract code (even if it
has a bug). Rather, the smart contract is controlled by the code embedded within it, which is
immutable once the contract is added to the network, and cannot be altered by any agent.8
Second, apart from ETH, a smart contract can hold compatible tokens, such as ‘ERC-20’ tokens
(that conform to ERC-20 standards for fungible tokens) or ‘ERC-721’ tokens (that meet ERC-
721 standards for non-fungible tokens).9 This is a useful feature because the smart contract

6 See https://csrc.nist.gov/glossary/term/Smart_contract (accessed 20th September, 2021).


7 See https://ethereum.org/en/whitepaper/ (accessed 20th September, 2021).
8 The main hurdle to simply replacing a smart contract (say, that has a bug in it) with a new one occurs when the

address generated for a smart contract depends on the current state. So, if a bug is found in a smart contract
after deployment, a new contract deployed (in the future) with new code would receive a new address. Even
with this constraint, there exist ways to ‘upgrade’ a contract, for example by using a proxy contract, or by
deploying a new contract (with a new address) and migrating users and data to the new address (which can be
expensive). In 2019, as part of the Constantinople upgrade to the Ethereum blockchain, the CREATE2
functionality was introduced (see https://eips.ethereum.org/EIPS/eip-1014, accessed 20th September, 2021).
This essentially allows the address to be independent of future states, so it is possible to calculate a smart
contract’s address even without deployment. In terms of upgrading a smart contract, this implies that if a smart
contract is issued an address using the CREATE2 functionality, it can be instructed to self-destruct and a new
smart contract can be deployed with the same address.
9 See https://ethereum.org/en/developers/docs/standards/tokens/erc-20/ for a description of ERC-20 and

https://ethereum.org/en/developers/docs/standards/tokens/erc-721/ for ERC-721. While these are the most

Electronic copy available at: https://ssrn.com/abstract=3722714


acts as a sort of custodian of tokens, receiving and disbursing tokens using algorithms
specified by the code.
A liquidity pool in an AMM is a smart contract with a certain set of tokens that the smart
contract can maintain balances of, as specified by its code. The balances of tokens are the
quantities that serve as reserves, which change as traders swap tokens in the liquidity pool.
The code specifies, among other things, the rules for trading, how prices are determined
based on reserves, the rules for liquidity provision, and the trading fees that traders pay to
utilize the liquidity pool. An AMM itself, then, is simply a set of liquidity pools.
Finally, there are multiple transaction costs an agent may incur when utilizing an AMM.
First, the agent may have to pay a trading fee (or swap fee) for exchanging tokens with the
AMM; these fees act as returns for liquidity providers. Second, there is a cost to changing
ledger entries on the blockchain to record changes in the ownership of tokens. These gas fees
on Ethereum vary depending on the extent to which the blockchain is being used for any
purpose, DeFi or otherwise. In what follows, we do not factor in gas fees and focus entirely
on the impact of trading fees charged by a specific AMM. In reality, when performing DeFi
transaction gas fees have to be included in trading decisions, and can sometimes be significant
enough to deter use of DeFi applications. 10 Some AMMs also have the ability to charge
protocol fees that are, essentially, meant for future development of the AMM. We do not
examine protocol fees in this paper.11

1.3 The approach and contribution of this paper


This paper examines how AMMs operate as DEXs to facilitate price discovery, arbitrage,
and the exchange of one cryptocurrency token for another. To achieve this, we view an AMM
in much the same way as neoclassical economic theory models a firm: as a ‘black-box’. A
neoclassical firm is characterized entirely by its ability to convert factor inputs, such as labour
and capital, into output using some technology made available by scientists and engineers.
The nature (or if one were to depict this graphically, the ‘shape’) of the technology is
summarized by a production function, which then delineates which combinations of inputs
and outputs are feasible. Given the costs associated with purchasing inputs and the revenues
generated by selling the output, different feasible combinations of inputs and outputs

commonly used standards at this stage, other standards exist, such as ERC-777 and ERC-1155. Standards are
introduced in the Ethereum network through Ethereum Improvement Proposals (EIPs); for further details, see
https://eips.ethereum.org and https://eips.ethereum.org/erc. All websites accessed 20th September, 2021.
10 It is worth emphasizing that the omission of gas fees in our analysis is not due to their lack of importance;

rather, it is due to the fact of gas fees are network-wide fees, which are present irrespective of whether AMMs
exist or not. In as much as our focus is on modelling an AMM, gas fees can be viewed as an exogenous cost that
has been normalized to zero in this paper.
11 Uniswap-v2 (Adams et al, 2020), for example, introduced the possibility of a .05% protocol fee that is deducted

from the trading fees. So, protocol fees do no not affect the transaction cost of the traders on the exchange;
rather, they create a wedge between the fees paid by traders and the fees received by liquidity providers. In
that sense, protocol fees are a tax on the users of an AMM.

Electronic copy available at: https://ssrn.com/abstract=3722714


generate different profits. The firm then, automaton-like, simply picks the combination of
inputs and output from the set of all feasible combinations that yields the maximum profit.
In the neoclassical characterization of the firm there is scant attention paid to what goes
on inside a firm (hence the term ‘black-box’). Issues that real-world businesses must tackle
on a daily basis, such as providing incentives to workers to exert effort, determining
appropriate pay packages for employees, resolving problems associated with hierarchy and
authority, and so on, are entirely ignored in a black-box view, which is based on the premise
that the technology behind the production of goods and services is of paramount importance.
Moreover, the black-box model does little to address what determines the boundaries of a
firm – why some activities are organized within a firm and others through market
transactions. Many of these problems were addressed in later developments to the theory of
the firm in the form of principal-agent models and transaction cost theories.12
The drawbacks of the black-box methodology notwithstanding, it does what it’s supposed
to do – describing the conversion of inputs to outputs – extremely well. If in some context of
analysis the focus is indeed on the technology behind this conversion, the black-box nature
of the neoclassical firm is, to borrow a phrase from programmers, a feature and not a bug,
because it removes all the clutter about what goes in on inside a firm to hone in on what is
contextually important: the technology.
Given the myriad DEX platforms that have emerged in the recent past, one could make the
argument that our current understanding is at a stage where it would benefit from a careful
examination of how inputs are converted to an output by an AMM. The approach adopted by
this paper is to view an AMM as a black-box that transforms quantities of tokens in an AMM
(inputs) into a price (output). The transformation is governed by the specification of an
‘exchange function’ that describes the technology of token trade in an AMM. 13 It is worth
emphasizing that we do not equate an AMM to a firm; rather, the methodology of treating
the firm as a black-box is utilized here to model an AMM.
The exchange function that has received the most attention in the DeFi community is used
by a Constant Product Market Maker (CPMM), Uniswap. 14 Since this is typically the first type
of AMM that many entrants into the DeFi space encounter, Section 2 provides a detailed
account, using examples, of how such an AMM operates as a DEX and how fees generate bid-
ask spreads. Moreover, given the importance of arbitrage in pricing, this section examines
two and three-point arbitrage, along with relevant no-arbitrage conditions.
Following its inception in 2018, Uniswap has undergone multiple iterations: Uniswap

12 See Demsetz (1997), Hart (1995, Chapter 1), and Holmstrom and Tirole (1989) for overviews.
13 The term ‘exchange function’ is used because it captures different ways in which the word ‘exchange’ appears
in this context. First, the function governs the exchange of one token for another by traders in an AMM; second,
any given decentralized exchange will have a specific function associated with it.
14 See https://uniswap.org (accessed 20th September, 2021). As a disclaimer, the utilization of specific AMMs as

examples in this paper is purely for expository purposes, and is in no way meant to advocate their use.

Electronic copy available at: https://ssrn.com/abstract=3722714


version 1 (v1) was the original proof of concept; 15 this was upgraded to version 2 in 2020 (v2;
Adams et al, 2020).16 While our analysis in Section 2 is based on the characteristics of
Uniswap-v1 and v2, other CPMMs exist, such as Sushiswap and Mooniswap. 17 Consequently,
in order to generalize the ideas here, we will often refer to a CPMM-v1 or v2 to characterize
a CPMM that has the characteristics of Unsiwap-v1 or v2, respectively.
Section 3 introduces some basic tools of economic modelling - homogeneous functions,
homothetic functions and Euler’s theorem - as well the geometric properties characterizing
these tools. While the material here is fairly self-contained, more detailed and leisurely
discussions of these topics can be found in any introductory text on mathematical methods
in economics, such as Chiang (1984) or Silberberg (1990). 18 This facilitates an examination of
the properties and geometry of a CPMM, which complements and extends contributions to
the analysis of price formation and arbitrage in a CPMM, such as Angeris et al (2019) and
Zhang et al (2018).
Section 4 examines other types of AMMs that have gathered interest as DEXs, including a:
Constant Mean Market Maker (CMMM), such as Balancer; Constant Sum Market Maker
(CSMM), which has drawbacks as a DEX; Hybrid Function Market Makers (HFMM), such as
Curve Finance; and, Dynamic Automated Market Maker (DAMM), such as Bancor.19 The focus
here is very much on fitting these AMMs into the framework developed in Section 3, as well
as on drawing out similarities and points of departure in their characteristics. The specific
institutional features of each of these AMMs are not described nearly as carefully as for the
CPMM in Section 2, though in many instances, if required, these features can be readily
related to concepts introduced for a CPMM.20
Overall, while a variety of AMMs have emerged to trade tokens in a decentralized manner,
their performance and attributes are connected. Figure 1 below serves to summarize the links
we develop between the various AMMs in Sections 3 and 4. As the figure shows, a CPMM is
a special case of a CMMM. Allowing for weights to change in a CMMM replicates the
performance (in terms of price adjustments) of a DAMM. Mixing a CSMM with a CMMM yields
a HFMM.

15 See https://hackmd.io/@HaydenAdams/HJ9jLsfTz for the v1 whitepaper (accessed 20th September, 2021).


16 As each version introduces new smart contracts, they can coexist as liquidity pools.
17 See https://sushi.com and https://mooniswap.exchange/#/swap. Sushiswap is a fork of Uniswap, with some

features added to make it more “community friendly”. In what was subsequently termed a “vampire attack”,
Sushiswap sought to extract liquidity away from Unsiwap. For a summary of vampire attacks, see
https://finematics.com/vampire-attack-sushiswap-explained/. Mooniswap, on the other hand, attempts to
reduce the impact of price slippage from large trades on a CPMM. All websites accessed 20th September, 2021.
18 An application of these techniques can also be found in a graduate microeconomics text, such as Mas-Colell,

Whinston and Green (1995).


19 See: https://balancer.finance for Balancer and https://www.curve.fi for Curve Finance; and

https://app.bancor.network/eth/data for Bancor. All websites accessed 20th September, 2021.


20 See also Angeris and Chitra (2020), who examine the properties of a general class of constant function market

makers, which include the CPMM, CMMM and HFMM.

Electronic copy available at: https://ssrn.com/abstract=3722714


DAMM
(Bancor)

Dynamic weights
CSMM CMMM
(Balancer)

Special case
Mix

HFMM CPMM-v2, v1
(Curve) (Uniswap-v2, v1)

Figure 1: Links between AMMs

Recently, Uniswap released Version 3 (v3; Adams et al, 2021), which is a significant
departure from v2. In Section 5, we review the changes brought about by Uniswap-v3 and
turn to broadly outlining the geometry behind this AMM by examining the idea of
concentrated liquidity. We show here that Uniswap-v3 displays some characteristics of both
a CPMM and a CSMM.
Like the neoclassical firm, the black-box view of an AMM has limitations in describing other
aspects of an AMM, such as how decentralized governance of an AMM is organized, how
communities are formed in this space, and so on; this paper does not address these important
and interesting issues. Nor does this paper delve into the uses of AMMs other than for the
purpose of creating a DEX. Some concluding thoughts on this are offered in Section 6.

2. The workings of a Constant Product Market Maker (CPMM): Uniswap-v1 and v2


In a CPMM such as Uniswap, the product of the quantity of two tokens in a liquidity pool
is a constant. The example examined here replicates and extends the one developed in the
original Uniswap-v1 whitepaper. When needed, we will introduce the changes brought about
in Uniswap-v2, and how this impacts the workings of the CPMM platform.

2.1 Examples and some basic pricing equations


The two tokens in focus here are token 𝑋 (which we assume to be ETH) and token 𝑌 (some
ERC-20 token, say ABC). In what follows, we use upper-case letters for the token in general
and lower-case letters for specific quantities of the tokens. For any given token quantities,
(𝑥, 𝑦), a CPMM utilizes the exchange function 𝑥𝑦 = 𝑘 to algorithmically govern trade
between the two tokens. To see how this works, let the initial amount of ETH supplied by
liquidity providers be 𝑥 0 = 10, and the amount of ABC provided be 𝑦 0 = 500; these are the
initial reserves of the two tokens in the AMM liquidity pool. In a CPMM, the product of the

Electronic copy available at: https://ssrn.com/abstract=3722714


two is a constant or invariant, 𝑘, which takes an initial value 𝑘 0 = 𝑥 0 𝑦 0 = 5000.
A trader in this market is any agent who exchanges one token for anther in the pool. In
order to do this, the trader must pay a trading fee, which accrues to the liquidity providers.
However, to establish a baseline case, let us first consider the situation where the trading fee
is zero. Suppose the trader wishes to sell 1 ETH in exchange for ABC. In the absence of a
trading fee, this entire amount is added to the liquidity pool, resulting in a pool balance of
𝑘0
𝑥 1 = 11 ETH. Given 𝑘 0 , the amount of ABC in the pool is 𝑦 1 = 𝑥 1 = 454.5454. The change in
the pool reserves of ABC is 𝑦 1 − 𝑦 0 = −45.4546, which is negative because the reserves of
ABC in the AMM have fallen; this quantity of 45.4546 ABC is sent to the trader’s account. The
trader has effectively sold 1 ETH in order to buy 45.4546 ABC with the AMM, which is the
counterparty to the trade; consequently, the liquidity providers for the AMM now, in
aggregate, hold 1 ETH more and 45.4546 ABC less. While the AMM has an altered reserve
profile (𝑥 1 , 𝑦 1 ), it is evident that 𝑥 1 𝑦 1 = 𝑘 0 , and the product of the new reserve quantities
𝑏
equals the constant 𝑘 0 . The price of 1 ETH in terms of ABC in this example is 𝑃𝑌/𝑋 = 45.4546
ABC/ETH. In terms of the notation, the subscript 𝑌/𝑋 indicates that the price is for one unit
of token 𝑋 (ETH) in terms of token 𝑌 (ABC), while the superscript 𝑏 indicates that this is the
bid price: the price at which the AMM buys ETH.21 It is straightforward to work the example
in reverse, where the trader buys 1 ETH from the AMM. Proceeding as before: 𝑥 1 = 9, 𝑦 1 =
𝑘0 𝑎
= 555.5556 and 𝑦 1 − 𝑦 0 = 55.5556. The price in this instance is 𝑃𝑌/𝑋 = 55.5566
𝑥1
ABC/ETH, where the superscript 𝑎 indicates that this is the ask (or offer) price of ETH: the
price at which the AMM sells 1 unit of ETH to the trader.
The bid and ask rates in this example seem appreciably different – the bid-ask spread is
𝑎 𝑏
𝑃𝑌/𝑋 − 𝑃𝑌/𝑋 = 10.102, primarily because the changes considered here are lumpy and fairly
large in magnitude. In reality, ETH is divisible to 18 decimal places, so much smaller trades are
feasible.22 Suppose the trader were to buy and sell .01 ETH instead of 1 ETH in the example.
𝑏 𝑎
The bid and ask prices are now 𝑃𝑌/𝑋 = 49.9500 ABC/ETH and 𝑃𝑌/𝑋 = 50.0501 ABC/ETH and
𝑎 𝑏
the spread is only 𝑃𝑌/𝑋 − 𝑃𝑌/𝑋 = 0.1001. Indeed, as the change in ETH in the trade keeps
getting smaller, the two converge towards the price of 50 ABC/ETH. In general, it can be
shown (which we do subsequently) that with infinitesimal changes and no trading fees:

𝑏 𝑎 𝑦0
(1) 𝑃𝑌/𝑋 = 𝑃𝑌/𝑋 = 𝑥 0 = 𝑃𝑌/𝑋

There are a few features to take away from this example. First, equation (1) summarizes
the fact that the bid and ask prices collapse to a single price (𝑃𝑌/𝑋 ) for infinitesimally small

21 In the notation 𝑌/𝑋, 𝑋 is the ‘base’ token and 𝑌 is the ‘pricing’ token. As in traditional finance, we use the
terms ‘bid’ and ‘ask’ (or ‘offer’) as rates viewed from the perspective of the market maker. A trader, therefore,
sells at the bid price, and buys at the ask price.
22 See https://ethereum.org/en/eth/ (accessed 20th September, 2021).

10

Electronic copy available at: https://ssrn.com/abstract=3722714


𝑦0
changes, and that this price equals the ratio of the two reserves (𝑥 0). Second, the price of one
unit of ABC in terms of ETH (that is, 𝑃𝑋/𝑌 ) converges to:
1 𝑥0
(2) 𝑃𝑋/𝑌 = 𝑃 = 𝑦0
𝑌/𝑋

Third, with no fees, 𝑘 0 remains the same for all subsequent trades, and only changes when
liquidity is injected into, or withdrawn from, the pool by liquidity providers.
Now consider a situation where the trader is required to pay an ad valorem trading fee, 𝜏.
Apart from the addition of fees, all the other features of the example are maintained. The
trading fee is assumed to be 𝜏 = .25% in the example constructed in the Uniswap-v1
whitepaper, which we follow here as well; in reality, the fee on Uniswap-v1 and v2 is 0.3%.
The trading fee is paid using the token that is added to the liquidity pool (that is, the token
sold by the trader). Assuming, as before, that the trader sells 1 ETH, the transaction cost of a
sale of 1 ETH by the trader is 𝜏 × 1 = .0025 ETH. This leaves (1 − 𝜏) × 1 = .9975 ETH
available for the trade. To save on notation, let (1 − 𝜏) = 𝜙. There are two stages to the
process now: in the first stage, the fee is deducted, and the trade is enforced using the initial
invariant 𝑘 0 . In the second stage, the fees are added to the liquidity pool, which gives rise to
a new invariant, 𝑘1 . This ensures that the value of 𝑘 changes with every trade; so, the term
‘constant’ or ‘invariant’ is somewhat misleading when there are trading fees – it is more of a
predetermined variable prior to a trade.
In the first stage, which we can think of as the interim trading stage, the amount of ETH in
the pool is 𝑥 1′ = 10.9975 ETH (where the superscript ′ denotes interim). Given 𝑘 0 = 5000,
𝑘0
the new amount of ABC balance in the pool is 𝑦 1 = 𝑥 1′ = 454.6488, implying a change 𝑦 1 −
𝑏
𝑦 0 = −45.3512 ABC. The trader effectively receives the bid price of 𝑝𝑌/𝑋 = 45.3512
ABC/ETH. In terms of notation, the lower-case 𝑝 indicates that the price now refers to a
scenario where a trading fee has been imposed. In the second stage of the trade, the fees are
added to the liquidity pool, giving a final ETH pool balance of 𝑥 1 = 11. The new value of 𝑘 at
the end of the trade is 𝑘1 = 𝑥 1 𝑦 1 = 5001.1368, which is higher than before and is a
predetermined variable for the next trade on the AMM.
Comparing the case with trading fees to the case without, we can see that the bid price of
𝑏 𝑏
ETH is lower than before (𝑝𝑌/𝑋 < 𝑃𝑌/𝑋 ), and the trader receives less ABC per ETH than when
there are no transaction costs. Secondly, the change in 𝑘 is 𝑘1 − 𝑘 0 = 1.1368. Greater the
number of transactions on Unsiwap-v1 or v2, more rapid is the expansion of 𝑘, even if liquidity
providers add no further tokens to the pool themselves.
Now suppose the trader were to buy one unit of ETH, which would leave 9 ETH in the pool.
The fee here is charged for the volume of ABC traded for 1 ETH. So, if the trader deposits an
amount ∆𝑦 ABC, after the fees are deducted the trader adds an interim (Stage 1) amount of

11

Electronic copy available at: https://ssrn.com/abstract=3722714


1 𝑘0
𝜙∆𝑦 ABC to the pool. It follows that ∆𝑦 = 𝜙 [𝑥 1 − 𝑦 0 ] = 55.6948. The ask price has now
𝑎 𝑎
increased with the introduction of the transaction fee (𝑝𝑌/𝑋 > 𝑃𝑌/𝑋 ). Moreover, the bid-offer
𝑎 𝑏
spread is 𝑝𝑌/𝑋 − 𝑝𝑌/𝑋 = 10.3436, which is larger than the case with no trading fees, because
the bid rate is lower and the ask rate is higher. This is intuitively the reason why there are
lower arbitrage opportunities available in the presence of higher transaction costs.
We can now ask, once again, what happens if a smaller ETH amount, say .01 ETH, is traded.
𝑏 𝑎 𝑎
Replicating the procedure, we find that 𝑝𝑌/𝑋 = 48.7025, while 𝑝𝑌/𝑋 = 50.1755, so 𝑝𝑌/𝑋 −
𝑏
𝑝𝑌/𝑋 = 1.473. While this is smaller than the spread when 1 ETH was traded, it is still fairly
𝑏
significant. In fact, we show analytically in the Section 3 that for infinitesimal changes, 𝑝𝑌/𝑋 =
𝑎 𝑎 𝑏
49.875 and 𝑝𝑌/𝑋 = 50.125, which implies 𝑝𝑌/𝑋 − 𝑝𝑌/𝑋 = 0.25 is the minimum spread
achievable in this example with a fee of 0.25%. This wedge between the two prices cannot
reduce to zero – we need to work with bid and ask rates even with infinitesimal changes.
Finally, since the sale (purchase) of one token by a trader goes hand-in-hand with the
purchase (sale) of the other token, equation (2) needs to be modified to:
𝑏 1 𝑎 1
(3) 𝑝𝑌/𝑋 = 𝑝𝑎 and 𝑝𝑌/𝑋 = 𝑏
𝑋/𝑌 𝑝𝑋/𝑌

2.2 Arbitrage using AMMs


In this section, we consider two different ways in which an AMM can be used for arbitrage:
two-point arbitrage and three-point arbitrage. The arbitrage terminology we employ here is
consistent with standard usage in the finance and foreign exchange market literatures.23

2.2.1 Two-point arbitrage


Two-point arbitrage or locational arbitrage is triggered due to a difference in prices across
different markets (or exchanges or platforms, as the case may be) for the same asset.
Consider a situation where there exists another (possibly centralized) exchange, which is the
external reference market. An agent seeks to exchange between 𝑌 (ABC) and 𝑋 (ETH). Two-
point arbitrage refers to the fact that a token bought in one market can be sold in the other
in order to realize risk-free profits. Doing so is profitable (subject to transaction costs) if there
is a mismatch in the prices quoted in the two markets. However, as agents take advantage of
arbitrage opportunities and transact in the two markets, the demand and supply forces they
set into motion eventually cause these opportunities to disappear. An equilibrium occurs
when there are no arbitrage opportunities left, and the equilibrium no-arbitrage condition

23 Two-point and three-point arbitrage in the context of foreign exchange markets are covered in most
undergraduate texts in international finance; see, for example, Moosa (2010). Our discussion draws on these
insights, along with simple ways to visualize the arbitrage process, such as Figure 2.

12

Electronic copy available at: https://ssrn.com/abstract=3722714


essentially involves no mismatch in prices between the two markets. Arbitrage is, in general,
a powerful pricing tool: first, it is attractive because it results in risk-free profits, so we can be
sure agents will jump to take advantage of arbitrage opportunities when they arise; second,
the process of arbitrage conveniently eliminates these opportunities eventually, so we can be
confident that, all else being the same, markets will gravitate towards an equilibrium where
prices equalize (to the extent permitted by transaction costs).
To examine two-point arbitrage in more detail, let the price of one unit of 𝑋 in terms of 𝑌
in the external market be 𝑀𝑌/𝑋 . The upper-case 𝑀 denotes a situation where there are no
trading fees for transacting in the external market. This is altered readily enough by
𝑏 𝑎
considering bid and ask rates in the external market: 𝑚𝑌/𝑋 and 𝑚𝑌/𝑋 . We could make the
story even more realistic by adding other transaction costs (such as gas fees). In reality, all
such costs must be accounted for. However, for the task at hand of understanding the
mechanics of how arbitrage works, we can ignore transaction costs other than the AMM
trading fees, with the caveat that they must be factored in when actually trading.
To begin with, consider the case when there are no trading fees on the AMM and
infinitesimal trade volumes are possible. Suppose that 𝑀𝑌/𝑋 = 49.9 in the external market,
while 𝑃𝑌/𝑋 = 50.0 in the AMM. An arbitrageur could buy 𝑋 in the external market for 49.9
and sell it in the AMM for 50.0 𝑌, thereby making a profit of 𝑃𝑌/𝑋 − 𝑀𝑌/𝑋 = 50.0 − 49.9 =
0.1 units of 𝑌 per unit of 𝑋. However, as arbitrageurs do this, the increased demand for 𝑋 in
the external market will increase 𝑀𝑌/𝑋 , and the increased sale of 𝑋 in the AMM will reduce
𝑃𝑌/𝑋 till the arbitrage profits are wiped away.24 The prices in the two markets are brought
into alignment due to the actions of arbitrageurs, and prices in the AMM cannot diverge
randomly for any significant period of time. The equilibrium no-arbitrage condition satisfies:

(4) 𝑃𝑌/𝑋 = 𝑀𝑌/𝑋

Similarly, in instances where 𝑃𝑌/𝑋 < 𝑀𝑌/𝑋 we would expect arbitrage to occur in the opposite
direction. Demand-supply forces would then result in (4) holding at equilibrium.
Now, suppose there is a trading fee of 𝜏 = 0.25% on AMM which, as we have seen earlier,
𝑏 𝑎
results in 𝑝𝑌/𝑋 = 49.875 and 𝑝𝑌/𝑋 = 50.125. With 𝑀𝑌/𝑋 = 49.9, arbitrage is no longer
feasible: buying ETH in the external market and selling in the AMM involves a loss of 0.025
ABC, and going in the reverse direction yields a loss of .225 ABC. Thus, the no-arbitrage
condition in equation (4) is transformed to:
𝑏 𝑎
(5) 𝑝𝑌/𝑋 ≤ 𝑀𝑌/𝑋 ≤ 𝑝𝑌/𝑋
In the range prescribed by equation (5), arbitrage between the external market and the AMM
is not profitable. If 𝑀𝑌/𝑋 moves outside this range, arbitrage is triggered which will result in

24 If the AMM is small relative to the external market, these trades may have only a small impact on the price
in the external market, so that the brunt of the adjustment occurs through changes in 𝑃𝑌/𝑋 .

13

Electronic copy available at: https://ssrn.com/abstract=3722714


demand-supply changes that bring the rates into alignment, so that (5) holds again.
Two observations are worth noting about the arbitrage process described here. First, the
𝑏 𝑎
numbers we have used for 𝑝𝑌/𝑋 and 𝑝𝑌/𝑋 are taken from example in Section 2.1 with
infinitesimal trade volume. However, moving to discrete changes only serves to widen the
𝑎 𝑏
spread 𝑝𝑌/𝑋 − 𝑝𝑌/𝑋 , which extends the range in equation (5) for which arbitrage is not
profitable. A similar widening of the spread occurs when 𝜏 rises, so that increased trading fees
(and transaction costs in general) also reduce arbitrage opportunities. Second, if one
𝑏 𝑎
incorporates bid and offer rates in the external market, 𝑚𝑌/𝑋 and 𝑚𝑌/𝑋 , the equilibrium no-
arbitrage condition in (5) will have to factor this in; specifically:
𝑏 𝑎 𝑏 𝑎
(6) 𝑝𝑌/𝑋 ≤ 𝑚𝑌/𝑋 and 𝑚𝑌/𝑋 ≤ 𝑝𝑌/𝑋

2.2.2 Three-point (or triangular) arbitrage


Two-point arbitrage exploits differences in prices across markets and, as the name
suggests, requires two price quotes – one from each market – for arbitrage possibilities to
emerge. In contrast, three-point arbitrage (or triangular arbitrage) focuses on the internal
consistency in the prices offered within a single market and requires three price quotes for
its implementation. Although three-point arbitrage can also be performed across markets, it
is not necessary – a price misalignment in a single market can trigger three-point arbitrage
opportunities. We will see that as agents take advantage of three-point arbitrage within a
single AMM, the changing forces of demand and supply ensure that prices in different
liquidity pools in the AMM are ultimately aligned in a logically consistent way.
Suppose there are three tokens, 𝑋, 𝑌 and 𝑍, that are offered for trade and that a trader
can swap between any pair. The question is: can the trader start off with 1 unit of any arbitrary
token (say 𝑍) and cycle through the tokens by, for example, selling 𝑍 for 𝑋, then selling the 𝑋
proceeds for 𝑌 before converting back to 𝑍 in order to end up (magically) with more than 1
unit of 𝑍? In terms of notation, we use the symbols 𝑍 → 𝑋 → 𝑌 → 𝑍 to describe this sequence
of conversions. However, this is not the only sequence that is feasible: the trader could also
perform the sequence 𝑍 → 𝑌 → 𝑋 → 𝑍. In either one of these cases, if the trader starts with
1 unit of 𝑍 at the beginning of the cycle in order to end up with more than 1 unit of 𝑍 at the
end of the cycle, the possibility of three-point arbitrage exists. Moreover, the choice of 𝑍 as
the starting token is arbitrary: a trader could realize arbitrage profits by cycling through
starting with 𝑋 or 𝑌. As Figure 2 shows, all these possibilities can be visualized using a triangle
(hence the name triangular arbitrage), with the three tokens located on the three vertices,
and a specific cycle forming a path along the sides starting an ending at a given vertex.

14

Electronic copy available at: https://ssrn.com/abstract=3722714


𝑋

𝑍 𝑌

Figure 2: Three-point arbitrage

The arrows in Figure 2 show the cycles 𝑍 → 𝑋 → 𝑌 → 𝑍, 𝑌 → 𝑍 → 𝑋 → 𝑌 and 𝑋 → 𝑌 → 𝑍 →


𝑋, depending on which vertex forms the starting point. The opposite cycles can be visualized
by reversing the direction of the arrows.
Uniswap runs on the Ethereum network and ETH (𝑋) is the native settlement token.
However, there are a number of ERC-20 tokens that can be traded on the network, and one
can swap between any two ERC-20 tokens 𝑌 and 𝑍 on Uniswap. How exactly this exchange is
facilitated varies between v1 and v2 of Uniswap. In Uniswap-v1, the platform performs an
exchange between 𝑌 and 𝑍 by implicitly using ETH as a via medium. Uniswap achieves this by
maintaining a separate smart contract for the exchange of each ERC-20 token with ETH.
Uniswap-v1 does not incorporate the possibility of a smart contract for direct conversions
between 𝑌 and 𝑍. This feature changes in Uniswap-v2, where a distinct smart contract can be
created for direct exchanges between ERC-20 tokens. Adams et al (2020) recognize the added
complexity of this change,25 without explicitly outlining the new possibilities for arbitrage this
generates. Much of the focus of this section, then, is to outline how Uniswap-v2 creates the
possibility of three-point arbitrage that is absent in v1.
More generally, we explore the outcomes under two types of CPMMs: CPMM-v1 that uses
a token 𝑋 as an intermediary in the exchange between and 𝑌 and 𝑍; and CPMM-v2 that allows
for a smart contract as a 𝑌 − 𝑍 liquidity pool. Consider CPMM-v1 to begin with. If a trader
wishes to sell 𝑍 and purchase 𝑌, the AMM will proceed by converting 𝑍 to 𝑋 (ETH) and then
by converting the proceeds to 𝑌, which are added to the trader’s account. Suppose that there
are no trading fees (𝜏 = 0). If the trader sells 1 unit of token 𝑍, 𝑃𝑋/𝑍 determines how many

25As Adams et al (2020) state: “A proliferation of pairs between arbitrary ERC-20s could make it somewhat more
difficult to find the best path to trade a particular pair, but routing can be handled at a higher layer…”.

15

Electronic copy available at: https://ssrn.com/abstract=3722714


units of 𝑋 the AMM delivers in exchange using the 𝑋 − 𝑍 liquidity pool. The 𝑃𝑋/𝑍 units of 𝑋
can then be converted to 𝑌 at the price 𝑃𝑌/𝑋 , yielding the trader 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 units of 𝑌.
Consequently, the price offered by CPMM-v1 for converting 1 unit of 𝑍 to 𝑌, 𝑃𝑌/𝑍 , is:

(7) 𝑃𝑌/𝑍 = 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍

To borrow some terminology from the foreign exchange rate literature, 𝑃𝑌/𝑍 is the cross-
rate (or cross-price) that can be derived from the other two prices (𝑃𝑌/𝑋 and 𝑃𝑋/𝑍 ). In CPMM-
v1, there are two prices, 𝑃𝑌/𝑋 and 𝑃𝑋/𝑍 , that are determined in the two liquidity pools that
are available, the 𝑋 − 𝑌 pool and the 𝑋 − 𝑍 pool. The third price, 𝑃𝑌/𝑍 , is derived from the
other two (using equation 7). Now, in CPMM-v2, a third market price exists due to the
creation of a direct 𝑌 − 𝑍 liquidity pool. The three liquidity pools (the 𝑋 − 𝑌, 𝑋 − 𝑍 and 𝑌 −
𝑍 pools) can move independently due to trader activities. Intuitively, we can see from Figure
2 that the presence of a third liquidity pool creates an independent price to connect the
vertices 𝑌 and 𝑍.
When equation (7) holds, three-point arbitrage is not feasible; it is, therefore, a no-
arbitrage condition. To see this, consider CPMM-v2 with 𝑋 − 𝑌, 𝑋 − 𝑍 and 𝑌 − 𝑍 liquidity
pools, along with prices (𝑃𝑌/𝑋 , 𝑃𝑋/𝑍 and 𝑃𝑌/𝑍 ). Let us further posit that these three pools yield
the relationship 𝑃𝑌/𝑍 < 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 , which violates equation (7). A trader could then perform
the sequence 𝑍 → 𝑋 → 𝑌 → 𝑍 to make a risk-free profit.26 Starting off with 1 unit of 𝑍, this
sequence of conversions yields 𝑃𝑍/𝑌 × 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 units of 𝑍 at the end of the cycle. As
1 𝑃𝑌/𝑋 ×𝑃𝑋/𝑍
𝑃𝑍/𝑌 = 𝑃 (equation 2), we can rewrite the expression 𝑃𝑍/𝑌 × 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 as and,
𝑌/𝑍 𝑃𝑌/𝑍
𝑃𝑌/𝑋 ×𝑃𝑋/𝑍
given the assumption that 𝑃𝑌/𝑍 < 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 , it follows that > 1.27
𝑃𝑌/𝑍

As enough traders do this, relative prices will change until the arbitrage opportunity is
wiped out, which occurs when 𝑃𝑌/𝑍 = 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 (in other words, 𝑃𝑍/𝑌 × 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 = 1)
and the inequality no longer holds. A simple demand-supply argument suffices to verify this.
In the first step of the arbitrage sequence 𝑍 → 𝑋 → 𝑌 → 𝑍, the trader sells 𝑍 in exchange for
𝑋, which decreases 𝑃𝑋/𝑍 . In the next step, the trader sells 𝑋 in exchange for 𝑌, which reduces
𝑃𝑌/𝑋 . In the last step, the trader sells 𝑌 in exchange for 𝑍, which reduces 𝑃𝑍/𝑌 . So, starting
with the inequality 𝑃𝑌/𝑍 < 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 , the arbitrage process increases the term on the left-
hand side of the inequality and reduces the terms on the right; the process stops only when
equality is restored and equation (7) holds, thereby making it a no-arbitrage condition.
In CPMM-v1, equation (7) always holds by construction, so one can think of this being an
identity in this type of AMM. On the other hand, in CPMM-v2, equation (7) holds as an

26 What is important here is not the vertex in Figure 2 that we start off with, but the direction around the triangle
that we take. Thus, the cycles 𝑌 → 𝑍 → 𝑋 → 𝑌 and 𝑋 → 𝑌 → 𝑍 → 𝑋 also yield arbitrage profits in this instance.
27 If the reverse inequality were to hold, the trader could make risk-free profits by cycling tokens in the opposite

direction: 𝑍 → 𝑌 → 𝑋 → 𝑍.

16

Electronic copy available at: https://ssrn.com/abstract=3722714


equilibrium condition after arbitrage opportunities have been eliminated. To put this slightly
differently, there exists only one price for exchanging between 𝑌 and 𝑍 a trader can obtain in
CPMM-v1, which is automatically determined by the AMM using equation (7). In CPMM-v2,
there are two prices that are available to a trader: 𝑃𝑌/𝑍 , that comes about by trading in the
𝑌 − 𝑍 pool, and 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 , that can be obtained by performing the sequence 𝑍 → 𝑋 → 𝑌;
the two are necessarily equal only at equilibrium. If there is disequilibrium, the trader can
make arbitrage profits by buying through the method that is cheaper and selling through
other method. Thus, when 𝑃𝑌/𝑍 < 𝑃𝑌/𝑋 × 𝑃𝑋/𝑍 , the trader can buy 𝑍 through the 𝑌 − 𝑍 pool
and sell it through the sequence 𝑍 → 𝑋 → 𝑌 to make a profit.
Adding a fee, 𝜏, does not alter the fundamental nature of the process; it does make the
calculations more cumbersome though. To see the implications of this, consider CPMM-v2.
𝑎 𝑏
The 𝑌 − 𝑍 pool has a bid-ask spread 𝑝𝑌/𝑍 − 𝑝𝑌/𝑍 , and the trader can directly buy 𝑍 at the ask-
price and sell it at the bid-price. However, the trader also has the alternative option of
performing the sequence 𝑍 → 𝑋 → 𝑌 to sell 𝑍 and buy 𝑌, and the sequence 𝑌 → 𝑋 → 𝑍 to
sell 𝑌 and buy 𝑍. This alternative method requires two trading fees. For the sequence 𝑍 →
𝑋 → 𝑌, for example, there exists a fee for each step 𝑍 → 𝑋 and 𝑋 → 𝑌; consequently, the
𝑏 𝑏
trader sells 𝑍 at price 𝑝𝑋/𝑍 , and then sells the 𝑋 proceeds at 𝑝𝑌/𝑋 . This implies that the
𝑏 𝑏
exchange rate associated with the sequence 𝑍 → 𝑋 → 𝑌 is 𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 . Similarly, the rate
𝑎 𝑎
associated with the sequence 𝑌 → 𝑋 → 𝑍 is 𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 . This yields no-arbitrage conditions:
𝑎 𝑏 𝑏 𝑎 𝑎 𝑏
(8) 𝑝𝑌/𝑍 ≥ 𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 and 𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 ≥ 𝑝𝑌/𝑍

Equation (8) essentially states that it is never profitable to buy 𝑍 through one method
available to the trader and sell it through the other.28

2.3 Liquidity provision and fees in a CPMM: Uniswap-v1 and v2


Any liquidity provider on Uniswap-v1 and v2 simultaneously adds both tokens in a liquidity
pool. This is a desirable feature which ensures that prices do not fluctuate due to liquidity
𝑦
provision. Suppose the price of 𝑋 in terms of 𝑌 (when 𝜏 = 0) is 𝑃𝑌/𝑋 = 𝑥 . Consider a situation
where an agent wished to add liquidity to the 𝑋 − 𝑌 pool, and did so by only adding a certain
′ 𝑦′ 𝑦
amount of 𝑋, equal to ∆𝑥. This would result in a price of 𝑃𝑌/𝑋 = 𝑥 ′ = 𝑥+∆𝑥 < 𝑃𝑌/𝑋 . Adding a
significant amount of 𝑋 to the pool by liquidity providers, then, would depress the price of 𝑋,

28 𝑎
If the trader wishes to buy 𝑍 using the 𝑌 − 𝑍 pool, the trader incurs a price of 𝑝𝑌/𝑍 ; if the trader the sells the
𝑏 𝑏 𝑎 𝑏 𝑏
proceeds using the sequence 𝑍 → 𝑋 → 𝑌, the trader receives 𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 . When 𝑝𝑦/𝑧 ≥ 𝑝𝑦/𝑥 × 𝑝𝑥/𝑧 holds, this
strategy is not profitable. Similarly, if the trader buys 𝑍 using the sequence 𝑌 → 𝑋 → 𝑍 the effective price is
𝑎 𝑎 𝑎 𝑎 𝑏
𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 . When 𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 ≥ 𝑝𝑌/𝑍 holds, selling the proceeds in the 𝑌 − 𝑍 pool is unprofitable. Equation
(8), therefore, describes the equilibrium no-arbitrage condition in CPMM-v2. No such arbitrage opportunities
𝑎 𝑎 𝑏 𝑏
can exist in CPMM-v1, since the trader has only the bid-ask spread 𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 − 𝑝𝑌/𝑋 × 𝑝𝑋/𝑍 to work with.

17

Electronic copy available at: https://ssrn.com/abstract=3722714


which is undesirable; ideally, we would like the price to change because of trading activity
and not due to the act of providing liquidity. To prevent a price change from occurring, we
would require 𝑦 ′ = 𝑥 ′ × 𝑃𝑌/𝑋 . If ∆𝑦 is the amount of 𝑌 that needs to be added to make this
∆𝑦 𝑦
condition hold, some algebraic manipulation then yields the fact that we would need ∆𝑥 = 𝑥 ;
that is, the two tokens have to be added in the same proportion as the existing reserves so as
to not cause a price change. 29 For infinitesimally small changes, this can be rewritten as
𝑑𝑦 𝑑𝑥
differentials, = .
𝑦 𝑥

Liquidity providers are entitled to the fees that are paid by traders on Uniswap, in
proportion to the amount a liquidity provider has contributed. To facilitate this, and the
process of adding and removing liquidity, Uniswap-v1 and v2 mints and distributes liquidity
tokens, with a specific token issued to each liquidity pool. These tokens are themselves
tradeable as fungible ERC-20 tokens.

3. The geometry of a CPMM


3.1 Preliminaries: homogenous and homothetic functions
The function 𝑥𝑦 = 𝑘 used in a CPMM is an example of a class of functions referred to as
homogenous functions, which we define formally below.

Homogenous functions: A function 𝑓(𝑥1 , 𝑥2 , … , 𝑥𝑛 ) is defined to be homogenous of degree


𝑟 when the following condition is satisfied:

𝑓(𝜆𝑥1 , 𝜆𝑥2, … , 𝜆𝑥𝑛 ) = 𝜆𝑟 𝑓(𝑥1 , 𝑥2, … , 𝑥𝑛 )

Essentially, this states that if all the independent variables (𝑥1, 𝑥2 , … , 𝑥𝑛 ) are multiplied by
some factor 𝜆, the value of the function is multiplied by 𝜆𝑟 . The CPMM function 𝑥𝑦 is a
simplified version of this, with two independent variables. Utilizing Definition 1, it is evident
that this function is homogenous of degree 2: if 𝑥𝑦 = 𝑘, then (𝜆𝑥)(𝜆𝑦) = 𝜆2 𝑥𝑦 = 𝜆2 𝑘. So,
for instance, if one were to double both 𝑥 and 𝑦, 𝑘 would quadruple.
A homogenous function 𝑘 = 𝑓(𝑥1 , 𝑥2 , … , 𝑥𝑛 ) can be used in different contexts to
characterize different things. In consumer theory it describes, for example, the utility
function: the level of utility (𝑘) derived from the consumption of certain quantities of
commodities (𝑥1 , 𝑥2 , … , 𝑥𝑛 ). In production theory it describes the production function: the
quantity of good or service (𝑘) produced by a firm from a certain combination of factor inputs
(𝑥1 , 𝑥2 , … , 𝑥𝑛 ). In the current context of an AMM, we think of it as an exchange function that
links various amounts of tokens (𝑥1, 𝑥2 , … , 𝑥𝑛 ) to the AMM’s invariant, 𝑘.
Geometrically, the exchange function 𝑥𝑦 = 𝑘 generates level or contour curves that are

𝑦
29Specifically, (𝑦 + ∆𝑦) = (𝑥 + ∆𝑥) × 𝑃𝑌/𝑋 , which implies (𝑦 + ∆𝑦) = (𝑥 + ∆𝑥) × 𝑥 , which in turn implies that
(𝑦 + ∆𝑦)𝑥 = (𝑥 + ∆𝑥)𝑦. Simplifying yields the desired result.

18

Electronic copy available at: https://ssrn.com/abstract=3722714


rectangular hyperbolas in a two-dimensional graph, as shown in Figure 3 below. A level curve
shows, in the 𝑥 − 𝑦 plane, various combinations of 𝑥 and 𝑦 that yield a specific value of 𝑘.
Figure 3 depicts two level curves; the first shows all the combinations of 𝑥 and 𝑦 that yield a
specific value of 𝑘 0 ; the second shows all combinations of 𝑥 and 𝑦 that yield 𝑘1 . Since 𝑘 can
take any value (greater than zero), there are an infinite such level curves that can be drawn,
each corresponding to a particular value of 𝑘.30 Subsequently, in Section 3.4, we will argue
that the level curves of the exchange function can best be thought of as ‘isoliquidity’ curves.

𝐷
𝑅
𝑐

𝑦𝐶 𝐶
𝑎
𝑐 𝐸
𝐴 𝐴
𝑦

𝑘1
𝑎 𝐵
𝑦𝐵

𝑘0
𝑥
𝑂 𝑥𝐴 𝑥𝐶 𝑥𝐵

Figure 3: The 𝒙𝒚 = 𝒌 function

In general, suppose we allow 𝑥 and 𝑦 to change. Taking the total derivative of 𝑥𝑦 = 𝑘, we


get that 𝑦𝑑𝑥 + 𝑥𝑑𝑦 = 𝑑𝑘. Along any particular level curve, however, 𝑑𝑘 = 0, and so:
𝑑𝑦 𝑦
(9) = −𝑥
𝑑𝑥

The intuition behind equation (9) is as follows. Suppose we consider a particular point, say
point 𝐴 in Figure 3, which has pool reserves of 𝑥 𝐴 and 𝑦 𝐴 . Starting from point 𝐴, if 𝑥 changes

30The corresponding level curves in the context of consumption are indifference curves, and in the context of
production are isoquants.

19

Electronic copy available at: https://ssrn.com/abstract=3722714


infinitesimally, 𝑦 has to change by a certain amount so that 𝑥𝑦 = 𝑘 0 continues to hold and
we remain on the level curve. The left-hand side of equation (9) is the slope of the curve at 𝐴,
which corresponds to the slope of the tangent 𝑎𝑎 in Figure 3. This slope is negative due the
fact that if 𝑥 increases, 𝑦 must decrease in order for the value of 𝑘 not to change. The right-
hand side of equation (9) is the slope of the ray 𝑂𝐴 connecting 𝐴 to the origin 𝑂. So, equation
(9) states that if 𝑥 and 𝑦 change along curve 𝑘 0 , the slope of the tangent at 𝐴 equals the
𝑑𝑦 𝐴 𝑦𝐴 𝑑𝑦 𝐵 𝑦𝐵
negative of the slope of the ray 𝑂𝐴; that is: 𝑑𝑥 | = − 𝑥 𝐴. Similarly, at point 𝐵, 𝑑𝑥 | = − 𝑥 𝐵
holds and the absolute value of the slope is lower at point 𝐵 compared to 𝐴.
One of the features of a homogenous function is that the slope remains unchanged as we
move from one level curve to another along a given ray. While we do not provide a formal
proof of this here for a general homogenous function, it can be shown for our context in a
straightforward manner using Figure 3.31 Specifically, since points 𝐴 and 𝐶 both lie on the ray
𝑦𝐴 𝑦𝐶
𝑂𝑅, the slope of 𝑂𝐴 is equal to the slope of 𝑂𝐶; that is, 𝑥 𝐴 = 𝑥 𝐶. From (9) it then follows that
𝑑𝑦 𝐴 𝑑𝑦 𝐶
| = 𝑑𝑥 | , and the slopes of tangents are equal at 𝐴 and 𝐶 (slope of 𝑎𝑎 equals 𝑐𝑐). In fact,
𝑑𝑥
this property of slopes of level curves being invariant along a ray from the origin is termed
homotheticity and is true of a broader class of functions: homothetic functions.

Homothetic functions: If 𝑘 = 𝑓(𝑥1, 𝑥2 , … , 𝑥𝑛 ) is a homogenous function of any degree 𝑟, a


homothetic function is a composite function 𝐻 = ℎ(𝑘) = ℎ(𝑓(𝑥1, 𝑥2 , … , 𝑥𝑛 )), such that
ℎ′ (𝑘) ≠ 0 for any 𝑘.

Here ℎ′ (𝑘) is the derivative with respect to 𝑘. A homothetic function is a monotonic


transformation of a homogenous function. While the transformation can, in general, be
positive or negative, it is often useful to focus on the positive transformation where ℎ′ (𝑘) >
0, because this has the desirable property that a higher 𝑘 is associated with a higher 𝐻.
Though a homothetic function transforms a homogenous function, it is itself not
necessarily homogenous. The classic example of this is a log transformation. If we start with
𝑘 = 𝑥𝑦 (which is homogeneous of degree 2), 𝐻(𝑥, 𝑦) = log(𝑘) = log( 𝑥𝑦) is a homothetic
𝑑 log 𝑘
function since > 0. However, 𝐻 is not a homogenous function, because log(λ 𝑥 ×
𝑑𝑘
𝜆𝑦) ≠ 𝜆2 log(𝑥𝑦). Nevertheless, 𝐻 inherits the homotheticity property. This is because at any
arbitrary point the level curves of 𝐻(∙) function have exactly the same slope as the
corresponding level curve of 𝑓(∙) through that point. For example, consider the two-
independent variable case, where 𝑘 = 𝑓(𝑥, 𝑦) is homogenous of degree 𝑟, and 𝐻(𝑥, 𝑦) =
𝑑𝑦 𝜕𝐻⁄𝜕𝑥
ℎ(𝑘) = ℎ(𝑓(𝑥, 𝑦)). The slope of the level curve of 𝐻(∙) at any point is 𝑑𝑥 | = − 𝜕𝐻⁄𝜕𝑦 , while
𝐻

31 The proof is standard in any text on introductory mathematical economics (for example, Silberberg, 1990).

20

Electronic copy available at: https://ssrn.com/abstract=3722714


𝑑𝑦 𝜕𝑓⁄𝜕𝑥
the slope of the level curve of the 𝑓(∙) function through that point is 𝑑𝑥 | = − 𝜕𝑓⁄𝜕𝑦 . To show
𝑓
that the slopes of the two level curves are the same:
𝑑𝑦 𝜕𝐻⁄𝜕𝑥 ℎ′ (𝑘) 𝜕𝑓⁄𝜕𝑥 𝜕𝑓⁄𝜕𝑥 𝑑𝑦
(10) | = − 𝜕𝐻⁄𝜕𝑦 = − ℎ′ (𝑘) 𝜕𝑓⁄𝜕𝑦 = − 𝜕𝑓⁄𝜕𝑦 = 𝑑𝑥 |
𝑑𝑥 𝐻 𝑓

The homotheticity property is useful because it tells us what happens to level curves if we
start with a CPMM with an exchange function 𝑥𝑦 = 𝑘 and transform it monotonically.
Another handy property of homogenous functions is Euler’s theorem, which we will find
useful in the next section for valuing a liquidity pool:32

Euler’s Theorem: Suppose 𝑓(𝑥1, 𝑥2 , … , 𝑥𝑛 ) is a homogenous function of degree 𝑟. Then:

𝜕𝑓 𝜕𝑓 𝜕𝑓
𝑥1 + 𝑥2 + ⋯ . 𝑥𝑛 = 𝑟𝑓(𝑥1, 𝑥2 , … , 𝑥𝑛 )
𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛

3.2 Arbitrage and price determination in a CPMM


We are now in a position to provide a simple graphical representation of much our
discussion on arbitrage and price determination. To do this, we can contextualize Figure 3 as
the exchange function of a CPMM. As before, we begin with the situation where 𝜏 = 0.
The price of 𝑋 in terms of 𝑌 is 𝑃𝑌/𝑋 ; graphically, for infinitesimal changes, this translates to
𝑑𝑦
the absolute value of the slope (− 𝑑𝑥 ). For any combination of reserves (𝑥, 𝑦), equation (9)
𝑑𝑦 𝑦
indicates that 𝑃𝑌/𝑋 = − 𝑑𝑥 = 𝑥 , which is essentially equation (1). So, consider point 𝐴 in
Figure 3 with pool reserves (𝑥 𝐴 , 𝑦 𝐴 ). 𝑃𝑌/𝑋 offered by the CPMM can be read off the diagram
in one of two equivalent ways: either as the absolute value of the slope of the tangent 𝑎𝑎 at
𝑑𝑦 𝐴 𝑦𝐴
𝐴 (− 𝑑𝑥 | ), or as the slope of the ray 𝑂𝐴 (𝑥 𝐴 ). Our view here is that an AMM is a black-box for
𝑦
converting inputs (token quantities) into outputs (prices). The equation 𝑃𝑌/𝑋 = 𝑥 links the
inputs in our black-box (𝑥 and 𝑦) to the output (𝑃𝑌/𝑋 ) using the exchange function 𝑘 = 𝑥𝑦.
Graphically, the output of the AMM is the slope of a level curve of the exchange function.
There are a couple of other issues about price determination in a CPMM that are worth
noting. First, the exchange function 𝑘 = 𝑥𝑦 is homogenous and the slopes of level curves are
the same along a ray from the origin. Since 𝑃𝑌/𝑋 is the absolute value of the slope, it follows
that all points (reserve pairs) on a specific ray from the origin will entail the same price. Thus,
returning to Figure 3, 𝑃𝑌/𝑋 is exactly the same at points 𝐴 (where 𝑘 = 𝑘 0 ) and 𝐶 (where 𝑘 =
𝑘1 ), and indeed at every point along the ray 𝑂𝑅, each of which falls on a different level curve.
Secondly, when the amount of a token, say 𝑥, approaches zero, the slope of the level curve
tends to infinity, and the token’s price tends to infinity. Consequently, the reserves of a token

32 The interested reader is referred to Silberberg (1990) or Chiang (1984) for a proof.

21

Electronic copy available at: https://ssrn.com/abstract=3722714


can never fall to zero due to trading activity as the level curves never intersect the axes.33
Next, we can see the price slippage that occurs with larger size transactions in Figure 3. At
point 𝐶, the slope of the tangent 𝑐𝑐 determines 𝑃𝑌/𝑋 when an infinitesimal amount 𝑋 is
traded. For a larger trade that moves the CPMM from 𝐶 to 𝐷, the price is given by the absolute
value of slope of the line 𝐶𝐷, which is larger than that of tangent 𝑐𝑐. Similarly, when 𝑋 is sold
by the trader, the absolute value slope of the slope of 𝐶𝐸 is less than that of 𝑐𝑐. It is readily
visualized that larger the transaction size, greater is the slippage that occurs.
Figure 3 also describes what happens if liquidity providers were to add tokens to the pool.
Starting from reserves (𝑥 𝐴 , 𝑦 𝐴 ), suppose liquidity providers add reserves in the same
∆𝑦 𝑦𝐴
proportion as the initial reserves, so that = 𝑥 𝐴. Adding liquidity in the same proportion
∆𝑥
𝑦𝐶 𝑦𝐴
implies that new reserves (𝑥 𝐶 , 𝑦 𝐶 ) satisfy 𝑥 𝐶 = 𝑥 𝐴; in other words, we move along ray 𝑂𝑅,
and prices are the same at the two points. Liquidity provision conducted in this manner
changes the level curve from 𝑘 0 to 𝑘1 without changing the price.
Consider now the process of two-point arbitrage, which is described in Figure 4 below.

𝑀
𝑦𝑀

𝑚 𝐴
𝐴 𝑎
𝑦
𝑎
𝑘0
𝑥
𝑂 𝑥𝑀 𝑥𝐴

Figure 4: Price and arbitrage in a CPMM with no transaction fees

33 Reserves can, of course, fall to zero if liquidity providers decide to withdraw their tokens.

22

Electronic copy available at: https://ssrn.com/abstract=3722714


Suppose the price of 𝑋 in the external reference market is 𝑀𝑌/𝑋 , where 𝑀𝑌/𝑋 > 𝑃𝑌/𝑋 . This
external market price is shown in Figure 4 by the point 𝑀 where the absolute value of the
slope of the tangent 𝑚𝑚 equals the external market price. If the reserve levels in the CPMM
𝑑𝑦 𝑀 𝑑𝑦 𝐴
is at point 𝐴, we have that 𝑀𝑌/𝑋 = − 𝑑𝑥 | > − 𝑑𝑥 | = 𝑃𝑌/𝑋 . This price differential triggers
two-point arbitrage with arbitrageurs buying 𝑋 from the CPMM and selling it in the external
market. The buying activity in the CPMM increases 𝑃𝑌/𝑋 (while the selling in the external
market can decrease 𝑀𝑌/𝑋 ), and the price in the CPMM will approach 𝑀, as shown by the
arrow in Figure 4. This process continues till the no-arbitrage condition in equation (4) is met
and 𝑀𝑌/𝑋 = 𝑃𝑌/𝑋 , which can occur anywhere between points 𝐴 and 𝑀. When the external
market is relatively large, the sale of 𝑋 in the external market may have little impact on 𝑀𝑌/𝑋 ;
in that case, 𝑃𝑌/𝑋 will settle at point 𝑀, with reserves (𝑥 𝑀 , 𝑦 𝑀 ). It is straightforward to
construct the reverse argument if 𝑀𝑌/𝑋 < 𝑃𝑌/𝑋 and the starting point is point 𝐵.
Now suppose there is a trading fee, 𝜏. To examine this, we summarize the analytical
procedure described in Angeris et al (2019) for deriving the bounds of arbitrage. Suppose we
start with reserves (𝑥 0 , 𝑦 0 ), and 𝑘 0 = 𝑥 0 𝑦 0. In the absence of trading fees, the price would
𝑦0
be 𝑃𝑌/𝑋 = , irrespective of whether a trader wished to buy or sell 𝑋. The two-step process
𝑥0
followed by Uniswap for price changes with a fee is described in detail in Section 2.1; we
replicate that process analytically, assuming that it holds for any arbitrary CPMM.34
To begin with, assume that a trader wishes to sell 𝑋 to the CPMM in exchange for 𝑌. If the
trader sells an amount ∆𝑥, the AMM retains 𝜏∆𝑥, and the remainder (1 − 𝜏)∆𝑥 = 𝜙∆𝑥 is
available for the trade, which occurs utilizing the initial value of the constant, 𝑘 0 . If the trader
receives ∆𝑦 in return, we get:

(11) (𝑥 0 + 𝜙∆𝑥)(𝑦 0 + Δ𝑦) = 𝑘 0

Since the liquidity pool receives 𝑋, we have that ∆𝑥 > 0, from which it follows that ∆𝑦 < 0.
∆𝑦 𝜙𝑦 0
Simplifying, we get that = − 𝑥 0+𝜙∆𝑥. When changes are infinitesimal, this reduces to
∆𝑥
𝑑𝑦 ∆𝑦 𝑦0 𝑏 𝑑𝑦
𝑑𝑥
= lim = −𝜙 𝑥 0 . As 𝑝𝑌/𝑋 = − 𝑑𝑥 in this case, we get the bid-price as:
∆𝑥→0 ∆𝑥

𝑏 𝑦0
(12) 𝑝𝑌/𝑋 = 𝜙 𝑥0

Similar arguments when the trader buys 𝑋 from the CPMM (Δ𝑦 > 0) yields an ask-price of:

𝑎 1 𝑦0
(13) 𝑝𝑌/𝑋 = 𝜙 𝑥0

𝑏 𝑎 𝑦0
Given that that 𝜙 < 1, it is evident that 𝑝𝑌/𝑋 < 𝑃𝑌/𝑋 < 𝑝𝑌/𝑋 , where 𝑃𝑌/𝑋 = 𝑥 0.

34Other CPMMs may adopt different procedures. However, the broad ideas that follow from homotheticity and
so on described in this paper will not change due to small procedural changes.

23

Electronic copy available at: https://ssrn.com/abstract=3722714


Figure 5 below shows the bid and offer rate graphically. The reserves are depicted by
𝑦0
point 𝑃, and the slope of ray 𝑂𝑃 is 𝑥 0 = 𝑃𝑋/𝑌 . This point lies on the level curve 𝑘 0 . The slope
𝑦0 𝑏
of the ray 𝑂𝐵 is 𝜙 𝑥 0 = 𝑝𝑌/𝑋 ; we can visually associate point 𝐵, therefore, with the bid-price.
1 𝑦0 𝑎
Similarly, the slope of 𝑂𝐴 is 𝜙 𝑥 0 = 𝑝𝑌/𝑋 , and point 𝐴 is associated with the ask-price.

𝑀′′

𝑃
𝑦0
𝑀
𝐵
𝑀′ 𝑘1

𝑘0
𝑥
𝑂 𝑥0

Figure 5: Price and arbitrage in a CPMM with transaction fees

To bring in the idea of arbitrage in Figure 5, suppose the external market price is 𝑀𝑌/𝑋 .
This is represented by a point 𝑀, which (uniquely on curve 𝑘 0 ) satisfies the condition that the
slope of 𝑂𝑀 = 𝑀𝑌/𝑋 . In this particular instance, 𝑀 lies within the arc 𝐴𝐵. As the slope of 𝑂𝑀
𝑏 𝑎
is greater than that of 𝑂𝐵, but less than that of 𝑂𝐴, we have that 𝑝𝑌/𝑋 ≤ 𝑀𝑌/𝑋 ≤ 𝑝𝑌/𝑋 holds
at point 𝑀. This is, of course, nothing but the no-arbitrage condition in equation (5). This
inequality is true for any point we select in the arc 𝐴𝐵; thus, this arc corresponds to equation
(5) as the range where arbitrage is not feasible. It is evident that the range widens (and the
𝑏 𝑦0 𝑎 1 𝑦0
arc 𝐴𝐵 becomes longer) the greater the value 𝜏 takes, since 𝑝𝑌/𝑋 =𝜙 0 and 𝑝𝑌/𝑋 = . This
𝑥 𝜙 𝑥0
goes back to the point made earlier: larger transaction costs curtail arbitrage.
𝑏
If we consider a point outside arc 𝐴𝐵, such as point 𝑀′ , where 𝑝𝑌/𝑋 > 𝑀𝑌/𝑋 , then

24

Electronic copy available at: https://ssrn.com/abstract=3722714


arbitrageurs can buy 𝑋 in the external market and sell it in the CPMM to make profits. This
sale of 𝑋 to the CPMM will drive point 𝑃 to the right, and the arc 𝐴𝐵 along with it, till
𝑏
𝑝𝑌/𝑋 = 𝑀𝑌/𝑋 . Similar arguments in the reverse direction hold if 𝑀𝑌/𝑋 is represented by 𝑀′′ .
The second step of the exchange process in Uniswap-v1 and v2 is that the fees are added
to generate a new value of 𝑘 that satisfies 𝑘1 = (𝑥 0 + ∆𝑥)(𝑦 0 + Δ𝑦) = 𝑥 1 𝑦 1. In the case
where 𝑋 is sold to the CPMM, for example, 𝜏∆𝑥 is added to the pool reserves, which causes
a rightward shift of the level curve to 𝑘1 . The starting point for the next trade is then a reserve
𝑦1
pair (𝑥 1 , 𝑦 1 ) on 𝑘1 , which has a no-trading fee price of 𝑃𝑋/𝑌 = 𝑥 1 and a corresponding bid-
ask spread as derived earlier.

3.3 Valuing a liquidity pool and a CPMM: Uniswap-v1 and v2


Consider a specific liquidity pool with tokens 𝑋 and 𝑌 in CPMM-v1 or v2. There are
circumstances where one may wish to value the liquidity pool. Since 𝑥 and 𝑦 are different
tokens, they have to be brought to the same unit of account before their values can be added.
Let us suppose that 𝑋 (ETH) is the unit of account in the 𝑋 − 𝑌 pool. One way to value the
liquidity pool is then 𝑉𝑋,𝑌 = 𝑥 + 𝑃𝑋/𝑌 𝑦.35 This converts 𝑌 to an equivalent amount of 𝑋 using
𝑥 𝑥
𝑃𝑋/𝑌 = 𝑦. Substituting 𝑃𝑋/𝑌 = 𝑦, it follows that:

(14) 𝑉𝑋,𝑌 = 2𝑥

Equation (14) states that in order to value a liquidity pool that has ETH in it, one simply needs
to double the amount of ETH in the pool. An implication of equation (14) is that the valuation
of a pool is independent of the price 𝑃𝑋/𝑌 at which 𝑋 and 𝑌 trade and, indeed, independent
of the value of 𝑘. This is shown in Figure 6 below. All three points, 𝐴, 𝐵 and 𝐶 have a valuation
of 2𝑥 0 , even though they lie on different level curves and are associated with different prices.
On the other hand, even though 𝐶, 𝐷 and 𝐸 have the same prices (they are on the same ray
from the origin), the liquidity pool has different valuations at these points, with the valuation
at 𝐶 being the highest as it has the highest amount of 𝑋.

35 See also Angeris et al (2019) and Angeris and Chitra (2020), who address the issue of pool valuation.

25

Electronic copy available at: https://ssrn.com/abstract=3722714


𝑦

𝐶
𝐷

𝐸 𝐵

𝑘2
𝐴
𝑘1

𝑘0
𝑥
𝑂 𝑥0

Figure 6: Liquidity pool valuation

This is, of course, not a unique way of valuing the pool. With trading fees and a bid-ask
𝑎 𝑏
𝑝𝑋/𝑌 +𝑝𝑋/𝑌 (1+𝜙 2 ) 𝑥
spread one may wish to use the mid-rate 𝑝̃𝑋/𝑌 = = (from equations (12),
2 2𝜙 𝑦

(13) and (3)) to value the pool. However, the mid-rate is a function of 𝜙, which implies that
the pool valuation using 𝑝̃𝑋/𝑌 to convert units of 𝑌 to 𝑋 would be sensitive to the fees.
Whether this is desirable or not depends on the context. The pool valuation in this case is:
(1+𝜙) 2
(15) 𝑉̃𝑋,𝑌 = 𝑥 + 𝑝̃𝑋/𝑌 𝑦 = 2𝜙 𝑥

In the extreme case where there are no trading fees, 𝜙 = 1 and it is evident that 𝑉̃𝑋,𝑌 = 𝑉𝑋,𝑌 .
𝑑 (1+𝜙)2
Moreover, as ( ) < 0, 𝑉̃𝑋,𝑌 falls as 𝜙 rises. This implies that as fees fall, the pool
𝑑𝜙 2𝜙
valuation decreases as well. This makes intuitive sense if one were to value the pool from the
perspective of liquidity providers. Lower fees signal lower returns to pool providers, and 𝑉̃𝑋,𝑌
is lower as well. Thus, whether one wishes to use (14) or (15) depends on the perspective one
takes. The valuation 𝑉𝑋,𝑌 is preferable if one looks at the liquidity pool as a whole. On the

26

Electronic copy available at: https://ssrn.com/abstract=3722714


other hand, if the focus is on liquidity providers, then 𝑉̃𝑋,𝑌 is a candidate for pool valuation.
One can generalize equation (14) to a broader class of functions where 𝑘 = 𝑓(𝑥, 𝑦) =
𝑥 𝛼 𝑦 𝛽 , with 𝛼, 𝛽 > 0. The 𝑘 = 𝑥𝑦 function is simply a special case of this where 𝛼 = 𝛽 = 1.
Using Euler’s theorem from Section 3.1 for this case, we have that:
𝜕𝑓⁄𝜕𝑦 𝑟𝑓(𝑥,𝑦)
(16) 𝑥 + ( 𝜕𝑓⁄𝜕𝑥 ) 𝑦 = 𝜕𝑓⁄𝜕𝑥

𝜕𝑓⁄𝜕𝑦 𝑑𝑥 𝜕𝑓⁄𝜕𝑦
Since ( 𝜕𝑓⁄𝜕𝑥 ) = − 𝑑𝑦, it follows that 𝑃𝑋/𝑌 = ( 𝜕𝑓⁄𝜕𝑥 ).36 The left-hand side of equation (16) is,
𝜕𝑓
therefore, nothing but 𝑉𝑋,𝑌 . For the right-hand side, using 𝑓(𝑥, 𝑦) = 𝑥 𝛼 𝑦 𝛽 , = 𝛼𝑥 𝛼−1 𝑦 𝛽 ,
𝜕𝑥
and 𝑟 = (𝛼 + 𝛽), equation (16) reduces to:
𝛼+𝛽
(17) 𝑉𝑋,𝑌 = ( )𝑥
𝛼

Comparing (17) with (14), we see that the former collapses to the latter whenever 𝛼 = 𝛽. So,
doubling the amount of 𝑋 (ETH) in a liquidity pool to value a liquidity pool is a valid technique
for all AMMs that attach equal weights to 𝑋 and 𝑌 in the 𝑘 = 𝑥 𝛼 𝑦 𝛽 function, and is not limited
to the specific exchange function used by Uniswap. For this general class of exchange
functions, even when 𝛼 ≠ 𝛽, the pool valuation depends only on 𝑥 and some constant factor
𝛼+𝛽
( ).37 It is also worth noting that the share of value of 𝑋 to the value of the pool is 𝑥/𝑉𝑋,𝑌 ,
𝛼
𝛼
which equals 𝛼+𝛽 and is fixed once the parameters 𝛼 and 𝛽 are fixed.38 Similarly, the share of
𝛽
𝑌 is 𝑃𝑋/𝑌 𝑦/𝑉𝑋,𝑌 = 𝛼+𝛽 . When 𝛼 = 𝛽, each token’s share of the total pool value is ½.
Now suppose we would like to value an entire CPMM operating with an exchange function
𝑘 = 𝑥𝑦 across all liquidity pools that exist on the platform. In a CPMM-v1, as outlined earlier,
all liquidity pools have ETH as a common token. If there are 𝑛 liquidity pools, each of which
has 𝑋 as token, along with another token, 𝑌𝑖 , 𝑖 ∈ {1,2,3, … 𝑛}. The 𝑛 liquidity pools yield a set
of reserves: {(𝑥1 , 𝑦1 ), (𝑥1, 𝑦1 ) … (𝑥𝑛 , 𝑦𝑛 )}, where 𝑥𝑖 is the amount of 𝑋 (ETH) in the liquidity
pool with token 𝑌𝑖 . From (14), each liquidity pool has a valuation 𝑉𝑋,𝑌𝑖 = 2𝑥𝑖 , ∀𝑖 ∈
{1,2,3, … 𝑛}. This allows a simple method to value the entire CPMM-v1:

(18) 𝑉𝐶𝑃𝑀𝑀−𝑣1 = ∑𝑛𝑖=1 𝑉𝑋,𝑌𝑖 = 2 ∑𝑛𝑖=1 𝑥𝑖

Equation (18) states that to value a CPMM-v1 with the exchange function 𝑘 = 𝑥𝑦, one needs
to simply add all the ETH cross the various liquidity pools on the platform and double it.
Valuing CPMM-v2 is slightly more complicated, because there are liquidity pools available

36 𝛽𝑥
It is evident that 𝑃𝑋/𝑌 = 𝛼 𝑦 in this case.
(1+𝜙 2) 𝛽 (1+𝜙2) 𝛽
37 For the alternative 𝑉̃𝑋,𝑌 , we have 𝑉̃𝑋,𝑌 = 𝑥 + 𝑝̃𝑋/𝑌 𝑦 = 𝑥 + 𝑥 = (1 + )𝑥.
2𝜙 𝛼 2𝜙 𝛼
38Later on, in Section 4.1, we show that other types of AMMs, such as a Constant Mean Market Maker, also
have a similar property of fixed shares of value.

27

Electronic copy available at: https://ssrn.com/abstract=3722714


that do not involve ETH. So apart from the 𝑛 original liquidity pools with reserves
{(𝑥1, 𝑦1 ), (𝑥1, 𝑦1 ) … (𝑥𝑛 , 𝑦𝑛 )} that were available in CPMM-v1, CPMM-v2 allows for an
𝑛(𝑛−1)
additional liquidity pools between tokens 𝑌𝑖 and 𝑌𝑗 , ∀𝑖, 𝑗 ∈ {1,2, … 𝑛}, 𝑖 ≠ 𝑗. In terms
2
of notation, let 𝑦𝑖𝑗 denote the quantity of 𝑌𝑖 in a 𝑌𝑖 − 𝑌𝑗 liquidity pool. To value a liquidity pool
with 𝑌𝑖 and 𝑌𝑗 , we would first to pick a pricing token (say 𝑌𝑖 ); it follows from a parallel to
equation (14) that 𝑉𝑌𝑖 ,𝑌𝑗 = 2𝑦𝑖𝑗 . However, this is denominated in units of token 𝑌𝑖 ; to convert
this to units of 𝑋 (ETH), so that there exists a common unit of account to value different pools,
𝑥
we can use the price 𝑃𝑋/𝑌𝑖 = 𝑦𝑖 generated by the reserves (𝑥𝑖 , 𝑦𝑖 ) in the 𝑋 − 𝑌𝑖 liquidity pool.
𝑖
𝑥
Thus, we get 𝑉𝑌′𝑖 ,𝑌𝑗 = 𝑉𝑌𝑖 ,𝑌𝑗 × 𝑃𝑋/𝑌𝑖 = 2 𝑦𝑖 𝑦𝑖𝑗 , which is denominated in 𝑋.
𝑖

Suppose we use an indicator 𝑑𝑖𝑗 = 1 if 𝑌𝑖 is used as the pricing token in the pool with 𝑌𝑗
and 𝑑𝑖𝑗 = 0 if it is not. The value of all pools 𝑌𝑖 − 𝑌𝑗 that uses 𝑌𝑖 as the pricing currency, but
denominated in units of 𝑋 is 𝑉𝑌′𝑖 = 2𝑃𝑋/𝑌𝑖 ∑𝑗≠𝑖 𝑑𝑖𝑗 𝑦𝑖𝑗 . The total value of the CPMM-v2 is then:
𝑥
(19) 𝑉𝐶𝑃𝑀𝑀−𝑣2 = ∑𝑛𝑖=1[2𝑃𝑋/𝑌𝑖 ∑𝑗≠𝑖 𝑑𝑖𝑗 𝑦𝑖𝑗 ] + 2 ∑𝑛𝑖=1 𝑥𝑖 , where 𝑃𝑋/𝑌𝑖 = 𝑦𝑖
𝑖

The second term in (19) corresponds to equation (18), and refers to the value of all pools that
involve 𝑋. The first term adds the values of all 𝑌𝑖 − 𝑌𝑗 pools after denominating them in 𝑋.

3.4 Measuring liquidity in a CPMM


3.4.1 Interpreting 𝑘
How exactly is one to interpret the economic meaning of 𝑘 in the exchange function 𝑘 =
𝑓(𝑥1, 𝑥2 , … , 𝑥𝑛 )? In consumer theory, 𝑘 is interpreted as the level of utility, while in
production theory, it is the quantity of goods and services produced. In an AMM, the ‘output’
is the price of one token in terms of the other, which is slope of the level curves of 𝑓(. ); this
corresponds to the marginal rate of substitution in consumer theory and to the marginal rate
of technical substitution in production theory. There is no direct economic significance of 𝑘
that is apparent when calculating these slopes in the context of AMMs.39
Geometrically, we can associate a value of 𝑘 with a level curve generated by the exchange
function, as we have done in Figure 3. This affords the most satisfactory interpretation that
one can ascribe to 𝑘 - as an ordinal measure of liquidity, in much the same way as utility serves
as an ordinal measure of satisfaction in consumer theory. Viewed in this way, we can think of
the level curves of the exchange function as ‘isoliquidity’ curves.
Thus, if 𝑘1 > 𝑘 0 in a given liquidity pool, it is intuitive to infer that the liquidity level at 𝑘1
is higher than the liquidity level at 𝑘 0 because, starting at any point on 𝑘 0 , the injection of

39
Alternatively, in the case where, 𝑘 = 𝑥𝑦, as in Figure 3, we can think of 𝑘 geometrically as the area of the
rectangle associated with a point; thus at point 𝐴 in Figure 3, we have that Area(𝑂𝑥 𝐴 𝐴𝑦 𝐴 ) = 𝑘 0 . However, the
dimension of the area is units of 𝑋 × units of 𝑌, which has little economic meaning as well.

28

Electronic copy available at: https://ssrn.com/abstract=3722714


tokens by liquidity providers will move the reserves to a higher level curve like 𝑘1 . This
provides a valid way of comparing the liquidity levels provided by any two arbitrary reserve
token pairs (𝑥 0 , 𝑦 0 ) and (𝑥 1 , 𝑦 1 ) in a liquidity pool even if, say, 𝑥 0 < 𝑥 1 but 𝑦 0 > 𝑦 1; (𝑥 1 , 𝑦 1 )
can be said to provide a higher level of liquidity if 𝑥 1 𝑦 1 = 𝑘1 > 𝑘 0 = 𝑥 0 𝑦 0.
The nature of the concept of liquidity as defined here suggests that inter-pool comparisons
of 𝑘 are meaningless. So, if we have two liquidity pools with different tokens and calculate
that 𝑥 1 𝑦 1 = 𝑘1 > 𝑘 0 = 𝑥 0 𝑧 0, we cannot conclude that the 𝑋 − 𝑍 pool has a lower level of
liquidity than the 𝑋 − 𝑌 pool. Essentially, the numbers 𝑘1 and 𝑘 0 are not comparable in this
instance because their units of measurement are different.

3.4.2 Liquidity in a CPMM


While the parameter 𝑘 is a measure of liquidity in a pool, it has a few problems, arising
from the fact the function 𝑘 = 𝑥𝑦 is homogeneous of degree two. To see the implications of
this, suppose one liquidity provider doubles the amount of tokens in the pool. The new value
of the invariant is 4𝑥𝑦 = 4𝑘; in other words, the invariant has quadrupled even though
‘liquidity’ has, for all practical purposes, only doubled due to the doubling of token volume.
This is particularly problematic in CPMM-v1 and CPMM-v2, where fungible ERC-20 liquidity
tokens are issued. If these tokens are issued one-to-one with the value of 𝑘, by doubling the
tokens the liquidity provider in this example would have received 75% of the liquidity tokens
in circulation, even though the provider has accounted for only half the tokens.
To quantify liquidity in general, and to keep track of liquidity tokens in particular, a better
measure would involve using a function that is homogenous of degree 1. To that end, suppose
1 1
we define 𝐿 = √𝑘 = 𝑥 2 𝑦 2. Now, if a liquidity provider, for example, doubles both tokens, the
value of 𝐿 also doubles. Indeed, we can generalize the benefits of utilizing 𝐿 to measure
liquidity even for small additions to the liquidity pool. As shown in Section 2.3, in order for
𝑑𝑦 𝑑𝑥
liquidity provision not to change price in CPMM-v1 and v2, the condition = holds. It is
𝑦 𝑥
𝑑𝐿 𝑑𝑥
readily seen that = also holds,40 implying that the percentage change in 𝐿 equals the
𝐿 𝑥
percentage change in either token. If 𝑋 is ETH, then CPMM-v1 and v2 can distribute new
𝑑𝑥
liquidity tokens based on changes in 𝐿; specifically, 𝑑𝐿 = 𝑥
× 𝐿 (or its discrete counterpart,
∆𝑥
∆𝐿 = × 𝐿). Consequently, 𝐿 serves as a better measure of liquidity in CPMMs.
𝑥

3.5 Competing interests in an AMM and the efficiency-liquidity provision trade-off


Liquidity providers act as the counterparty to all trading activity on an AMM. In this section
we explore a number of issues related to liquidity provision and the conflicts of interests that

1 1 𝑑𝐿 1 𝑑𝑥 1 𝑑𝑦 𝑑𝑦 𝑑𝑥 𝑑𝐿 𝑑𝑥
40 Taking log of 𝐿 = 𝑥 2 𝑦 2 and differentiating yields =2 +2 . Since = , it follows that = .
𝐿 𝑥 𝑦 𝑦 𝑥 𝐿 𝑥

29

Electronic copy available at: https://ssrn.com/abstract=3722714


can arise in this context. In order to do so, we keep track of four types of agents who
participate in an AMM: liquidity providers, traders interested in swapping assets,
arbitrageurs, and attackers who exploit the system. While we approach this in the context of
a CPMM, the general principles hold for other types of AMMs, even if specifics may vary.
Consider traders to begin with. Liquidity providers earn returns as fees from transactions
with traders, even if there were no movements in the external market price. Clearly, traders
would prefer the trading fee to be as little as possible. From the point of view of a liquidity
provider, a higher fee yields higher returns per trade, but discourages trading activity. To
characterize this trade-off in a simple manner, suppose 𝑣(𝜏) is the (average) value of tokens
transacted by traders on the AMM (denominated in a numeraire, say 𝑋) over a given period
of time, where 𝜏 is the ad valorem fee. Since higher fees reduce trading activity, it is
𝑑𝑣
reasonable to suppose that 𝑑𝜏 < 0. Assuming liquidity provision costs are normalized to zero,
the profits that liquidity providers get from traders is 𝜏𝑣(𝜏). To maximize this, liquidity
𝑑𝑣(𝜏∗ )
𝜏∗ 𝑑𝜏

providers would set the optimum fee, 𝜏 , which satisfies the first order condition =
𝑣(𝜏∗ )

−1. In terms of interaction with traders, the AMM essentially provides a service, and the
optimum fees from the point of view of liquidity providers balances the trade-offs between
the price of the service (𝜏) and the demand for the service (𝑣(𝜏)).
However, liquidity providers also have to contend with arbitrageurs. In Figure 5, traders
will participate even when the external market price lies within the arc 𝐴𝐵, but arbitrage is
not profitable in that range. When the external market price moves beyond 𝐴𝐵, arbitrageurs
are vital for AMMs such as Uniswap to achieve an alignment between the AMM price and the
external market price. If trading fees are increased to favor liquidity providers, the arc 𝐴𝐵
widens, which discourages arbitrage over a wider range of prices. This indicates an intuitive
trade-off between efficiency in terms of price alignment with external markets, and the
incentives for liquidity provision.
It is worthwhile exploring further how external market price movements and the resultant
arbitrage activities affect liquidity providers. To do so, we assume that there are no traders,
so that there is only interaction between liquidity providers and arbitrageurs. To begin with,
consider the case where 𝜏 = 0; Figure 4 serves as a visual reference. One way to measure the
performance of liquidity provision is to compare it to a situation when the same assets are
held in the external market. Essentially, this is the opportunity cost of placing the tokens in
the CPMM, assuming that the next best alternative is holding it in an external wallet.
0 0
At the initial equilibrium when 𝑃𝑌/𝑋 = 𝑀𝑌/𝑋 (say point 𝐴 in Figure 4), the reserves in a
CPMM are (𝑥 0 , 𝑦 0 ). Using the external price to value assets, the value of tokens in the CPMM
0
liquidity pool (measured in units of 𝑌) is 𝑣𝐶0 = 𝑦 0 + 𝑀𝑌/𝑋 𝑥 0 , which equals the value in the
1
external market, 𝑣𝐸0 . Now suppose the price in the external market were to change to 𝑀𝑌/𝑋 >

30

Electronic copy available at: https://ssrn.com/abstract=3722714


0
𝑀𝑌/𝑋 (say point 𝑀 in Figure 4). Arbitrage implies that we move from point 𝐴 to 𝑀, so that
1 1
𝑃𝑌/𝑋 = 𝑀𝑌/𝑋 and new CPMM reserves are (𝑥 1 , 𝑦 1 ). The values of the tokens in the two cases
1 1 1 1
are now 𝑣𝐶1 = 𝑦 1 + 𝑀𝑌/𝑋 𝑥 1 and 𝑣𝐸1 = 𝑦 0 + 𝑀𝑌/𝑋 𝑥 0. Even though 𝑃𝑌/𝑋 = 𝑀𝑌/𝑋 , the values
1
are different because the CPMM has rebalanced to ensure that 𝑦 1 = 𝑃𝑌/𝑋 𝑥 1 , whereas no
such automatic rebalancing occurs in the external market. Since the arbitrage activity implies
that CPMM liquidity providers are holding less of the token that is gaining value (𝑋 in this
1 1
𝑀𝑌/𝑋 𝑃𝑌/𝑋
case), it is intuitive that 𝑣𝐶1 < 𝑣𝐸1 will hold. Letting 𝜃 = 0 = 0 , the percentage difference
𝑀𝑌/𝑋 𝑃𝑌/𝑋

in the CPMM pool value relative to the external market value when there are no fees is: 41
𝑣𝐶1 −𝑣𝐸1 2√𝜃
(20) 𝐼 (𝜃 ) = = 1+𝜃 − 1
𝑣𝐸1

Since 2√𝜃 < (1 + 𝜃), we have that 𝐼 (𝜃) < 0, and liquidity providers suffer a loss in value
relative to holding a non-rebalanced portfolio in the external market. Moreover, as this
inequality holds for any price ratio 𝜃, the movement in the reverse direction (where say the
change is from point 𝐵 to 𝑀 in Figure 4) also yields similar results. In the DeFi community,
𝐼(𝜃) is referred to as impermanent loss or divergence loss, because this is an unrealized loss
0
relative to the external market; if the price were to revert to 𝑀𝑌/𝑋 again, we would have that
𝑣𝐶0 = 𝑣𝐸0 , and the loss disappears. As this primarily reflects the impact of rebalancing in the
CPMM, one could relabel this as a rebalancing cost.
Adding fees moves the analysis from Figure 4 to Figure 5, which introduces additional
features: first, there exists a range (the arc 𝐴𝐵) where no arbitrage takes place; and second,
𝑏 𝑎 1
there are multiple prices in the CPMM (𝑃𝑌/𝑋 , 𝑝𝑌/𝑋 = 𝜙𝑃𝑌/𝑋 and 𝑝𝑌/𝑋 = 𝜙 𝑃𝑌/𝑋 ). To see how
0
these features play out, suppose the initial equilibrium is at point 𝑃 in Figure 5, so that 𝑀𝑌/𝑋 =
1
𝑃𝑌/𝑋 . Now, if the external price reduces to 𝑀𝑌/𝑋 equal to slope of ray 𝑂𝑀, no arbitrage is
triggered and the CPMM reserve assets continue to be located at 𝑃. In this case no
rebalancing occurs, and the valuation exercise is trivial: if the same price is used for valuing
assets in both cases, there is no difference in the valuation of tokens.
Things become more meaningful once we reach the boundaries of the arc 𝐴𝐵. Suppose
0 𝑏0
the initial equilibrium is at 𝐵, where 𝑀𝑌/𝑋 = 𝑝𝑌/𝑋 . Now, a small fall in the external price to
1 0 𝑏1 1
𝑀𝑌/𝑋 < 𝑀𝑌/𝑋 (point 𝑀′ ) will trigger arbitrage till the new bid price satisfies 𝑝𝑌/𝑋 = 𝑀𝑌/𝑋 .42

41 𝑦
See Pintail (2019) for this formula, along with examples. Formally, from the relationships 𝑥𝑦 = 𝑘 and =
𝑥
𝑘
𝑃𝑌/𝑋 , we have that 𝑥 = √𝑃 and 𝑦 = √𝑘𝑃𝑌/𝑋 . This holds both before and after the price change, along with
𝑌/𝑋

the fact that 𝑀𝑌/𝑋 = 𝑃𝑌/𝑋 at equilibrium. So, 𝑣1𝐶 = 2√𝜃𝑘𝑃0𝑌/𝑋 and 𝑣𝐸1 = (1 + 𝜃)√𝑘𝑃𝑌/𝑋
0
; it follows that 𝐼(𝜃) =
2√𝜃
− 1. See Xu et al (2021) for calculations for other types of AMMs.
1+𝜃
42 We assume that the external market is large enough that arbitrage with the CPMM does not affect 𝑀𝑌/𝑋 .

31

Electronic copy available at: https://ssrn.com/abstract=3722714


On the other hand, a small rise in price will not result in arbitrage, as we return to the interior
𝑏1
𝑀1 𝑝𝑌/𝑋
of arc 𝐴𝐵.43 Consequently, the useful case to examine is 𝜃 = 𝑀𝑌/𝑋
0 = 𝑏0 < 1. The valuations
𝑌/𝑋 𝑝𝑌/𝑋
1 1 1 𝑏1
are now 𝑣𝐶1 = 𝑦 1 + 𝑀𝑌/𝑋 𝑥 1 and 𝑣𝐸1 = 𝑦 0 + 𝑀𝑌/𝑋 𝑥 0, where 𝑀𝑌/𝑋 = 𝑝𝑌/𝑋 , and so: 44

𝑣𝐶1 −𝑣𝐸1 √𝜃(1+𝜙)


(21) 𝐼(𝜃, 𝜙) = = −1
𝑣𝐸1 1+𝜃𝜙

1
It follows that 𝐼(𝜃, 𝜙) < 0 when 𝜃 < 𝜙2 , which must hold when 𝜃 < 1. As a result, fees do
not alter the fact that rebalancing costs exist beyond the range of the spread. A similar
0 𝑎0 𝑣𝐶1 −𝑣𝐸1 √𝜃(1+𝜙)
analysis occurs when 𝑀𝑌/𝑋 = 𝑝𝑌/𝑋 and 𝜃 > 1; in this case 𝐼(𝜃, 𝜙) = = − 1.45
𝑣𝐸1 𝜙+𝜃

Our comparative static analysis suggests that the costs of rebalancing are inevitable, and
liquidity providers must depend on fees from users to outweigh this. However, this does not
factor in how price movements impact the compounding of wealth over time. Tassy and
White (2020) show that, under certain circumstances, rebalancing is useful to minimize the
negative effect of losses on compounding. In this scenario, it can be optimal to set the fees as
low as possible (without being zero), thereby taking advantage of rebalancing when prices
are volatile around a narrow spread.46 While this presents some preliminary insights into the
dynamics in a specialized circumstance, there is more work to be done in this area.
Fees can impact the security of the system in terms exploits, such as a sandwich attack. 47
A sandwich attack involves both front-running and back-running a transaction. Suppose a
trader places an order to sell 𝑌 and buy 𝑋. Upon seeing the (public) order, an attacker can
𝑎0
front-run the transaction by buying 𝑋 at the offer price ( 𝑝𝑌/𝑋 ), thereby driving up the price
of 𝑋. The trader’s original transaction drives the price even higher,48 and the attack is then
𝑏1
completed with a back-run sale of 𝑋 by the attacker at a new bid price 𝑝𝑌/𝑋 ; the profit of the
𝑏1 𝑎0 1 0 1
attacker is 𝑝𝑌/𝑋 − 𝑝𝑌/𝑋 . For (no-fee) prices 𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 , the profit equals 𝜙𝑃𝑌/𝑋 −
1 0
𝑃𝑌/𝑋 , which is decreasing in the trading fee 𝜏. A higher trading fee can, therefore, reduce
𝜙

43A large increase in price, of course, can trigger arbitrage if the new price is higher than slope 𝑂𝐴. But recalling
that these price formulas are for small changes, we focus on this case.
44 There are now three relationships we work with: 𝑏 𝑦 𝜙𝑘
𝑝𝑌/𝑋 = 𝜙𝑃𝑌/𝑋, 𝑃𝑌/𝑋 = 𝑥 and 𝑥𝑦 = 𝑘. These yield 𝑥 = √ 𝑏
𝑝𝑌/𝑋

𝑏
𝑘 𝑝𝑌/𝑋
and 𝑦 = √ , which hold both before and after the price change. The valuations are then 𝑣1𝐶 =
𝜙

1+𝜙 1+𝜃𝜙 𝑣𝐶1−𝑣𝐸1 √𝜃(1+𝜙)


( )√𝜃𝑘 𝑝𝑏0 and 𝑣𝐸1 = ( 𝑏0
)√𝑘 𝑝𝑌/𝑋 . It follows that 𝐼(𝜃) = = − 1.
√𝜙 𝑌/𝑋 √𝜙 𝑣𝐸1 1+𝜃𝜙

√𝜃(1+𝜙)
45 We have that < 1 when 𝜃 > 𝜙 2 , which must be true for the relevant range where 𝜃 > 1.
𝜙+𝜃
46 See White et al (2020) for an intuitive description of these ideas.
47 See Zhou et al (2020) for a deeper analysis of sandwich attacks.See also Buterin (2018) for an early exploration.
48 As a practical matter, the exact amount by which price changes depends on the extent of the slippage; see

Zhou et al (2020).

32

Electronic copy available at: https://ssrn.com/abstract=3722714


the incentives for such attacks and favor traders whose transactions are sandwiched (though
the higher fees increase the spread, which affects traders adversely).
Intuition suggests that the nature of the tokens being traded is also important when
determining fees. As such, tokens with low volatility and stable relative prices (for example,
correlated token pairs) can afford a lower width of the arc 𝐴𝐵 (that is, lower fees) in Figure 5
compared to more volatile assets. The low fees encourage more trading activity in low-
volatility tokens, while the price stability minimizes the need for rebalancing due to arbitrage
activity, even with a low spread. On the other hand, for tokens that exhibit larger relative
price movement, a narrow arc 𝐴𝐵 would result in frequent arbitrage and rebalancing. In that
circumstance, it may be worthwhile to impose higher fees.49
The design of AMM fees must attempt to balance all these interests. Higher trading fees
benefit liquidity providers and reduce exploits, but discourage trading and arbitrage, thereby
reducing efficiency. Lower fees have a reverse effect. Overall, the design of optimum fees for
an AMM is complicated and would have to weigh all these trade-offs. Current research has,
in general, focussed on the optimizing fees for a single entity (typically, liquidity providers, as
in Tassy and White, 2020). As such, this is an ongoing research endeavour.

4. Other types of AMMs for decentralized exchanges


In this section, we introduce other types of AMMs. While these are not covered in nearly
the same detail as the CPMM, many of the techniques and insights from Sections 2 and 3
carry over here, so that they can be extrapolated in a straightforward way.

4.1 Constant Mean Market Makers (CMMM)


A constant mean market maker (CMMM) has reserves (𝑥1 , 𝑥2 , … 𝑥𝑛 ) of 𝑛 tokens
𝑋1 , 𝑋2 , … 𝑋𝑛 that satisfy the exchange function:

(22) ∏𝑛𝑖=1 𝑥𝑖𝑤𝑖 = 𝑘 , where ∑𝑛𝑖=1 𝑤𝑖 = 1

The CPMM is a special case of (22) where 𝑛 = 2 and 𝑤𝑖 = 0.5 for 𝑖 ∈ {1,2}, which can then
be squared to yield a CPMM of the type examined before. An example of a DeFi platform
which operates as a CMMM is Balancer,50 and our analysis here is related to the Balancer
whitepaper (Martinelli and Mushegian, 2019). An important aspect of the Balancer protocol
is that the weights, once fixed, determine the share of the value a particular token has in
relation to the overall value of the pool; from this point of view, the Balancer protocol has
similarities to index funds that construct a portfolio of assets with fixed weights to each asset

49 Indeed, Uniswap-v3 allows for multiple fee structures, initially set at 0.05% (intended for stablecoins), 0.3%
(for standard token pairs) and 1% (for highly volatile tokens).
50 See https://balancer.finance (accessed on 20th September, 2021).

33

Electronic copy available at: https://ssrn.com/abstract=3722714


(Martinelli and Mushegian, 2019).51
To begin the analysis, suppose there are no trading fees. The bilateral trading price of one
𝑑𝑥𝑗 𝑤
unit of 𝑋𝑖 in terms of 𝑋𝑗 is 𝑃𝑋𝑗/𝑋𝑖 = − . Letting ∏𝑛𝑖=1 𝑥𝑖 𝑖 = 𝑓(𝑥1 , 𝑥2 , … 𝑥𝑛 ), equation (22)
𝑑𝑥𝑖
𝜕𝑓
yields ∑𝑛𝑖=1 𝜕𝑥 𝑑𝑥𝑖 = 𝑑𝑘 . Along any particular level curve 𝑑𝑘 = 0; moreover, since only
𝑖

quantities 𝑥𝑖 and 𝑥𝑗 change in this transaction, 𝑑𝑥𝑙 = 0 for 𝑙 ≠ {𝑖, 𝑗}. Consequently, for any
𝑑𝑥𝑗 𝜕𝑓⁄𝜕𝑥 𝑤 𝑥
arbitrary reserve quantities (𝑥1, 𝑥2 , … 𝑥𝑛 ), = − 𝜕𝑓⁄𝜕𝑥𝑖 = − 𝑤 𝑖 𝑥𝑗, and we have:
𝑑𝑥𝑖 𝑗 𝑗 𝑖

𝑤 𝑥
(23) 𝑃𝑋𝑗/𝑋𝑖 = 𝑤 𝑖 𝑥𝑗
𝑗 𝑖

We are now in a position to see how the process of two-point arbitrage works in a CMMM.
𝑤 𝑥
Consider the case where 𝑀𝑋𝑗/𝑋𝑖 < 𝑃𝑋𝑗/𝑋𝑖 = 𝑤 𝑖 𝑥𝑗. Arbitrageurs will purchase 𝑋𝑖 in the external
𝑗 𝑖
𝑥𝑗
market and sell it in the CMMM in exchange for 𝑋𝑗 . This causes to fall till the no-arbitrage
𝑥𝑖
condition 𝑀𝑋𝑗/𝑋𝑖 = 𝑃𝑋𝑗/𝑋𝑖 is restored.
We can also calculate the liquidity pool value after selecting a numeraire to do the pricing.
Without loss of generality, let us suppose 𝑋1 is selected as the token to price the liquidity
pool; 𝑋1 could be, for example, ETH. Using Euler’s theorem:52
𝑥
(24) 𝑉𝑋1,𝑋2 ,…,𝑋𝑛 = 𝑤1
1

The share of any token value to the pool value is:


𝑥𝑖 𝑃𝑋1 /𝑋𝑖
(25) 𝑠𝑖 = 𝑉 = 𝑤𝑖 , ∀𝑖 ∈ {1,2, … 𝑛}
𝑋1 ,𝑋2 ,…,𝑋𝑛

In a CMMM, therefore, the share of the value of any token to the value of the entire pool is
fixed and equal to the weight of each token in the liquidity pool, which is similar to a CPMM.
Now suppose we add ad valorem fees, 𝜏, to the price calculation problem assuming, as
before, that the fees are paid in units of the token sold by a trader into the liquidity pool.
𝑤 𝑥𝑗
While slightly more tedious to calculate, we can show that 𝑝𝑋𝑏𝑗 /𝑋𝑖 = 𝜙 𝑤 𝑖 𝑥 and 𝑝𝑋𝑎𝑗 /𝑋𝑖 =
𝑗 𝑖
1 𝑤𝑖 𝑥𝑗 53
. Using equation (5), the no-arbitrage condition is:
𝜙 𝑤𝑗 𝑥𝑖

51 As shown earlier, a CPMM also shares this feature.


𝜕𝑓 ⁄𝜕𝑥 𝜕𝑓 ⁄𝜕𝑥 𝑟𝑓(𝑥1 ,𝑥2 ,…𝑥𝑛 ) 𝜕𝑓 ⁄𝜕𝑥𝑖 𝑤 𝑥
52
From Euler’s theorem we have that 𝑥1 + 𝜕𝑓 ⁄𝜕𝑥2 𝑥2 + ⋯ 𝜕𝑓 ⁄𝜕𝑥𝑛 𝑥𝑛 = = 𝑤 𝑖 𝑥1 = . Since
1 1 𝜕𝑓 ⁄𝜕𝑥1
1 𝑖 𝜕𝑓 ⁄𝜕𝑥1
𝑃𝑋1 /𝑋𝑖 , the left hand side of Euler’s equation is 𝑉𝑋1 ,𝑋2 ,…,𝑋𝑛 . Given the constraint that ∑𝑛𝑖=1 𝑤𝑖 = 1, we have that
𝑥
𝑟 = 1, and the right-hand side equals 𝑤1 .
1
53 Suppose the trader sells 𝑋𝑖 and purchases 𝑋𝑗 ; this yields the bid-price 𝑝𝑋𝑏 𝑗 /𝑋𝑖 . Assume we start with pool
𝑤 𝑤
reserves (𝑥1 , 𝑥2 , … , 𝑥𝑛 ) which satisfies ∏𝑛𝑖=1 𝑥𝑖 𝑖 = 𝑘. For the trade we have (∏𝑛𝑟=1 𝑥𝑟 𝑟 ) (𝑥𝑖 + 𝜙∆𝑥𝑖 )𝑤𝑗 (𝑥𝑗 +
𝑟≠𝑖,𝑗
𝑤𝑖
𝑤𝑗 𝑤 𝜙∆𝑥𝑖 −𝑤𝑗 ∆𝑥𝑗
∆𝑥𝑗 ) = ∏𝑛𝑖=1 𝑥𝑖 𝑖 = 𝑘 . This implies that ∆𝑥𝑗 = 𝑥𝑗 [(1 + ) − 1], from which it follows that lim =
𝑥𝑖 ∆𝑥𝑖 →0 ∆𝑥𝑖

34

Electronic copy available at: https://ssrn.com/abstract=3722714


𝑤 𝑥 1𝑤 𝑥
(26) 𝜙 𝑤𝑖 𝑥𝑗 ≤ 𝑀𝑋𝑗/𝑋𝑖 ≤ 𝜙 𝑤𝑖 𝑥𝑗
𝑗 𝑖 𝑗 𝑖

4.2 Constant Sum Market Makers (CSMM)


There has been some discussion in the DeFi space about the usefulness and limitations of
a constant sum market maker (CSMM).54 For reserves (𝑥, 𝑦), a CSMM holds the sum of
reserves constant, that is, the exchange function satisfies 𝑥 + 𝑦 = 𝑘. Of course, one could
generalize this to 𝑎𝑥 + 𝑏𝑦 = 𝑘, or to 𝑎1 𝑥1 + 𝑎2 𝑥2 + ⋯ + 𝑎𝑛 𝑥𝑛 = 𝑘.
The main point we wish to make here is that a CSMM functions poorly as a decentralized
exchange because arbitrage activity can entirely drain the liquidity pool of a token, and the
simple 𝑥 + 𝑦 = 𝑘 case suffices to show that. Before doing so, however, it is worthwhile
examining why a CSMM may be attractive. One of the features of a CPMM (and a CMMM) is
that along a particular level curve, say 𝑘 0 in Figure 4, the slope varies at every point, and
consequently the price changes every time the reserves change, even if by a small amount. In
𝑑𝑦 𝑎
contrast, in a CSMM 𝑎𝑥 + 𝑏𝑦 = 𝑘, the price is constant and equal to 𝑃𝑌/𝑋 = − 𝑑𝑥 = 𝑏 ;
indeed, in the special case where 𝑎 = 𝑏 = 1, 𝑃𝑌/𝑋 = 1, and the two tokens trade on a one-
to-one basis. The price stability is attractive in that it reduces slippage, which is a useful
feature to have when trading tokens with stable relative prices.
In a decentralized exchange, however, the constant price in a CSMM is problematic if the
external market price is variable. Intuitively, arbitrageurs will constantly take advantage of
the price differential in the two markets and because the constant price in the CSMM cannot,
by construction, respond to this pressure by arbitrageurs, they may drain the CSMM of one
token or the other. This intuition is described more systematically in Figure 7, which depicts
the exchange function 𝑥 + 𝑦 = 𝑘. Suppose that 𝜏 = 0 to begin with.
Consider a situation where the reserves in the CSMM are (𝑥 𝐴 , 𝑦 𝐴 ), and the level curve is
𝑘 = 𝑘 0 . The absolute value of slope of the line 𝐵𝐷 is 𝑃𝑌/𝑋 = 1. Now suppose the external
market price is 𝑀𝑌/𝑋 > 1. In this case, arbitrageurs will buy 𝑋 in the CSMM and sell it in the
external market to make a profit of 𝑀𝑌/𝑋 − 𝑃𝑌/𝑋 for every unit of 𝑋 bought and sold this way.
If the CSMM is small compared to the external market, 𝑀𝑌/𝑋 may change little in response to
the sale of 𝑋 there, and the process will continue till the CSMM is drained of all 𝑋 since 𝑃𝑌/𝑋

𝑤𝑖
𝜙∆𝑥 −𝑤𝑗
𝑥𝑗 [(1+ 𝑥 𝑖 ) −1]
𝑖
𝑤 𝑥 𝑑𝑥
lim . Using L’Hôpital’s rule, the right-hand side is −𝜙 𝑤𝑖 𝑥𝑗 , and consequently, 𝑝𝑋𝑏 𝑗 /𝑋𝑖 = − 𝑑𝑥𝑗 =
∆𝑥𝑖 →0 ∆𝑥𝑖 𝑗 𝑖 𝑖
𝑤𝑖 𝑥 𝑗 1𝑤 𝑥
𝜙𝑤 . The proof for 𝑝𝑋𝑎𝑗 /𝑋𝑖 = 𝜙 𝑤𝑖 𝑥𝑗 follows along similar lines.
𝑗 𝑥𝑖 𝑗 𝑖
54An example of using a CSMM as the exchange function is mStable, which used a CSMM to initially develop
mUSD. However, as users identified concerns with the design, it has moved away from the CSMM model for
mBTC: see https://github.com/mstable/MIPs/blob/master/MIPS/mip-7.md (accessed 20th September, 2021).
Egorov (2020) discusses the problems with a CSMM, before utilizing a mix of the CSMM and CPMM exchange
functions to develop a hybrid AMM.

35

Electronic copy available at: https://ssrn.com/abstract=3722714


is fixed.

𝐴
𝑦𝐴

𝑦𝑀 𝐶
𝑘 = 𝑘0

𝑂 𝑥𝐴 𝐷 𝑥

Figure 7: Price and arbitrage in a CSMM with


no trading fees

In Figure 7, starting from point 𝐴, arbitrageurs can buy 𝑂𝑥 𝐴 units of 𝑋 by selling 𝐵𝑦 𝐴 units
of 𝑌 to the CSMM, which causes a movement to the corner point 𝐵. The line 𝐵𝐶 describes
the trading possibilities in the external market, and has a slope greater than 1, thereby
capturing the fact that 𝑀𝑌/𝑋 > 𝑃𝑌/𝑋 . Arbitrageurs can sell the 𝑂𝑥 𝐴 units of 𝑋 purchased in
the CSMM for 𝐵𝑦 𝑀 units of 𝑌 in the external market, making an overall profit of 𝑦 𝑀 𝑦 𝐴 units
of 𝑌. For the CSMM, the arbitrage process drains all 𝑋 reserves and the CSMM is left with 𝑘 0
units of 𝑌, leading to a corner equilibrium at point 𝐵.55 The arguments when 𝑀𝑌/𝑋 < 1 are
similar, with a corner equilibrium at 𝐷.
𝑏 𝑎 1
Adding trading fees as before, we have that 𝑝𝑌/𝑋 = 𝜙 and 𝑝𝑌/𝑋 = 𝜙 . In the scenario above
1
where an arbitrageur buys 𝑋 from the CPMM, the relevant price of 𝑋 is 𝜙
units of 𝑌. So, if
1
fees are high and 𝜙 > 𝑀𝑌/𝑋 , arbitrage is no longer profitable; on the other hand, if fees are

55 A corner solution such as this is discussed in many undergraduate microeconomics textbooks (see, for
example, Varian, 1987) in the context of perfect substitution between goods in a utility function. In this case,
indifference curves are straight lines. The consumer simply spends her entire budget on the lower priced good,
yielding a corner solution to the consumer utility maximization problem. The fact that the AMM will lose the
more valuable token in its reserves also bears some similarity in a macroeconomic context to Gresham’s Law:
bad money drives out good money (for example, see Dernburg, 1989). This phenomenon typically happens when
there are multiple competing reserves, for example, gold and silver in a bimetallic standard.

36

Electronic copy available at: https://ssrn.com/abstract=3722714


1
low and < 𝑀𝑌/𝑋 , arbitrage continues as before and yields a corner equilibrium. Overall, the
𝜙
1
no-arbitrage condition in this case is 𝜙 ≤ 𝑀𝑌/𝑋 ≤ 𝜙. Higher the fees, wider is the gap and it
is less likely that the CSMM is depleted of one token due to the action of arbitrageurs.

4.3 Hybrid Function Market Makers (HFMM)


One of the advantages of a CSMM is that there is no price slippage, which is a problem
with a CPMM/CMMM. However, the disadvantage of a CSMM is the possibility of a corner
equilibrium when token prices are volatile, which cannot happen in a CPMM/CMMM. A mix
of a CPMM/CMMM and a CSMM that emphasizes both their advantages, while minimizing
their problems, would be a desirable middle-ground in many situations, such as the exchange
of stablecoins. A Hybrid Function Market Maker (HFMM) attempts to achieve this by
integrating the exchange functions of a CSMM and a CPMM/CMMM.
Much of the discussion below is inspired by the whitepaper for Curve Finance (or, formerly,
Stableswap; see Egorov, 2019), an AMM that facilitates trade in stablecoins. Our focus here
is to bring out the intuition behind how an integration of a CPMM/CMMM and CSMM may
be achieved and the HFMM described here is, consequently, considerably less complex than
that of Egorov (2019).56 To keep the exposition simple, trading fees are assumed to be zero.
1
Consider a CMMM described in equation (22), with equal weights so that ∏𝑛𝑖=1 𝑥𝑖𝑛 = 𝑘 and
1
a CSMM 𝑎1 𝑥1 + 𝑎2 𝑥2 + ⋯ + 𝑎𝑛 𝑥𝑛 = 𝑘, also with equal coefficients 𝑎1 = 𝑎2 = ⋯ = 𝑎𝑛 = 𝑛,
∑𝑛
𝑖=1 𝑥𝑖
which yields = 𝑘. Why these special cases with equalized weights and coefficients were
𝑛
𝑥𝑗
chosen will become apparent presently. The bilateral price in the CMMM is 𝑃𝑋𝑗/𝑋𝑖 = and
𝑥𝑖

in the CSMM is 𝑃𝑋𝑗 /𝑋𝑖 = 1. Our goal is to mix these two AMMs to form a hybrid, and the
simplest way to do that is to take a weighted average of the two:
1
∑𝑛
𝑖=1 𝑥𝑖
(27) 𝜆 + (1 − 𝜆) ∏𝑛𝑖=1 𝑥𝑖𝑛 = 𝑘 , for some 𝜆 ∈ [0,1]
𝑛

The problem with this scheme, however, is that the weight attached to each function is
independent of the reserves (𝑥1 , 𝑥2 , … . 𝑥𝑛 ). Ideally, we would like to assign more weight to
the CMMM when any of these token reserve approaches zero to ensure its price escalates
rapidly. Similarly, when the amounts of the tokens are roughly equal, assigning greater weight
to the CSMM will ensure that prices do not change too rapidly, thereby minimizing slippage.
To construct a scheme where 𝜆 is sensitive to the quantity of reserves, we note the
∑𝑛
𝑖=1 𝑥𝑖 ∑𝑛
𝑖=1 𝑥𝑖
arithmetic mean (AM) of the reserves is 𝐴 = . The CSMM = 𝑘, consequently,
𝑛 𝑛

𝐷
56 Specifically, Egorov (2019) uses the exchange function 𝜒𝐷 𝑛−1 ∑ 𝑥𝑖 + ∏ 𝑥𝑖 = 𝜒𝐷 𝑛 + ( 𝑛 )𝑛, where 𝜒 is a
‘leverage’ parameter, 𝐷 is the sum all token balances, 𝑥𝑖 is the reserve of token 𝑖, and 𝑛 is the number of tokens.

37

Electronic copy available at: https://ssrn.com/abstract=3722714


specifies various combinations of reserves that yield a particular AM. Similarly, the geometric
1 1
mean (GM) of the reserves is 𝐺 = ∏𝑛𝑖=1 𝑥𝑖𝑛; the CMMM ∏𝑛𝑖=1 𝑥𝑖𝑛 = 𝑘 looks at combinations of
reserves yielding a specific GM. Now, consider the relationship between 𝐴 and 𝐺. A well-
known theorem (which we do not prove here) is the AM-GM inequality:

The AM-GM inequality: For any non-negative real numbers 𝑥1, 𝑥2 , … , 𝑥𝑛 :


1
∑𝑛
𝑖=1 𝑥𝑖
(i) ≥ ∏𝑛𝑖=1 𝑥𝑖𝑛
𝑛
1
∑𝑛
𝑖=1 𝑥𝑖
(ii) = ∏𝑛𝑖=1 𝑥𝑖𝑛 if and only if 𝑥1 = 𝑥2 = ⋯ = 𝑥𝑛
𝑛

Suppose we focus on the ratio 𝐺/𝐴, where 𝐴 ≠ 0. Given the AM-GM inequality, it follows
𝐺 𝐺
that ≤ 1 and that = 1 only when the reserves of all tokens are equal. Moreover, it is
𝐴 𝐴
𝐺 𝐺
evident that 𝐴 ≥ 0 and that 𝐴 = 0 only if at least one of the reserves (but not all, since 𝐴 ≠ 0)
𝐺 𝐺
satisfies 𝑥𝑖 = 0. So, 0≤ 𝐴 ≤ 1 holds, and 𝐴 is a feasible candidate for the weight 𝜆. Let us set,
𝐺
then, 𝜆 = 𝐴 in equation (27), which yields:
𝐺
(28) 𝐺 (2 − 𝐴 ) = 𝑘

From (28), we can derive the bilateral price using the same procedure as Section 4.1:
𝐺 𝜕𝐺 𝐺2 𝜕𝐴
𝑑𝑥𝑗 2(1−𝐴)𝜕𝑥 + 2 𝜕𝑥
𝑖 𝐴 𝑖
(29) 𝑃𝑋𝑗/𝑋𝑖 = − 𝑑𝑥 = 𝐺 𝜕𝐺 𝐺2 𝜕𝐴
𝑖 2(1−𝐴)𝜕𝑥 + 2 𝜕𝑥
𝑗 𝐴 𝑗

Equation (29) implies that when reserves of any token, say 𝑋𝑖 , tends to zero, we have that
𝐺 𝜕𝐺 ⁄𝜕𝑥
→ 0 and 𝑃𝑋𝑗 /𝑋𝑖 → 𝜕𝐺 ⁄𝜕𝑥 𝑖 , which is the price that would exist under a CMMM. Similarly,
𝐴 𝑗
𝐺 𝜕𝐴⁄𝜕𝑥𝑖
when 𝐴 → 1, 𝑃𝑋𝑗 /𝑋𝑖 → , which is the price that exists under a CSMM.
𝜕𝐴⁄𝜕𝑥𝑗

The outcome of this discussion is shown geometrically in Figure 8 for the two token case.
1 1
𝑥+𝑦
The curve 𝐺𝐺 represents the CMMM 𝑥 2 𝑦 2 = 𝑘 and the line 𝐴𝐴 represents the CSMM =
2
𝑘. The mixing of the two AMMs using a fixed 𝜆 is shown with the dashed-curve 𝐶𝐶, which has
been drawn with 𝜆 = 0.5. It is evident that 𝐶𝐶 reduces the problem of dwindling reserves
experienced by the CSMM 𝐴𝐴; however, there is still considerable price slippage as, starting
from the 45° line, the slopes change relatively rapidly. Choosing a different 𝜆 would involve a
different trade-off between the twin problems of draining reserves and price slippage; the
point is that this trade-off is fixed for all reserve combinations once 𝜆 is chosen. The HFMM
𝐺
with 𝜆 = is shown using the dotted-curve 𝐻𝐻. Compared to the 𝐶𝐶 curve, 𝐻𝐻 is closer to
𝐴
𝐴𝐴 when reserves are roughly equal and, at the same time, is closer to 𝐺𝐺 when one of the
reserves in the liquidity pool starts to fall, thereby transferring weight to the AMM that better

38

Electronic copy available at: https://ssrn.com/abstract=3722714


resolves the more damaging problem for a specific reserve combination.

𝐶𝐻 𝐺

45°

𝐺
𝐻
𝐶 𝑥
𝐴

Figure 8: Hybrid Function Market Makers

While this example of forming a hybrid represents one way of moving between a CSMM
and a CMMM, other possibilities exist. For example, one could specify the general CES
(Constant Elasticity of Substitution) function as the AMM exchange function. The CES function
1
with two tokens 𝑋 and 𝑌 is 𝐸[𝛼𝑥 𝜌 + (1 − 𝛼)𝑦 𝜌 ]𝜌, where 𝐸 is an efficiency parameter, 𝛼 is
the distribution parameter and 𝜌 is the substitution parameter. When 𝐸 = 1, this will
approach the two token CMMM exchange function 𝑥 𝛼 𝑦 1−𝛼 as 𝜌 → 0 and equals the CSMM
𝛼𝑥 + (1 − 𝛼)𝑦 when 𝜌 = 1.57 This allows for a way to change the curvature of the exchange
function parametrically, similar to changing a fixed 𝜆 above.58

57 See Chiang (1984) or Silberberg (1990) for a proof of convergence to 𝑥𝛼 𝑦1−𝛼 as 𝜌 → 0.


1 1
1 1 1 1
58When 𝐸 = 1, 𝛼 = 1/2 and 𝜌 = 1/2, the function becomes (2 𝑥 2 + 2 𝑦 2 )2. When expanded this is 2 𝐴 + 2 𝐺,
the weighted average of 𝐴 and 𝐺, with 𝜆 = 0.5. This yields the curve 𝐶𝐶 in Figure 8.

39

Electronic copy available at: https://ssrn.com/abstract=3722714


4.4 Dynamic Automated Market Makers (DAMM)
4.4.1 Dynamic weights in a CMMM
Section 4.3 provided the basic intuition behind how a HFMM attempts to modify a CMMM
to keep prices relatively stable. A HFMM provides a satisfactory solution in the context of
stablecoins where prices exhibit low volatility in the external market. However, the HFMM
method of changing the shape of the AMM function may be less suitable when dealing with
volatile tokens, where arbitrage activity may be high. Fees reduce arbitrage but negatively
affect the efficiency of an AMM. So, the question that we now address is whether arbitrage
activity on a CMMM be reduced: (a) while still reflecting the external market price; but, (b)
𝑤
without changing the ∏𝑛𝑖=1 𝑥𝑖 𝑖 = 𝑘 exchange function; and (c) without increasing fees?
In Section 4.1, the CMMM required assumed that the weights were fixed at some level.
Consider, now, a scenario where the CMMM could alter the weights dynamically in response
to some external market stimulus. To see the implications of this possibility, let us recap the
𝑤 𝑥
CMMM arbitrage response with zero trading fees. If 𝑀𝑋𝑗 /𝑋𝑖 < 𝑃𝑋𝑗 /𝑋𝑖 = 𝑤 𝑖 𝑥𝑗, for example,
𝑗 𝑖

arbitrageurs purchase 𝑋𝑖 in the external market and sell it in the CMMM in exchange for 𝑋𝑗
𝑥𝑗
till 𝑀𝑋𝑗 /𝑋𝑖 = 𝑃𝑋𝑗/𝑋𝑖 holds. All the response in this case is through changes in . There is,
𝑥𝑖
𝑤
however, an alternative way to get 𝑃𝑋𝑗/𝑋𝑖 to fall: by reducing 𝑤 𝑖 . If the CMMM were to adjust
𝑗

𝑤𝑖′ 𝑥𝑗
weights to 𝑤𝑖′ and 𝑤𝑗′ , we can have 𝑀𝑋𝑗 /𝑋𝑖 = 𝑃𝑋𝑗/𝑋𝑖 = 𝑤 ′ 𝑥 , with no change in the ratio of
𝑗 𝑖
𝑥𝑗
reserves 𝑥 . Prices in the two markets have become aligned not because of arbitrage activity,
𝑖

but rather due to ‘dynamic’ adjustments of the weights.


The above discussion suggests that weights that are flexible provides an additional
equilibrating factor other than arbitrage to ensure that AMM prices track external market
prices. The external market price now serves the purpose of an oracle: an external source of
information that is fed into the smart contract. The relative importance of dynamic weights
and arbitrage in keeping prices aligned between the two markets then depends on how
frequently and reliably the oracle provides information to the AMM. Finally, it is worth noting
that dynamic weights cause two important changes to the CMMM. First, the shares in
equation (25) are no longer fixed, causing the CMMM to no longer be analogous to a standard
fixed weight index fund. Second, from (24), in the standard CMMM, the valuation changes
only when the quantity 𝑥1 changes. Changing weights, however, present an additional source
of change for pool valuation, potentially making the pool value more volatile.

4.4.2 An example of a DAMM: Bancor


Bancor is an example of an AMM that dynamically adjusts weights as the external market
price changes, thereby reducing arbitrage activity. Bancor does not directly use a CMMM

40

Electronic copy available at: https://ssrn.com/abstract=3722714


function as its trading technology; our goal here is to show that the price output is,
nevertheless, the same as the CMMM discussed above. The important institutional features
of Bancor described here are based on Hertzog et al (2018) and Rosenfeld (2017). 59
A smart contract in Bancor has two types of tokens: a ‘smart token’ (say 𝑌) and a set of
𝑛 ‘connected tokens’, where 𝑛 ≥ 1. Let the connected tokens be 𝑋1 , 𝑋2 … , 𝑋𝑛 . Let 𝑃𝑌/𝑋𝑖
denote the price of 1 unit of 𝑋𝑖 in terms of 𝑌 (in the absence of any trading fees).60 A trader
can purchase or sell 𝑋𝑖 against 𝑌 at any time using the smart contract at the going price. When
a trader sells 𝑋𝑖 its reserve balance, 𝑥𝑖 , increases and the smart contract automatically
increases supply of 𝑌. The opposite occurs when a trader buys 𝑋𝑖 : reserve 𝑥𝑖 decreases, as
does the supply of 𝑌. The mechanics of operation thus far appear entirely different than a
CMMM. What makes the two comparable are ‘connector weights’ or ‘fractional reserve
ratios’, 𝑤𝑖 , 𝑖 ∈ {1,2, … 𝑛}. Letting 𝑦 denote the total quantity of 𝑌, 𝑤𝑖 satisfies the condition:
𝑃𝑌/𝑋𝑖 𝑥𝑖
(30) 𝑤𝑖 = for all , 𝑖 ∈ {1,2, … 𝑛}
𝑦

The numerator is the value of token 𝑋𝑖 denominated in units of 𝑌, while the denominator is
the total value of 𝑌 in the smart contract. Equation (30) essentially defines the connector
weight as the ratio of the value of reserves of 𝑋𝑖 to the total value of all the 𝑌 supplied. When
∑𝑛𝑖=1 𝑤𝑖 = 1, it follows that ∑𝑛𝑖=1 𝑃𝑌/𝑋𝑖 𝑥𝑖 = 𝑦 and the sum of the values of all the ‘connector
tokens’ exactly equals the value of 𝑌 minted by the smart contract.
Now, equation (30) can be rearranged to get 𝑃𝑌/𝑋𝑖 :
𝑦𝑤𝑖
(31) 𝑃𝑌/𝑋𝑖 = 𝑥𝑖

For any two tokens, 𝑋𝑖 and 𝑋𝑗 , we can get the cross-rate that is implied by (31):
𝑃𝑌/𝑋 𝑤 𝑥𝑗
(32) 𝑃𝑋𝑗 /𝑋𝑖 = 𝑃 𝑖
= 𝑤𝑖 𝑥
𝑌/𝑋𝑗 𝑗 𝑖

This is, of course, exactly the same as equation (23) for a CMMM. So, any set of reserves on
Bancor generates exactly the same price as a CMMM when the connector weight for each
token on Bancor equals the weight for that token on the CMMM. Consequently, Bancor and
Balancer can be viewed as being equivalent in terms of the technology for converting
quantities of tokens reserves to prices, even though the institutional mechanisms may be
different. It also follows straight away that when Bancor assigns dynamic weights, its
outcomes replicate the CMMM with dynamic weights outlined in Section 4.4.1 and the
intuition of price adjustment provided there is applicable here as well.

59 Our exposition here is meant to capture the overall logic of the system, rather than all the institutional details
of the Bancor protocol; see https://app.bancor.network/eth/data (accessed on 20th September, 2021), Hertzog
et al (2018) and Rosenfeld (2017) for further details.
60 Hertzog et al (2018) and Rosenfeld (2017) work with the price 𝑃
𝑋𝑖 /𝑌 , which (from equation 2) is the reciprocal
of 𝑃𝑌/𝑋𝑖 used here; the latter is used in this paper mainly for expositional ease.

41

Electronic copy available at: https://ssrn.com/abstract=3722714


Overall, revisiting Figure 1, we have formed connections between a number of different
types of AMMs: CPMM-v1 and v2, CMMM, HFMM, CSMM and DAMM. While the possibilities
for experimenting with AMMs appear endless, simple geometric tools based on homogeneity
and homotheticity are often suffice to discern similarities and differences in their structures.

5. An AMM with ‘concentrated liquidity’: Uniswap-v3


5.1 Proposed changes in Uniswap-v3
The Unswap-v3 whitepaper (Adams et al, 2021) proposes three important changes to v1
and v2, which we summarize briefly here.
First, in the Uniswap-v1 and v2 protocols, tokens of liquidity providers are pooled together
and can be traded anywhere along the exchange function. In contrast, Uniswap-v3
implements concentrated liquidity, where a liquidity provider can specify a price range, [𝑃, 𝑃],
within which to add liquidity. The main purpose of this change is to improve capital efficiency.
Consequently, liquidity provision no longer requires deposits of 𝑋 and 𝑌 of equal value. Since
a liquidity provider needs to cover only the range specified, the deposit ratios of can vary
depending on the price range specified and the current price of tokens.
The implication of introducing concentrated liquidity is that each position is unique.
Intuitively, in Uniswap-v1 and v2, liquidity provision was characterized by the amount ∆𝑥
added to the pool (the condition that tokens are provided in equal value determines ∆𝑦); as
a result, fungible liquidity tokens are capable of tracking liquidity contributions by providers.
In Uniswap-v3, however, liquidity provision is characterized by ∆𝑥 and by a price range [𝑃, 𝑃]
specified by the provider, and the latter distinguishes the contribution of one provider from
another who also adds ∆𝑥 but specifies a different price range. As a result, the second major
change is that v3 protocol uses non-fungible tokens to track liquidity.
The third change occurs to trading fees and how these fees are distributed to liquidity
providers. In Uniswap-v1 and v2, all pools have a uniform trading fee of .3% and these were
automatically added to the liquidity pool causing 𝑘 to expand over time from fees alone. In
v3, multiple pools can exist for the same token pair with varying fees, with .05%, .3% or 1%
being the initial fee tiers (with the capability to add more tiers). Moreover, fees are no longer
added to the liquidity pool, and are stored separately. In some ways, the addition of fee tiers
is an alternative strategy to ex ante designing an ‘optimal’ fee for the AMM; liquidity providers
can select their preferred fees for any pair of tokens and the market can converge towards a
trading fee for the token pair. One would expect that, over time, this will also be conditioned
by the extent of competition that exists between AMMs providing similar services.

5.2 The geometry of a single concentrated liquidity position


We now investigate more closely the implications of introducing concentrated liquidity. As
will be seen, the geometry becomes more complex due to this feature. Our analysis here

42

Electronic copy available at: https://ssrn.com/abstract=3722714


follows broadly along the lines of Adams et al (2021) and Mellow Protocol (2021). However,
we develop a set of geometric techniques that are consistent with the previous sections, and
that allows us to better understand the relationship between Unsiwap-v1 and v2 on one hand,
and Unsiwap-v3 on the other. Trading fees are assumed to be zero for simplicity.
Consider the exchange function 𝑘 = 𝑥𝑦 in Figure 9 below, which is the same as the
Uniswap-v2 exchange function. To begin with, we assume that there exists a single user who
𝐹 𝐶
has specified the price interval [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ] for the liquidity bounds. As before, we have that
𝐶 𝑦𝐶 𝐹 𝑦𝐹 𝐵 𝑦𝐵
𝑃𝑌/𝑋 = 𝑥 𝐶 and 𝑃𝑌/𝑋 = 𝑥 𝐹 . Assume the current price is 𝑃𝑌/𝑋 = 𝑥 𝐵 . A position is characterized
𝐹 𝐶
by 𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 and the reserves placed within that price range.61

𝑦 𝑦̂

𝐶
𝑦𝐶

𝑦𝐵 𝐵

𝐴
𝑦𝐴

𝐹
𝑦𝐹
𝑂̂ 𝑥̂
𝐸
𝑘
𝑥
𝑂 𝑥𝐶 𝑥𝐵 𝑥 𝐴 𝑥𝐹

Figure 9: A single position in a Uniswap-v3 pool

There are now two aspects to focus on: first, what occurs in a position; and second, how
this relates to the overall exchange function. To distinguish between the two, Uniswap-v3

61 Uniswap-v3 keeps track of every .01% change between prices. Specifically, a pool tracks prices 𝑃 = 1.0001𝑖 ,
for 𝑖 ∈ {… , −2, −1,0,1,2, … }; each 𝑖 corresponds to a price ‘tick’. The change in prices between two ticks is then
𝑑𝑃
= 𝑃ln(1.0001) ≅ .0001 × 𝑃. This results in a discretization of the prices, a complication that we shall
𝑑𝑖
conveniently ignore here.

43

Electronic copy available at: https://ssrn.com/abstract=3722714


uses the term real to keep track of actual reserves within a specific price range and virtual to
refer to the overall exchange function. The exchange function 𝑘 = 𝑥𝑦 is defined, then, in
terms of virtual reserves 𝑥 and 𝑦. Virtual reserves are important in this context because they
determine prices along the exchange function.
Geometrically, Figure 9 differentiates between virtual and real by drawing a separate set
of ‘real axes’, 𝑥̂ and 𝑦̂ (with origin 𝑂̂ ), to keep track of real reserves within the position 𝐶𝐹.
The ‘virtual axes’, 𝑥 and 𝑦, keep track of virtual reserves. The real axes are, essentially, a
translation of the virtual axes. Any point (𝑥, 𝑦) in the virtual 𝑥 − 𝑦 space can be translated to
a point (𝑥̂, 𝑦̂) = (𝑥 − ℎ, 𝑦 − 𝑚) in the real 𝑥̂ − 𝑦̂ space, where (ℎ, 𝑚) is the co-ordinate of 𝑂̂
in relation to the origin 𝑂. In Figure 9, ℎ = 𝑥 𝐶 and 𝑚 = 𝑦 𝐹 ; the coordinate of the real origin
𝑂̂ is clearly a function of the bounds of the interval [𝑃𝑌/𝑋
𝐹 𝐶
, 𝑃𝑌/𝑋 ] specified by the liquidity
provider. Thus, at point 𝐶, the virtual reserves are 𝑥 𝐶 and 𝑦 𝐶 , but the position has real
reserves 𝑥̂ 𝐶 = (𝑥 𝐶 − 𝑥 𝐶 ) = 0 of 𝑋 and 𝑦̂ 𝐶 = (𝑦 𝐶 − 𝑦 𝐹 ) of 𝑌. Similarly, at point 𝐹, the real
reserves are 𝑥̂ 𝐹 = (𝑥 𝐹 − 𝑥 𝐶 ) and 𝑦̂ 𝐹 = 0 (while virtual reserves are 𝑦 𝐹 and 𝑥 𝐹 ). In general,
for any virtual reserve (𝑥, 𝑦) in the arc 𝐹𝐶, the translation of the axes yields corresponding
real reserves (𝑥̂, 𝑦̂) = (𝑥 − 𝑥 𝐶 ,𝑦 − 𝑦 𝐹 ).
Now, suppose we start at some point, say 𝐵, where real reserves are equal to (𝑥̂ 𝐵 , 𝑦̂ 𝐵 ) =
(𝑥 𝐵 − 𝑥 𝐶 ,𝑦 𝐵 − 𝑦 𝐹 ). As traders swap 𝑋 for 𝑌, the liquidity pool loses 𝑌 and gains 𝑋, with prices
moving along the exchange function till we hit point 𝐹. Here, 𝑦̂ 𝐹 = 0 and the position holds
only 𝑋. Similarly, as prices move in the reverse direction from 𝐵, the position will run out of
reserves of 𝑋 at point 𝐶 and be left with reserves of only token 𝑌.
The real axes 𝑥̂ and 𝑦̂ highlight that even though the virtual reserves can never fall to zero
for any asset due to the curvature of the 𝑥𝑦 = 𝑘 exchange function, real reserves can indeed
do so. The latter occurs when the level curve intersects the 𝑦̂ (or 𝑥̂) axis. This necessitates
differentiating between active and inactive positions: when the actual trading price is in the
𝐹 𝐶
range (𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ), the position 𝐶𝐹 is active. This occurs, for example, when the actual price
equals the slope of ray 𝑂𝐵 in Figure 9. When the price is outside that range, at say points 𝐷
or 𝐸, the position is inactive. Inactive positions earn no fees on Uniswap-v3, which is a marked
difference from Uniswap-v2 where liquidity providers earn fees along the entire exchange
function. If the position is inactive at the time of liquidity provision, say at point 𝐷, the liquidity
𝐹 𝐶
provider deposits only asset 𝑌 when specifying the inactive range [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ]. Similarly, if
the current price corresponds to point 𝐸, the liquidity provider deposits only asset 𝑋 when
specifying the same price range. In either case, the position becomes active when the price
enters the specified price range.
The feature of real reserves falling to zero bears similarity to a CSMM, such as the one
shown in Figure 7. To highlight the similarity, we have drawn the chord connecting 𝐶 and 𝐹
in Figure 9; with respect to the axes 𝑥̂ and 𝑦̂, the line 𝐶𝐹 behaves like a CSMM. As pointed

44

Electronic copy available at: https://ssrn.com/abstract=3722714


out in Section 4.2, the slope of the CSMM is the fixed price at which the two assets trade. It
is worth investigating, then, what information the slope of the line 𝐶𝐹 provides in Uniswap-
𝑦 𝐶 −𝑦 𝐹
v3. The slope of line 𝐶𝐹 is , which is the rate at which the two assets exchange on
𝑥 𝐶 −𝑥 𝐹
average in the position. We can, therefore, think of the absolute value of the slope of 𝐶𝐹 as
𝐹 𝐶
the average price of the liquidity position bounded by the prices 𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 . Denoting the
𝐶𝐹
average price as 𝑃𝑌/𝑋 :

𝐶𝐹 𝑦 𝐶 −𝑦 𝐹
(33) 𝑃𝑌/𝑋 = 𝐹 𝐶
𝑥 −𝑥

To understand how the chord 𝐶𝐹 is related to the arc 𝐶𝐹, we utilize a fundamental theorem
in calculus, the Mean Value Theorem.

Mean Value Theorem: Consider a continuous function 𝑦 = 𝑓(𝑥) on an interval [𝑥1 , 𝑥2] that
is differentiable in (𝑥1 , 𝑥2 ). Then, there exists some 𝑥𝐴 ∈ (𝑥1, 𝑥2 ) such that:
𝑑𝑓(𝑥𝐴 ) 𝑓(𝑥2 )−𝑓(𝑥1 )
=
𝑑𝑥 𝑥2 −𝑥1

In terms of Figure 9, the Mean Value Theorem implies that there exists a point 𝐴 (as shown
in the figure) on the exchange function between 𝐶 and 𝐹 that has the same slope as the line
𝐶𝐹. Consequently, we can identify 𝐴 as a point on the exchange function that has the same
price as the average price of the liquidity position bounded by 𝐶 and 𝐹. It is straightforward
to show that this average price is the geometric mean of the price bounds: 62

𝐶𝐹 𝐹 𝐶
(34) 𝑃𝑌/𝑋 = √𝑃𝑌/𝑋 𝑃𝑌/𝑋

The average price is also the effective price for a range order in Unsiwap-v3, where a liquidity
provider contributes a single token in an inactive position (typically with a narrow price
range). In Figure 9, if the liquidity position becomes active at 𝐹 and the price moves through
arc 𝐶𝐹 before exiting at 𝐶, the average price for exchanging 𝑋 to 𝑌 is then given by (34).
It is worth noting that while “price equals the ratio of reserves” is an unambiguous
statement in Uniswap v1 and v2, this is no longer true in Uniswap-v3, where there are two
𝑦
reserve ratios to keep track of. First, the virtual reserve ratio (which equals 𝑃𝑌/𝑋 ) and
𝑥
𝑦̂
second, the real reserve ratio ̂ (which need not). To see the difference between the two, in
𝑥
𝑦𝐵
Figure 9 at point 𝐵, we have that the virtual reserve ratio 𝑥 𝐵 equals the slope of the ray 𝑂𝐵.
𝑦̂ 𝐵 𝑦 𝐵−𝑦 𝐹
However, the real reserve ratio is = , which is obviously different. Indeed, the real
𝑥̂ 𝐵 𝑥 𝐵−𝑥 𝐶

1 1
𝑦 𝐶 −𝑦 𝐹 𝑘( 𝐶 − 𝐹 ) 𝑘 𝑘2 𝑦𝐹𝑦𝐶
𝐶𝐹 𝐹 𝐶
62 Specifically, we have that 𝑃𝑌/𝑋 = 𝑥 𝐹 −𝑥 𝐶
= 𝑥 𝑥
𝑥 𝐹 −𝑥 𝐶
= 𝑥 𝐹𝑥 𝐶 = √(𝑥 𝐹 𝑥 𝐶)2 = √𝑥 𝐹𝑥 𝐶 = √𝑃𝑌/𝑋 𝑃𝑌/𝑋 .

45

Electronic copy available at: https://ssrn.com/abstract=3722714


reserve ratio equals the slope of the line 𝑂̂ 𝐵 running through the real origin. The real reserve
𝑦̂ 𝑦
𝐹 𝐶
ratio 𝑥̂ ranges from 0 to ∞ as the virtual reserve ratio 𝑥 varies between 𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 .
The upshot of the above discussion is that all these variables lying on the same graph -
𝐹 𝐶
𝑥, 𝑦, 𝑥̂, 𝑦̂, 𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 , 𝑘 – must be systematically linked. To delve into these links, we
follow Adams et al (2021) by substituting 𝐿 = √𝑘 in the exchange function, though this is not
necessary and one can simply use √𝑘 instead of 𝐿 in subsequent analysis.63 With this change,
𝐹 𝐶
the exchange function is 𝑥𝑦 = 𝐿2. For a given interval [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ], the virtual and real
reserves are linked by 𝑥 = 𝑥̂ + 𝑥 𝐶 and 𝑦 = 𝑦̂ + 𝑦 𝐹 . The exchange function is then:

(35) (𝑥̂ + 𝑥 𝐶 )(𝑦̂ + 𝑦 𝐹 ) = 𝐿2


𝐹 𝐶
Once the liquidity provider has specified interval [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ], the quantities 𝑥 𝐶 and 𝑦 𝐹 are
𝐹 𝐶
fixed along a level curve. This allows us to describe 𝑥 𝐶 and 𝑦 𝐹 in terms of 𝐿, 𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 .
𝐿
Specifically, we get that 𝑥 𝐶 = and 𝑦 𝐹 = 𝐿 √𝑃𝑌/𝑋
𝐹 64
. Plugging this in equation (35) yields:
𝐶
√𝑃𝑌/𝑋

𝐿 𝐹
(36) (𝑥̂ + )(𝑦̂ + 𝐿 √𝑃𝑌/𝑋 ) = 𝐿2
𝐶
√𝑃𝑌/𝑋

Equation (36) is useful because it tells us the various combinations of real reserves (𝑥̂, 𝑦̂) that
𝐶 𝐹
yield the same level of 𝐿 for given 𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 . In other words, it describes the behavior of
real reserves in the arc 𝐹𝐶 in Figure 9.
Next, consider any arbitrary point on the arc 𝐹𝐶 characterized by virtual reserves (𝑥, 𝑦)
𝑦
and price 𝑃𝑌/𝑋 = 𝑥 . It is worthwhile to describe real reserves at that point, (𝑥̂, 𝑦̂) = (𝑥 −
𝐹 𝐶
𝑥 𝐶 ,𝑦 − 𝑦 𝐹 ), in terms of 𝐿, 𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 :65

𝐿 𝐿 𝐹
(37) 𝑥̂ = − and 𝑦̂ = 𝐿 √𝑃𝑌/𝑋 − 𝐿√𝑃𝑌/𝑋
√𝑃𝑌/𝑋 𝐶
√𝑃𝑌/𝑋

Equation (37) allows us to see how logically consistent liquidity provision occurs on Uniswap-
v3 for an active position, when the current price is 𝑃𝑌/𝑋 . Eliminating 𝐿 in (37), we get:

𝐹
√𝑃𝑌/𝑋 −√𝑃𝑌/𝑋
(38) 𝑦̂ = 𝑥̂ ( 1 1 )

√𝑃𝑌/𝑋 √𝑃𝐶
𝑌/𝑋

63 However, as pointed out in Section 3.4.2, 𝐿 = √𝑘 is a better measure of liquidity. The idea of adding liquidity
from different positions is more intuitively captured using 𝐿.
64 At any arbitrary point (𝑥, 𝑦), we have that 𝑥𝑦 = 𝐿2 and 𝑦 = 𝑃 𝐿
𝑥 𝑌/𝑋 , which implies that 𝑥 = 𝑃 and 𝑦 =
√ 𝑌/𝑋
𝐿√𝑃𝑌/𝑋 . Since this is true at any arbitrary point, it holds at both points 𝐶 and 𝐹.
65 This follows directly from the previous footnote.

46

Electronic copy available at: https://ssrn.com/abstract=3722714


So, if a user specifies a certain quantity 𝑥̂ of token 𝑋, along with a price range bounded by
𝐶 𝐹
𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 , equation (38) determines the amount of token 𝑌 that must be added by the
user for liquidity provision at the current price of 𝑃𝑌/𝑋 . To see how this compares to Uniswap-
v1 and v2, recall that in these earlier versions, liquidity is provided over the entire range of
𝐹
the exchange function. This is equivalent to a position on Uniswap-v3 where 𝑃𝑌/𝑋 ⟶ 0 and
𝐶
𝑃𝑌/𝑋 ⟶ ∞; indeed, when these limits are taken in equation (38), we get 𝑦̂ = 𝑥̂𝑃𝑌/𝑋 , which is
the Uniswap-v1 and v2 liquidity provision rule.

5.3 Combining positions


Section 5.2 showed that for liquidity provision in a single position, given the current price
𝐶 𝐹
(𝑃𝑌/𝑋 ) and a user-defined price range (bounded by 𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 ), a specified amount 𝑥̂ of
token 𝑋 is associated with an amount 𝑦̂ of token 𝑌 (equation (38)) and a certain level curve
𝑘 = 𝐿2 (equation (37)). This can be now used to derive how multiple positions interact for
liquidity provision on Uniswap-v3.
Consider, to begin with, the simplest possible case when there are two positions defined
𝐹 𝐶
over the same price interval [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ], but where the liquidity providers specify two
separate quantities of token 𝑋 when providing liquidity: 𝑥̂ ′ and 𝑥̂ ′′ . At the current price of
𝑃𝑌/𝑋 , the amounts of token 𝑌 that must be added is given by equation (38). From equation
(37), we see that these amounts of 𝑋 are consistent with different level curves:
𝑥̂ ′ 𝑥̂ ′′
(39) 𝐿′ = 1 1 and 𝐿′′ = 1 1
− −
√𝑃𝑌/𝑋 √𝑃𝐶
𝑌/𝑋 √𝑃𝑌/𝑋 √𝑃𝐶
𝑌/𝑋

It is readily observed that summing these positions is equivalent to a single position with
𝑥̂ ′′′ = 𝑥̂ ′ + 𝑥̂ ′′ ; that is:
𝑥̂ ′ 𝑥̂ ′′ 𝑥̂ ′′′
(40) 𝐿′ + 𝐿′′ = 1 1 + 1 1 = 1 1 = 𝐿′′′
− − −
√𝑃𝑌/𝑋 √𝑃𝐶
𝑌/𝑋 √𝑃𝑌/𝑋 √𝑃𝐶
𝑌/𝑋 √𝑃𝑌/𝑋 √𝑃𝐶
𝑌/𝑋

This is shown graphically in Figure 10 below, where the real axes for the two positions have
been drawn with origins 𝑂̂ ′ and 𝑂̂ ′′ . The prices 𝑃𝑌/𝑋
𝐹 𝐶
, 𝑃𝑌/𝑋 and 𝑃𝑌/𝑋 correspond to the slopes
of rays 𝑂𝐹, 𝑂𝐶 and 𝑂𝑃, respectively. The amount of 𝑋 provided in the first position, 𝑥̂ ′ ,
corresponds to the distance 𝑂̂ ′ 𝑥̂ ′ . Once the user has determined the amount of 𝑋 to provide,
the corresponding amount of 𝑌 is given by equation (38) and is shown by the distance 𝑂̂ ′ 𝑦̂ ′.
The level curve corresponding to these real reserves can be determined by equation (39) and
is shown as 𝑘 ′ = (𝐿′ )2 . A similar set of arguments hold for the second position labelled with
‘’ on the graph. The combined liquidity provision is given by equation (40), and is depicted by
the level curve 𝑘 ′′′ = (𝐿′′′ )2 , where 𝐿′′′ = 𝐿′ + 𝐿′′ . The amount of 𝑋 in the combined position
is given by 𝑥̂ ′′′ = 𝑥̂ ′ + 𝑥̂ ′′ (the distance 𝑂̂ ′′′ 𝑥̂ ′′′ ), and the amount of 𝑌 is 𝑦̂ ′′′ = 𝑦̂ ′ + 𝑦̂ ′′ (the

47

Electronic copy available at: https://ssrn.com/abstract=3722714


distance 𝑂̂ ′′′ 𝑦̂ ′′′ ). Once the liquidity is provided, as the current price changes from 𝑃𝑌/𝑋 when
traders swap tokens, we move from 𝐴 along 𝑘 ′′′ till point 𝐵 or 𝐷 is reached, beyond which
the combined position becomes inactive and contains real reserves of only one token: 𝑋 (at
point 𝐷) or 𝑌 (at point 𝐵).

𝐵
𝑃

𝑦̂ ′′′ 𝐴

𝐹
𝐷
′′′
𝑦̂ ′′ 𝑂̂′′ ′ 𝑥̂
𝑘 ′′′ = (𝐿′′ ′)2

𝑦̂ ′ 𝑂̂′ ′ 𝑥̂ ′′

′ 𝑘 ′′ = (𝐿′′ )2
𝑂̂′ 𝑥̂

𝑘 ′ = (𝐿′ )2
𝑥
𝑂

Figure 10: Combining positions on Uniswap-v3

In general, intervals specified by liquidity providers may partially overlap (or not at all).
While this yields more complex graphs, the underlying logic is the same. In Figure 11 below,
we depict a scenario with a partial overlap, with the two user-specified price ranges being
𝐹′ 𝐶 ′ 𝐹 ′′ 𝐶 ′′
[𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ] and [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ]. These price ranges and the corresponding liquidities translate
the axes to 𝑂̂′ and 𝑂̂ ′′ , respectively. The prices can be read off the graph as the slope of rays
𝑂𝐹′, 𝑂𝐹′′, 𝑂𝐶′ and 𝑂𝐶 ′ ′. To keep the graph devoid of clutter, the figure does not contain
information such as the current price, the real reserves and so on.

48

Electronic copy available at: https://ssrn.com/abstract=3722714


The overlap of the price interval suggests that there are 3 disjoint ranges to consider:
𝐹′ 𝐹 ′′ 𝐹 ′′
𝐶 ′ 𝐶 𝐶 ′ ′′
[𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ], [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ] and [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ]. While the algebra of the breakdown is somewhat
messy, the intuition of what happens in this instance is clear from the geometry. Suppose we
𝐹 ′
start at a situation where the current price satisfies 𝑃𝑌/𝑋 < 𝑃𝑌/𝑋 ; at such a price both
positions are inactive and real reserves are held entirely in token 𝑋. When the price increases
𝐹 ′
to 𝑃𝑌/𝑋 = 𝑃𝑌/𝑋 , the first position is activated. This occurs at point 𝐴 in Figure 11.

𝑦 𝐶 ′′

𝐶′

𝐸
𝐹 ′′

𝐷 𝐹′
𝐻
𝐺

𝑂̂′ ′
𝐵
𝐴
̂′
𝑂 𝑘 ′′

𝑘′
𝑥
𝑂

Figure 11: Overlapping positions on Uniswap-v3

𝐹 𝐹 ′ ′′
In the price range [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ], only this position provides liquidity, so the relevant level
𝐹 ′′
curve is 𝑘 ′ . This holds till point 𝐵, but once the price reaches 𝑃𝑌/𝑋 = 𝑃𝑌/𝑋 the second position
𝐹 𝐶 ′′ ′
is activated. Consequently, in the range [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ], both positions are active, and the
relevant level curve of the exchange function is 𝑘, which combines both positions in that price
range. There is, in essence, a jump from point 𝐵 to 𝐷 to reflect the joining of a second position

49

Electronic copy available at: https://ssrn.com/abstract=3722714


𝐹 ′′
to liquidity provision. As the price increases beyond 𝑃𝑌/𝑋 , we move along the arc 𝐷𝐸; at point
𝐶 ′
𝐸, we have that 𝑃𝑌/𝑋 = 𝑃𝑌/𝑋 and all the real reserves in the first position have been converted
to token 𝑌, leaving only the second position with liquidity in both tokens to facilitate further
𝐶 𝐶 ′ ′′
swaps by traders that involve the purchase of 𝑋. In the final range [𝑃𝑌/𝑋 , 𝑃𝑌/𝑋 ], only the
second position is active, so we drop to point G on the level curve 𝑘 ′′ . Further price increases
𝐶 ′′
involve moving along the arc 𝐺𝐻, till 𝑃𝑌/𝑋 = 𝑃𝑌/𝑋 , at which point real reserves of 𝑋 are
exhausted in the second position as well.
There are two features to take away from this discussion. First, unlike Uniswap-v1 and v2,
trade does not take place along a single level curve. Rather, as shown by Figure 11, there are
jumps in the level curves as trading occurs, leading to discontinuities. In Figure 11, there are
three discontinuous arcs that characterize liquidity provision: arc 𝐴𝐵, arc 𝐷𝐸 and arc 𝐺𝐻.
Secondly, despite this added complexity, the geometry behind Figure 11 is straightforward,
and combining additional positions is readily visualized using the same procedure.66
Unsiwap-v3, therefore, functions differently than its predecessor v2 in significant ways.
While the same exchange function is used to convert (now virtual) reserves to prices, the
introduction of concentrated liquidity produces features that are distinct. Apart from the
liquidity provisioning being discontinuous, each position behaves similar to a CSMM in the
sense that it can run out of one reserve or the other, which cannot occur on Uniswap-v1 an
v2. It is intuitive that adding concentrated liquidity to other AMMs, such as a CMMM like
Balancer, will also produce such changes. As a consequence, it may be worthwhile to add to
the alphabet soup of AMM labels by giving AMMs with concentrated liquidity their own
name, perhaps Concentrated Liquidity Market Makers (CLMMs).67
Having pointed out how different Uniswap-v3 is to v2 and v1 in terms of yielding
discontinuous liquidity levels, we conclude our analysis of Uniswap-v3 by summarizing when
its liquidity provision does correspond to continuous curves in a manner similar to earlier
𝐹
versions. The first is when all liquidity providers specify a price range where 𝑃𝑌/𝑋 = 0 and
𝐶
𝑃𝑌/𝑋 = ∞; this replicates Uniswap-v2 essentially because concentrated liquidity is no longer
relevant. The second is when the level curve is partitioned by positions; partitioning implies
that positions are disjoint and cover the entire range of prices. This is shown in Figure 12
below, where there are four disjoint positions, all of which involve liquidity provision such
that they lie on the level curve 𝑘. Here, trading occurs along a single level curve with no
discontinuities, like Uniswap-v2. However, each position can be drained of a single reserve,
like a CSMM (dashed lines). Consequently, Figure 12 highlights the somewhat hybrid nature

66 Though, as mentioned earlier, since price moves in ticks on Uniswap-v3 and fees are charged as well, the
actual computations are more complicated than those described here.
67 Cyclos, for example, labels itself as a concentrated liquidity market maker for the Solana network; see

https://cyclos.io (accessed 20th September, 2021).

50

Electronic copy available at: https://ssrn.com/abstract=3722714


of Unsiwap-v3.

𝑘
𝑂 𝑥

Figure 12: Partitioning the level curve on Unsiwap-v3

6. Conclusions
This paper presented a unified framework based on the neoclassical black-box to
characterize different types of AMMs that are currently popular as DEXs. One of the main
advantages of such a framework is that it provides a set of simple tools that can be used to
visualize the geometry of a given AMM. This makes it easy to see, for example, why the price
remains unchanged when both reserves are doubled. It also allows for a simple way to check
when manipulating a given exchange function makes a significant difference and when it does
not. In a CPMM, for example, the homotheticity property suggests that any monotonic
transformation of the exchange function does not alter the price for any given set of reserves,
making these various functions equivalent. Other properties, such as Euler’s theorem provide
a convenient method to value a liquidity pool in an AMM.
Importantly, the methodology also allows for comparisons across a variety of AMMs, in
order to examine how similar or different various types of AMMs are. While the coverage of
AMMs in this paper is certainly not exhaustive, especially since this is a fertile area for
innovation with new ideas for AMMs are being developed at a rapid pace, the analytical and

51

Electronic copy available at: https://ssrn.com/abstract=3722714


geometric tools described here are fairly general and (hopefully) present an intuitive
framework to allow new AMMs to be scrutinized and contrasted with existing AMMs.
The focus of this paper has been on the analytical framework behind AMMs. As such,
AMMs rely on arbitrage or oracles to align prices with the broader market. Our understanding
of how well arbitrage operates in this space and how it performs relative to oracles is still
nascent. This is partly an empirical endeavour (which has not been addressed in this paper at
all), but there are theoretical considerations here as well. For example, there are many
impediments (other than transaction fees) to how efficiently AMMs can operate. These
include phenomena such as frontrunning of trades, the worrisome presence of generalized
bots that are capable of traversing the landscape of the Ethereum terrain to ‘snipe’ arbitrage
transactions entered into by others, the reordering of transactions by miners, and so on.68
The last couple are particularly interesting, because they can destroy incentives to engage in
arbitrage: if arbitrage opportunities spotted by an agent (in the broadest of being any entity,
human or a program, that recognizes an arbitrage opportunity) are likely to be stolen by a
bot, there is little incentive to identify arbitrage opportunities in the first place. This questions
the incentive structure for arbitrage to be undertaken.
While this primer takes a fairly deep look at AMMs and DEXs, it barely scratches the surface
of advancements to financial instruments and institutions that are taking place in the DeFi
space. This paper does not, for example, examine borrowing and lending institutions being
developed, the use of derivatives such as perpetual swaps, or how stablecoins operate. 69
Moreover, as mentioned in the introduction, the main disadvantage of the black-box
approach is that it precludes an examination of many interesting issues, such as how
communities are formed in a decentralized environment, how governance takes place, what
restrictions are imposed by the ability to fork, and so on. In other words, there is much scope
for exciting research to be done in the DeFi space.
Like blockchains in general, DeFi is the amalgamation of different fields of expertise:
computer science, cryptography, finance, economics and game theory, to name a few. These
fields have developed with their own jargon, methodologies and tools of analysis, with ever
growing levels of sub-specialization and narrowness in expertise.70 It comes as no surprise,

68 See Daian et al (2019) for these and other issues related to vulnerabilities in the DeFi space. Robinson and
Konstantopoulos (2020) provide an interesting account of the Ethereum as a ‘dark forest’.
69 For a broader treatise on the current state of DeFi, see Harvey et al (2021).
70 In a memorable exchange between Sherlock Holmes and Dr. Watson in A Study in Scarlet, when the latter

expresses astonishment at the former’s lack of awareness of the solar system, Holmes responds, “A fool takes
in all the lumber of every sort that he comes across, so that the knowledge which might be useful to him gets
crowded out, or at best is jumbled up with a lot of other things, so that he has a difficulty in laying his hands
upon it. Now the skilful workman is very careful indeed as to what he takes into his brain-attic…” When Dr.
Watson persists, “But the solar system!”, Holmes counters with “What the deuce is it to me?”, and then goes
on to state, “You say that we go round the sun. If we went round the moon it would not make a pennyworth of
difference to me or to my work.”

52

Electronic copy available at: https://ssrn.com/abstract=3722714


then, that computers scientists and entrepreneurs at the forefront of the technological
developments in the blockchain space often invent new jargon and methodologies to
describe phenomena that economists have examined over many decades. At best this creates
confusion; at worst, it creates inefficiencies in the scientific process as one field reinvents the
knowledge already accumulated by another, or as one field eschews incorporating useful new
ideas due to the barriers imposed by multidisciplinary communication. This review presents
an attempt to connect advancements in DeFi with the traditional toolkit of economics for one
use-case of DeFi, and in doing so takes a few, admittedly small, steps forward in the direction
of developing an integrated theory of DeFi.

53

Electronic copy available at: https://ssrn.com/abstract=3722714


References
Adams, H., Zinsmeister, N. and Robinson, D. 2020. Unsiwap v2 Core.
https://uniswap.org/whitepaper.pdf (accessed 20th September, 2021).
Adams, H., Zinsmeister, N., Salem, M., Keefer, R. and Robinson, D. 2021. Uniswap v3 Core.
https://uniswap.org/whitepaper-v3.pdf (accessed 20th September, 2021).
Angeris, G., Kao, H., Chiang, R., Noyes, C. and Chitra, T. 2019. An Analysis of Uniswap Markets.
https://arxiv.org/abs/1911.03380 (accessed on 20th September, 2021).
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 (AFT '20).
Association for Computing Machinery, New York, NY, USA, 80–91. DOI:
https://doi.org/10.1145/3419614.3423251
Buterin, V. 2014. A Next Generation Smart Contract and Decentralized Application Platform.
https://cryptorating.eu/whitepapers/Ethereum/Ethereum_white_paper.pdf (accessed 20th
September, 2021).
Buterin, V. 2018. Improving Front Running Resistance in x*y=k Market Makers.
https://ethresear.ch/t/improving-front-running-resistance-of-x-y-k-market-makers/1281
(accessed 20th September, 2021)
Chiang, A.C. 1984. Fundamental Methods of Mathematical Economics. McGraw-Hill Inc., USA.
Daian, P., Goldfeder, S., Kell, T., Li, Y., Zhao, X., Bentov, I., Breidenbach, L., Juels, A. 2019. Flash
Boys 2.0: Frontrunning, Transaction Reordering and Consensus Instability in Decentralized
Exchanges. https://arxiv.org/pdf/1904.05234.pdf (accessed 20th September, 2021).
Demsetz, H. 1997. The Firm in Economic Theory: A Quiet Revolution. The American Economic
Review, 87: 426 – 429.
Dernburg, T.F. 1989. Global Macroeconomics. New York: Harper Collins Publishers, Inc.
Egorov, M. 2019. StableSwap – Efficient Mechanism for Stablecoin Liquidity.
https://curve.fi/files/stableswap-paper.pdf (accessed 20th September, 2021).
Hanson, R. 2003. Combinatorial Information Market Design. Information Systems Frontiers,
5: 107 – 119.
Hanson, R. 2007. Logarithmic Market Scoring Rules for Modular Combinatorial Information
Aggregation. The Journal of Prediction Markets, 1: 3 – 15.
Hart, O. 1995. Firms, Contracts and Financial Structure. Oxford University Press, New York.
Hertzog, E., Benartzi, G. and Benartzi, G. 2018. Bancor Protocol.
https://storage.googleapis.com/website-bancor/2018/04/01ba8253-
bancor_protocol_whitepaper_en.pdf (accessed 20th September, 2021).
Holmstrom, B. and Tirole, J. 1989. The Theory of the Firm. In R. Schmalensee and R.D. Willig
(eds.), Handbook of Industrial Organization, vol 1, Handbooks in Economics, no. 10,
Amsterdam: North Holland, 61 – 133.
Martinelli, F. and Mushegian, N. 2019. Balancer: A Non-custodial Portfolio Manager, Liquidity

54

Electronic copy available at: https://ssrn.com/abstract=3722714


Provider, and Price Sensor. https://balancer.finance/whitepaper/ (accessed 20th
September, 2021).
Mas-Colell, A. Whinston, M.D. and Greem, J.R. 1995. Microeconomic Theory. New York:
Oxford University Press.
Mellow Protocol. 2021. Uniswap V3: Liquidity Providing 101.
https://mellowprotocol.medium.com/uniswap-v3-liquidity-providing-101-f1db3822f16d
(20th September, 2021)
Moosa, I. 2010. International Finance: An Analytical Approach (3rd edition). Sydney: McGraw-
Hill Australia Pty Ltd.
Pintail. 2019. Uniswap: A Good Deal for Liquidity Providers?
https://pintail.medium.com/uniswap-a-good-deal-for-liquidity-providers-104c0b6816f2
(accessed 20th September, 2021)
Pourpouneh, M. Nielsen, K. and Ross, O. 2020. Automated Market Makers. IFRO Working
Paper 2020/08, available at https://www.econstor.eu/handle/10419/222424 (accessed 20th
September, 2021).
Robinson, D. and Konstantopoulos, G. 2020. Ethereum is a Dark Forest.
https://www.paradigm.xyz/2020/08/ethereum-is-a-dark-forest/ (accessed 20th September,
2021).
Rosenfeld, M. 2017. Formulas for Bancor System. http://meissereconomics.com/assets/abfe-
lesson5-bancor.pdf (accessed 20th September, 2021).
Schär, F. 2021. Decentralized Finance: On Blockchain and Smart Contract-based Financial
Markets. Federal Reserve Bank of St. Louis Review, 103: 153 – 174.
https://doi.org/10.20955/r.103.153-74.
Silberberg, E. 1990. The Structure of Economics: A Mathematical Analysis. McGraw Hill, Inc.,
USA.
Szabo, N. 1996. Smart Contracts: Building Blocks for Digital Markets.
https://www.fon.hum.uva.nl/rob/Courses/InformationInSpeech/CDROM/Literature/LOTwi
nterschool2006/szabo.best.vwh.net/smart_contracts_2.html (accessed 20th September,
2021).
Tassy, M. and White, D. 2020. Growth Rate of a Liquidity Provider’s Wealth in 𝑋𝑌 = 𝑐
Automated Market Makers.
https://math.dartmouth.edu/~mtassy/articles/AMM_returns.pdf (accessed 20th
September, 2021).
Varian, H. 1987. Intermediate Microeconomics: A Modern Approach. New York: W.W. Norton.
White, D., Tassy, M., Noyes, C. and Robinson, D. 2020. Uniswap’s Financial Alchemy.
https://research.paradigm.xyz/uniswaps-alchemy (accessed 20th September, 2021).

55

Electronic copy available at: https://ssrn.com/abstract=3722714


Xu, J., Vavryk, N., Paruch, K. and Cousaert, S. 2021. SoK: Decentralized Exchanges (DEX) with
Automated Market Maker (AMM) protocols. https://arxiv.org/abs/2103.12732 (accessed
20th September, 2021).
Zhang, Y., Chen, X. Park, D. 2018. Formal Specification of Constant Product (𝑥𝑦 = 𝑘) Market
Maker Model and Implementation. https://github.com/runtimeverification/verified-smart-
contracts/blob/uniswap/uniswap/x-y-k.pdf (accessed 20th September, 2021).
Zhou, L., Qin, K., Ferreira Torres, C., Gervais, A. 2020. High-Frequency Trading on
Decentralized On-Chain Exchanges. https://arxiv.org/abs/2009.14021 (accessed 20th
September, 2021).

56

Electronic copy available at: https://ssrn.com/abstract=3722714

You might also like