Research Summary: Axioms for Constant Function Market Makers

TLDR

The paper proposes an axiomatic approach to the construction of CFMMs for DeFi.
The approach is, as in any axiomatic theory, to formalize simple principles that are implicitly or explicitly used when constructing CFMMs and to check which classes of functions satisfy these principles, beyond those functions already in use.
The main axioms are independence – exchange rates should only depend on the inventories of the traded pair- and homogeneity. The former gives robustness against some types of price manipulation attacks, the latter makes liquidity fungible.
That characterizes a nicely parameterizable class with the Constant Product rule (CPMM) as an extremal point of the class.
If we replace homogeneity by translation invariance we get another import class of AMMs: Hanson’s Logarithmic Scoring Rule Market Makers (LMSR) famous in Prediction Markets.
Thus, there are important connections that relate CPMMs and LMSRs

Core Research Questions

Can we think systematically about the construction of trading functions for CFMMs? What are desirable properties of such functions and what classes of functions are characterized by combinations of desirable properties? Can we make sense of the constant product rule from first principles?

Citation

Schlegel, Jan Christoph and Kwaśnicki, Mateusz and Mamageishvili, Akaki, Axioms for Constant Function Market Makers arXiv:2210.00048

Background

CFMMs for DeFi have been one of the most successful new market design innovations introduced in the blockchain context. Their simple economic design is notably different from the design of traditional financial exchanges such as continuous time limit order books. The state of a typical AMM used in DeFi consists of the current inventories of the traded tokens. Trades are made such that some invariant of these inventory sizes is kept constant. Traders who want to exchange tokens of type A for tokens of another type B, add A tokens to the inventory and in return obtain an amount of B tokens from the inventory so that the invariant is maintained. While CFMMs proved to be very popular and reliable, the construction of invariants to define them seems in many ways ad-hoc and not based in much theory.

AMMs have originally been introduced in the context of prediction markets where a lot of the theory behind AMMs has been developed. However, prediction markets and markets for tokens are quite different and lead to different design considerations: Assets in a prediction market are artificially created Arrow-Debreu securities. Moreover, the market is sufficiently complete so that traders can hold a risk-less portfolio that always pays out one unit of numéraire in every state of the world. As a consequence of this, AMMs for a prediction market are usually assumed to satisfy ”translation invariance” which means that the marginal prices of the traded assets measured in the numéraire always add up to one.

There is difference in the choice of numéraire and its role in trading between the two applications. In prediction markets, the numéraire is usually a regular currency such as US dollars and traders exchange assets against the numéraire rather than swapping assets for each other. The counterparty at settlement is the prediction market organizer who sells the securities to traders and therefore is the sole liquidity provider. In the DeFi application, the numéraire is an ”LP token” which is a derivative product that is a claim to a fraction of the pooled liquidity and the accrued trading fees of the AMM. As a consequence typical DeFi AMMs satisfy scale invariance (homogeneity) instead of translation invariance.

Summary

The paper studies the standard model of CFMMs defined through trading functions. An AMM is defined by a trading function that assigns to each inventory vector a real number. The number can be interpreted as a measure of liquidity in the AMM, if tokenized this can be interpreted as the number of LP tokens issued.

  • Several axioms are introduced, see the method section below for a description of the axioms.
  • There are two kinds of results in the paper: those that hold for the case of more than two tokens traded in the AMM and those where are exactly two tokens are traded in the AMM.
  • For n>2, the key axiom is independence. There are three main results in that case. The first characterizes homogenous and independent CFMMs. The second observes that homogeneous, independent, symmetric AMMs with un-concentrated liquidity can be fully ranked by the convexity of their liquidity curves and the (multi-dimensional version of the) constant product rule is the least convex (and thus most favorable for traders) within this class. The third characterizes LMSRs by translation invariance and independence.
  • For n=2, there are two kind of results: if the axiom of “LP additivity“ is used instead of independence (which only makes restrictions in the multi-dimensional case), one can get the same kind of results as for n>2. If LP additivity is not imposed, AMMs can be non-separable and we get a much larger class. The larger class has, however, still a succinct description.
  • The characterization result can alternatively be obtained using the trading function description,the dual portfolio function description of AMMs, or the Cost Function approach popular in the prediction market literature.

Method

The paper develops a theory of CFMMs based on an axiomatic approach. The axiomatic approach has previously been used in several other domains in economics, for example in the theory of bargaining (Nash bargaining solution), cooperative games (Shapley value), problems of cost sharing, resource allocation and - in the blockchain context- block rewards arXiv:1909.10645 . Axiomatic methods are most helpful in situations where the design space is very large and other approaches do not help to pin down particular rules. CFMMs fit well in this category since, potentially, any family of continuous and monotonic curves defines a feasible CFMM.

The axiomatic method defines simple reasonable principles and deduces which functional form the combination of these principles implies.

