Tutorial on
Constant Function Market Makers

In Association with Financial Cryptography 2023

1-4pm, April 30, 2023

Bluesun Hotel Elaphusa
Bol, Bra─Ź, Croatia


Over the past several years, many decentralized exchanges (DEXs) have been implemented on permissionless smart contract platforms such as Ethereum, and their collective trading volume has grown to several billion dollars per day. These DEXs are rarely implemented as order books; instead, they are implemented as automated market makers. These automated market makers hold reserves of assets, contributed by liquidity providers, and use a fixed rule to determine if a trade is accepted. To date, all major DEXs are organized as constant function market makers, or CFMMs. To determine if trades are accepted, CFMMs use a simple rule: a function is evaluated on the current reserves and what the reserves would be, assuming the trade is completed. If the value of this function is the same on each of these evaluations, then the trade is accepted and the CFMM pays out (or receives) the amounts specified in the trade. This condition (that the function must remain constant when evaluated on the new reserves) gives CFMMs their name.

Goal of the tutorial

In this tutorial, we aim to give a mathematical overview of CFMMs, which have become one of the core building-blocks of decentralized finance (DeFi). While CFMMs were popularized through their use in DEXs, they have proven to be a more versatile primitive, enabling the replication of many financial derivatives. Allowing single-sided liquidity positions extends this replication result to almost any financial derivative seen in practice. Furthermore, recent research suggests that CFMMs could enable decentralized lending without discrete liquidiations. We'll point out several avenues of future research which may be of interest to attendees.


We will start by defining CFMMs and examining their properties through the lens of convex geometry. We will then present the results on portfolio replication and explore the duality between portfolio value functions and CFMM trading functions. Next, we will discuss how CFMMs interact with smart contract platforms and explore a number of interesting consequences of atomicity, including oracle manipulation, arbitrage, and other topics in the realm of miner extractable value, sometimes known as MEV. Finally, we will discuss the problem of fragmented liquidity and how to solve this via smart order routing. A specific schedule of topics is given below.

  • The trader's perspective: overview of constant function market makers (CFMMs)
    • - Definitions & basic properties
    • - Trades: swaps, exchange functions, and multi-asset trades
    • - Examples from live systems: Uniswap, Balancer, Curve, and friends
  • The liquidity provider's perspective: replicating portfolios with CFMMs
    • - Proof of the equivalence of consistent portfolio value functions and CFMMs
    • - Extension to monotonic payoffs via single-sided liquidity
    • - Examples: covered calls, variance swaps, and more
  • The MEV searcher's perspective: atomicity and its consequences
    • - Decentralized oracles & manipulation
    • - Frontrunning, backrunning, sandwiching, and arbitrage
    • - Optimal routing and order execution
  • Possible post-tutorial dinner! (Please RSVP here if interested)

We assume a reasonable background in advanced undergraduate or beginning graduate mathematics, including linear algebra and basic optimization.

Organizing Committee