The Conceptual flaws of Constant Product Automated Market makers

by Andreas Park

 

Research Presentation

 

How should one organize DEX trading?

How do you set the price?

  1. Use an oracle
  2. Use a hard-coded function

DEX Trading keeps on growing

But there is a dark side: miner extractable value

Mempool \(\Rightarrow\) Front-Running!

So what's the Problem?

a

b

c

d

e

f

g

However: although front-running is annoying, it is only a concern if it is intrinsically profitable.

My paper:

  • current pricing mechanisms in swap DEXes fundamentally allow arbitrage
  • pricing based on a canonical microstructure model does not
  • \(\to\) there is a way shut down MEV at the source

The Problem: the constant product pricing function

automated market maker

Price mechanism:

  • \(X=\) contract balance of asset \(A\)
  • \(Y=\) contract balance of asset \(B\)
  • \(k=\) invariance factor
  • key relation \(k=X\times\ Y\)

Prices

  • when you want to sell \(x\le X\) you receive \(y\) that maintains invariance. 
  • implied exchange rate: \(e=\frac{x}{y}\)

Problem: MEMPOOL Frontrunning is intrinsically profitable

\(X\)

\(Y\)

normal trade: sell \(x\) \(\to\) get \(y'\)

\(Y-y'\)

\(X+x\)

front-running:

  1. front-runner: sells \(x\) \(\to\) gets \(y'\)
  2. front-run: sells \(x\) \(\to\) gets \(y''\)
  3. front-runner: buys \(x\) \(\to\) pays \(y''\) 

\(Y-y'-y''\)

\(X+2x\)

\(y'>y''~\Rightarrow\)

front-running is intrinsically profitable

Disclaimer:

  • this problem is well-known
  • fees can mitigate it
  • several protocols such as the latest iteration by Balancer try to combat it

Problem: MEMPOOL Frontrunning is intrinsically profitable

\(X\)

\(Y\)

\(Y-y'\)

\(X+x\)

\(Y-y'-y''\)

\(X+2x\)

\(y'=y''~\Rightarrow\)

front-running is not intrinsically profitable

What would be desirable?

Hard-Coded Market Making

  1. Time consistent: cannot profitably split orders over time.
     
  2. Front-running is not intrinsically profitable. 
     
  3. Liquidity splitting invariance
     
  4. No Multi-venue arbitrage/ping-pong trading

   

CPAMM

canonical

A simple calibration exercise

What does the data say?

What you will learn if you read my work

  • With mempools, front-running is always a possibility
    • \(\Rightarrow\) must avoid design that makes it intrinsically profitable
    • \(\Rightarrow\) most swap exchanges make it so! (fees are only a band-aid)
  • There is also
    • ping-pong trading
    • rule is ad hoc and nothing says that it has any relationship to demand and supply
  • Empirically, mempool arbitrage and gas auctions push up gas costs to astronomical levels.
  • There is a better way:
    • correctly designed "linear" (marginal) pricing makes front-running and ping-pong trading unprofitable 
    • \(\Rightarrow\) there is merit to traditional economic thinking even in DeFi \(\ldots\)

@financeUTM

andreas.park@rotman.utoronto.ca

slides.com/ap248

sites.google.com/site/parkandreas/

youtube.com/user/andreaspark2812/

Conceptual Flaws of Constant Product Market Makers - BTS 2021

By Andreas Park

Conceptual Flaws of Constant Product Market Makers - BTS 2021

  • 481