There are several key axioms throughout the paper:

  • Homogeneity: This requires that the trading function is a homogeneous function (Homogeneous function - Wikipedia). Homogeneity means that adding liquidity at once or piecewise leads to the same liquidity position. Therefore LP positions are fungible. Practically, most AMMs in use have fungible LP tokens, with the notable exception of Uniswap V3 LP positions which are represented by NFTs. For example, a “Curve“ liquidity position is an ERC20 token which requires that the trading function is homogeneous (and it can indeed be checked that this is the case).
  • Translation Invariance: This requires that the value of the inventory scales linearly if the same amount is added to each of the traded assets.
  • Aversion to (im)permanent loss: This requires that liquidity curves are convex. Convexity just means that the marginal exchange rates are increasing in the size of the trade. The larger my trade the more price impact I have. This is satisfied by almost all real-world examples.
  • Unconcentrated Liquidity (alternatively called Sufficient Funds): This requires that the AMM always makes a market. Liquidity is provided globally. A case where this principle is violated is the Uniswap V3 AMM where LPs can choose to provide liquidity in a bounded interval.
  • Symmetry: This requires that market making is symmetric in the different tokens. Most AMMs used in practice satisfy it. An example where symmetry fails are Balancer pools with unequal weights.

For the case of more than two tokens in the AMM there is:

  • Independence: This requires that the exchange rate between two tokens is not influenced by adding or removing liquidity for another token or by trading another token pair.

For the case of exactly two tokens there is an alternative axiom:

  • LP additivity: Instead of exchange rates between tokens, we can also consider the exchange rates between tokens and LP tokens (practically, we can always provide liquidity in a single token by first swapping some amount of it for the other token and then provide liquidity to the AMM). LP additivity puts restrictions on how these token-LP token exchange rates are related to each other. More precisely, under LP additivity, liquidity is additive in the following sense: if adding x units of liquidity for token A gives the same LP position as adding y units of liquidity for token B, and if adding x’ units of liquidity for token A gives the same LP position as adding y’ units of liquidity for token B, after x and y have already been added to the liquidity pool, then adding x+x’ units of liquidity for token A should also give the same LP position as adding y+y’ units of liquidity for token B.

LP additivity makes liquidity curves

  • separable: we can write the trading function as the sum or product of two one-dimensional functions e.g. the constant product rule x*y=k is separable as is the constant sum x+y=k. More generally we can get curves of the kind g(x)h(y)=k or g(x)+h(y)=k for increasing and continuous functions g and h.

Results

There are two kinds of results in the paper, those that work for n>2 token types and those that work for n=2 token types.

For n>2, the first main result is that CFMMs that are homogeneous and independent are either weighted geometric means (such as in Balancer) or sums of monomials (this class has been described under a variety of names in the DeFi setting, see e.g. the Clipper whitepaper https://github.com/shipyard-software/market-making-whitepaper/blob/main/paper.pdf). The paper also shows that homogeneity can be slightly weakened to „scale invariance“. Adding aversion to (im)permanent loss, gives those AMMs within this class that are dominated (when ranked by curvature) by the constant sum AMM. Adding the un-concentrated liquidity requirement instead, gives those AMMs within this class that are dominated (when ranked by curvature) by the constant geometric mean. In particular, in the case of symmetric AMMs, the multi-dimensional version of the constant product rule is at the extreme end of the class, in the sense that it offers the best terms of trade for traders. This gives a possible normative justification of the constant product formula.

The other main result for n>2, replaces homogeneity by translation invariance and obtains Hanson’s LSMRs rules. Thus the seemingly different rules, LSMRs and constant product rules, are closely related. They are only distiguished by a different invariance property that has to do with the different role of the numéraire in the two applications.

For n=2, there are two kinds of results. The first characterizes homogeneous, symmetric AMMs satisfying the aversion to (im)permanent loss and un-concentrated liquidity. They form a large class, but can conveniently be described by concave increasing bijections on the unit interval whose derivative approaches 1/2. Thus choosing a liquidity curve is equivalent to choosing a simple function on the unit interval. The second obtains similar characterization results as for the case n>2, with the independence axiom is replaced by the LP additivity axiom.

Discussion and Key Takeaways

A key message of the paper is that the construction of CFMMs can be studied systematically and that the axiomatic approach can inform the design of CFMMs. Popular formulas in use can be rationalized by identifying desirable properties that they satisfy and the design space of all formulas satisfying different combination of these desirable properties can be parameterized and described. Therefore, the trade-off between different properties can be clearly formulated with the goal to actually inform design.

Implications and Follow-ups

The paper formulates general principles for the construction of CFMMs in the case where the tokens represent different assets. It has less to say about the case where the traded tokens should be perfectly correlated in value, as it is the case for stable coin AMMs for example. It would be interesting to have a systematic axiomatic approach to that case as well. Some axioms used in the present paper are reasonable also in that case (homogeneity, aversion to (im)permanent loss, symmetry and un-concentrated liquidity) while the independence or separability assumption in the main characterizations do not make too much sense in that context. So a natural follow up question is to describe alternative design principles in the case of stable coin swaps, and characterize the design space in that setting.

Applicability

Many of the formulas discussed and characterized in the paper are already in use in practice. However, the design space described by different combination of axioms usually is larger and also contains other CFMMs not used in practice. One advantage of the axiomatic approach is to narrow down the design space and to give easy descriptions (parameterized) of families of curves that satisfy reasonable design principles. This is a good starting point to design new CFMMs tailored to other applications while still satisfying general desirable design principles.

6 Likes