Decentralized Exchanges: The Competitive Edge for Continuous Product Market Makers.

Abstract

In this paper, we analyze constant product market makers (CPMMs). We formalize the profitability conditions of the liquidity providers and introduce a concept we call the profitability limit in xyk-space. We examine the impact of mint and burn fees on profitability, look at different pool types, and compile a large dataset of all Uniswap V2 transactions. We use this data to further investigate our theoretical framework and profitability conditions. We show how the profitability of providing liquidity is severely affected by the cost of mint and burn calls relative to the size of the portfolio and the characteristics of the trading pair. Index Terms - Automated Market Maker, Blockchain, Constant Product Market Maker, Decentralized Exchange, Decentralized Finance, Uniswap.

Introduction

Constant product market makers (CPMM) are smart contract-based liquidity pools with two different types of assets. They act as neutral exchange infrastructure and use an endogenous pricing model based on the percentage of their token reserves. Generally speaking, the relative price of token y increases as a CPMM's reserve of token x decreases in comparison to its reserve of token y.

Anyone can join the pool contract as a liquidity provider (LP) by adding tokens in accordance with the pool ratio. They can later withdraw their proportionate share of the liquidity in the pool to redeem their share and end their position. In a sense, LPs serve as passive market makers. Their selection (i. e. Every time someone makes a swap using the CPMM, the (ratio between x and y token holdings) changes. Part of the trading fees are received by LPs as compensation for the opportunity costs and risks associated with passive market making.

In this paper, we look at the literature and present a formal framework for our analysis. Section IV covers a concept called the profitability frontier in the xyk-space, where we explore the impact of mint and burn fees, as well as different types of pools. Section V looks at Uniswap V2 pools, and examines how different fee sizes and pool types can affect profitability. Finally, in Section VI we chat about our findings and wrap things up.

It looks like the concept of blockchain-based automated market makers (AMMs) was first suggested by a couple of people. Later, someone simplified the model and added some extensions. Someone else broadened the concept to allow for different token weights and pools of more than two assets. Plus, modifications for specific use-cases such as stablecoin exchanges were proposed. And then, the concept of concentrated liquidity was introduced. There's a lot of literature on the design and properties of AMMs, plus a general framework for the analysis of the major subset of AMMs. Also, there have been studies on the efficiency of AMM designs with respect to price discovery and comparing them to centralized exchanges. Simulation results have shown that AMMs can theoretically act as sound price oracles. And finally, others have looked into replicating the payoffs of financial derivatives and the market microstructure of AMMs.

Lots of studies have been done on the profitability of supplying liquidity to AMMs. For example, [22] and [23] look at the link between traders' data sets, liquidity provider returns, and the decision to use centralized or decentralized exchanges. [24] assess the risk profile of LPs and point out the variations when there's lots of liquidity. [25] break down the LP returns into a quickly changing market risk portion and a predictable part, which they refer to as "loss-versus-rebalancing". [26] look at the returns of LPs of Uniswap V2 pools and track the movement of liquidity between pools. [27] invent the concept of expected loss and use it to research CPMMs with a lot of liquidity. On top of that, [28] analyse Uniswap V3's capability to deal with unpredicted price movements.

Freamework

We're exploring CPMMs with two assets for this paper - let's call them x and y. The reserve conditions are set out in equation (1), where k is the product of x and y. We can take three actions to affect the pool's reserves: exchange one token for the other, deposit x and y tokens into the pool (mint) and remove tokens from the pool (burn).

$$x.y=k [1]$$

A.Token to Token Swap

We're exploring CPMMs with two assets for this paper - let's call them x and y. The reserve conditions are set out in equation (1), where k is the product of x and y. We can take three actions to affect the pool's reserves: exchange one token for the other, deposit x and y tokens into the pool (mint) and remove tokens from the pool (burn)

$$α=Δ(x)/x$$

$$β=α(y)/y$$

Assume Δ(x) to be fixed. Essentially, the trader gives a certain amount of x-tokens to the pool. The amount of tokens in the reserve before the trade (y0) and the change in the token reserves (∆(y)) are described as:

$$y'=1/1+α.y$$

$$Δ(y)=α/1+α.y [2]$$

Relative prices are given by the first derivative of k at a given point, allowing us to write respectively as this:

$$Px=y/x$$

$$ Py=x/y$$

B. Liquidity Provision and Redemption

Anyone can contribute liquidity to the pool by providing n x-tokens and -tokens to the smart contract. This changes the token amounts as well as the constant k. The ratio between the two tokens remains unchanged. Both reserves are increased by the factor like this:

$$℘=Δ(x)/x=Δ(y)/y$$

As shown as this:

$$K⁰=(1+∅)²k[3]$$

In return, the LP receives (mints) a corresponding amount of liquidity tokens that represent partial pool ownership and can be redeemed for their proportional share of the pool’s token holdings. Redemption is referred to as a burn action. It is the exact opposite of a mint action and reduces the pool’s k-value.

C. The Role of Trading Fees

To incentivize liquidity provision, the model relies on trading fees. Let us assume a fee ρ ∈ [0,1) with γ := 1 − ρ. The fee is charged on every trade and added to the liquidity pool and therefore leads to an increase in the normalized k, i.e., the k-value in relation to the outstanding liquidity tokens. Applying a fee to both equations in (2) leads to the following equations for the new token reserves as well as the change in token reserves:

$$Y'p=(1/1+αγ).y$$

$$ Δ(Yp)=(αγ/1+αγ).y[4]$$

If you're swapping x-tokens for y-tokens using the CPMM, you'll get a diminishing return for each x-token you send to the smart contract. For a given amount of x-tokens, the contract will be able to quote a relative exchange rate and an amount of y-tokens that won't exhaust the reserves. And when you contribute liquidity to the pool by giving x-tokens and y-tokens, you get liquidity tokens which represent partial pool ownership, and you can redeem them for your share of the pool's token holdings. To encourage liquidity provision, the model calls for trading fees, which get added to the pool and increase the k-value in relation to the outstanding liquidity tokens.

$$X⁰+Y⁰(x¹/y¹) [5]$$

$$ X¹+Y¹(x¹/y¹)=2x¹ [6]$$

Let's take a look at trading tokens. So, if someone wants to trade x-tokens for y-tokens, they send ∆(x) of their x-tokens to the smart contract. But since the smart contract adds a fee to the liquidity pool, the trade only yields ∆(yρ) y-tokens. So, the question is, is it worth it for the investor to provide liquidity, or would it be better to just stick to the initial allocation of x and y? We can figure this out by comparing the return from liquidity provision with the return from a pure hold strategy. If the liquidity pool investment value in x-terms is higher than the buy and hold value, then it's worth it. But two factors may lead to a lower return for liquidity provision compared to a pure hold. First, the fees get assigned proportionally to all LPs. And second, when the price ratio shifts away from the initial ratio, the LP will own less of the more valuable token, which is called divergence or impermanent loss. So, it's possible that (5) = (6), or (5) > (6) or (5) < (6). The equation x0 · y0 ≡ x1 · y1 helps us figure out the difference between the two strategies.

FORMAL LP PROFITABILITY ANALYSIS

It can be proven that (5) is less than (6). To start, rewrite the equation in terms of x1, expand it with x0, and replace x1 and y1.

Case 4: Equating (5) and (6) and solving for y1 results in (9). Both effects present, the profitability of the investment is determined by which effect is more prominent. Equation (9) can be seen as the profitability frontier with a convex profitability set. This allows us to view the profitability frontier and set in xy-space, as seen in Figure 1. Figure 1 displays the profitability frontier (dotted curve) and the profitability space (shaded gray). For any given k1 (bigger than k0), there's a set of price ratios y-tokens that are profitable. From (9) the limits of the profitability frontier can be derived. Transactions on the Ethereum network are subject to network fees. These fees are different from the trading fees mentioned. They're paid for every transaction on the Ethereum network, which includes the three actions that affect CPMM reserves (swap, mint, and burn). Network fees are denoted in units of gas and have a cost associated with them. When a transaction calls a smart contract function, it executes all operations within it, so each contract call has a gas cost. Transaction fees are calculated by multiplying these gas units with a per unit price. This per unit price includes a global base fee that adjusts to the demand of block space, as well as a voluntary tip (chosen by the sender). A higher tip increases the chance of getting included in the next block and decreases the expected confirmation time. In the case of decentralized exchanges, this is important, as transactions need to be done quickly. Providing and closing a CPMM position requires multiple transactions, which can involve up to five blockchain transactions. The corresponding transaction fees can impact the profitability y-tokens.

LPs have to pay a burn fee, denoted by ς1. This fee depends on the base fee, the competition in the mempool, and the relative prices of the two pool tokens compared to ETH. If the pool token prices go up or down relative to ETH, it affects the proportional effect of the fee. If we don't have wETH, we assume that the price stays the same compared to ETH. This is because prices when minting are the best predictors for future prices. The shift in profitability caused by the burn fee is shown in Figure 2, which shows the k-indifference curve between P1 and P1 getting narrower.

If you're looking to make a profit with CPMM pools, you need to keep in mind the prices of the two tokens. We have extra info if one of the tokens is wETH, since it can be exchanged for ETH at a 1:1 rate. This means the profitability of the pool will be slightly different compared to the standard case. To work out the exact number, we can use (14) and (17) to get (15) and (18) respectively.

This section takes a look at the profitability frontier of Uniswap V2 transactions, using blockchain data. We examined 132,657 pools, with a total of 2,371,811 mint, 1,048,613 burn, and 93,749,446 swap events from May 2020 to the end of 2022. To illustrate, we can look at Figure 4, which shows one mint event (starting point) and the pool path in xykspace over the next 360 days. Figure 5 and 6 show the reserve changes for different holding periods and different fees. To analyze the data, we looked at the reserves per liquidity pool token after different holding periods (30, 90, etc.) in relation to the initial reserves.

For the UNI/WETH "open market" pool, the starting point of each observation is (1,1) and the gray area shows the profitability space without gas fees. The gray lines represent different assumptions of relative network fees, paid in wETH. If relative fees are too high, points outside the gray area won't be profitable, even if fees are zero. Profitability of points inside the gray area depends on the relative fee value. Table I shows the percentage of observations that were profitable for different holding periods and position sizes. Generally, small and medium-sized positions aren't profitable in the short-term, but larger positions have a better chance of being profitable. Volatility also plays a role, as higher volatility provides more opportunities to offset fees, but also has higher divergence loss risk. Unfortunately, the authors haven't been able to identify a pool with significant liquidity that fits the "Pure Trend" category.

In this paper, we looked into LP profitability in CPMMs. We figured out the profitability frontier and the related profitability set, and also discussed the effects of mint and burn fees. We found that small liquidity positions experience an implicit lock-in - this becomes more noticeable when network fees are higher. We then studied a big data set, which confirmed our expected results. This paper gives us a new analytical way to look at LP profitability and emphasizes the need for layer 2 developments and token approval process improvements. We want to thank Felix Bekemeier, Florian Bitterli, Dario Thurkauf, Mitchell Goldberg, Emma Middleton, Matthias Nadler, Remo Nyffenegger and Katrin Schuler for their help.