Untitled

Introduction

In the development of DEX, mainstreams include iterations of algorithms and changes in market making. From constant price and constant product market-making curve to various concentrated liquidity algorithms, the underlying market-making algorithms of DEXs are becoming more and more efficient. DEXs used concentrated liquidity solutions perform well in the market, Uni V3, Curve V2, and DODO are the top three. Each has adopted different methods to achieve liquidity concentration and improve the capital efficiency of LP funds. In this article we will deeply compare the underlying algorithms’ data performance of three DEXs, analyze the underlying market-making algorithms from multiple dimensions, and compare their overall market performance.

Concentrated Liquidity

There can be economy only where there is efficiency. ——Benjamin Disraeli

The constant product function, x*y=k, is a breakthrough innovation in the DeFi field. It enables Automated Market Making and realizes on-chain exchanges. However, the constant product AMM market-making curve has unavoidable efficiency issues.

Uniswap(Uni) used the constant product market-making function in its early version. As the figure shows, the liquidity is evenly distributed on the curve, and the theoretical fluctuation range of token prices is from 0 to infinity. The actual market range of token prices concentrates within a small range. It means the liquidity outside the price range is not provided to the market, resulting in a loss of efficiency. In this case, slippage, market depth, and impermanent losses are negatively affected.

Untitled

                                                       *Source: Curve Whitepaper*

Concentrated liquidity is to change the liquidity distribution on the market-making curve in a certain way, concentrating liquidity in the most frequently traded range in the market and improving the efficiency of market-making funds. Any attempt to adjust the market-making curve to change the liquidity distribution of pools can be called concentrated liquidity. Uni V3, Curve V2, and DODO are typical DEXs with concentrated liquidity yet significantly different underlying algorithms. The solution of concentrated liquidity is not sole, and its essence is to improve capital efficiency as much as possible to meet the demands of token trading and market-making.

Untitled

            *Three Market-Making Curves(from left to right are Uni V3, Curve V2, DODO)*

Uni V3, Curve V2, DODO - Three Market-Making Curves for Concentrated Liquidity

Uni V3

Range Order and Leveraged Liquidity

Uni V3 proposes range order. It allows users to provide liquidity in a specific price range, concentrating liquidity in a given price range while the liquidity distribution of the entire pool is the sum of all orders. LP thus provides leveraged liquidity as their funds only work in the selected price range. Within this range, the earning efficiency of market-making funds improves; if it falls outside, the efficiency is invalid.

Untitled

                                                 *Mutiple Range Orders Schematic Diagram*

                        (*Source:《Uniswap V3: Liquidity providing 101》 by MellowProtocol)*

Uni V3 concentrates liquidity using the leveraged liquidity mechanism, which concentrates liquidity near the market price through LPs' behaviors, i.e., LPs subjectively predict the range of price operation. When the market price fluctuates, LPs will actively adjust the market-making range. A lot of adjustment behaviors will lead to changes in the overall liquidity distribution. Statistically, it will eventually fall at the near-market price. The overall efficiency is improved, but the efficiency change among users depends on their pending orders.

Untitled

USDC / ETH 0.3% Pool Liquidity Distribution(Source: Uniswap official website)

Design Analysis and its Pros & Cons

Uni V3 designs to improve LPs' capital efficiency. LPs can freely select the price range and customize market-making based on their own judgements. Such design improves the market-making efficiency of LPs as a whole but makes an unbalanced benefit between LPs and adds additional decision-making costs to LPs. Making market-making more proactive is contrary to DEX's intention of lazy market-making. Most retail investors cannot make market predictions; they will face a higher risk of impermanent losses brought by leveraged liquidity. This design also led to JIT (Just In Time) attacks which complicate the whole market-making process.

Curve V2

Automated Adjusted Pricing Curve

Curve V2 is designed by Curve for non-stable assets. The core idea is similar to Curve's StableSwap. Let's review the StableSwap proposed by Curve.

The first generation of Curve’s algorithm is quite straightforward. It is the weighted sum of two market-making curves: constant product and constant price. It makes the curve has less curvature around the fixed price, enabling a concentration of liquidity at the fixed price. In stablecoin transactions, the price concentrates around 1. This way, Curve achieves concentration of liquidity around 1, thereby improving capital efficiency.

Untitled

Untitled

                                                       *Source: Curve Whitepaper*

For non-stable assets, Curve V2 uses a market-making curve with the weighted sum of the constant product curve and the constant price curve, but it can dynamically adjust. The first-generation algorithm can only concentrate liquidity around a fixed price. At the same time, the new one can dynamically adjust this price and the degree of centralized liquidity according to the internal oracle. Curve V2 defines the K value as a dynamically adjusted parameter that determines the shape of the curve. The larger the value of K, the smaller the curvature, the closer the curve is to the constant price curve, and the more concentrated the liquidity.

Untitled

                                                       *Source:Curve Whitepaper*

Curve V2 will calculate D according to the internal oracle. The parameter D determines the anchor price, which is the price with the most liquidity. The algorithm of Curve V2 concentrates liquidity by mixing constant product and constant price curves, continuously updating the weights of the two curves, and determining the anchor price of liquidity concentration with internal oracle price, and achieving liquidity concentration near the market price.

Untitled

Design Analysis and its Pros & Cons

Curve V2 will calculate D according to the internal oracle. Parameter D determines the anchor price which has the most liquidity. The algorithm of Curve V2 concentrates liquidity by mixing constant product and constant price curves, continuously updating the weights of the two curves, determining the anchor price of liquidity concentration with internal oracle price, and achieving liquidity concentration near the market price.

DODO

Market Maker Adjusted Curve

DODO provides liquidity with PMM algorithm, which introduces the external price. Market makers concentrate liquidity near the market price through independent quotations. Unlike AMM-based market-making algorithms, the PMM algorithm calculates the price based on external price and inventory. When the external price changes, the exchange ratio of the token will change. When users trade with the pool, the token inventory changes, and so as the price. The token price determined by the PMM algorithm depends on the external price and user trading behaviors. DODO thus can adjust the liquidity distribution in advance and always keep the liquidity near the external price.

Untitled

The form of the PMM algorithm is as follows: Parameter i refers to the external price provided by the market makers; Parameter k is the parameter that controls the degree of liquidity concentration. The smaller the k, the more concentrated the liquidity is. Parameters B and Q are the inventory of tokens. This formula describes the relationship of marginal price with changes in inventory and external prices.

Untitled

DODO also provides a flexible pool-building plan where users can set the parameters.

Design Analysis and its Pros & Cons

The design of DODO refers to the liquidity distribution of CEX. The market makers provide the external price, and the external price provided by the oracle is the market price supported by the user transactions in CEX. CEX now has a dominant position in market liquidity, so adjusting liquidity according to external prices will greatly improve the efficiency of market making.

Comparison of Market-Making Curves - taking ETH trading pool as an example

Data Process

Each has different market-making algorithms, comparing the trading pools of different DEXs is very difficult, including data source issues, comparative analysis issues, and how to determine a comparison standard.

Thus, the data analysis in this paper is processed as follows:

Liquidity Distribution Data Performance - Is Liquidity Really Concentrated?

Uni V3

<aside> 💡 For Uni V3's USDC/WETH 0.05% pool on Ethereum, the overall liquidity has a high concentration level and large volatility, and varies in different market environments. In some cases, there is a large deviation between the market price and the price with the highest liquidity.

</aside>

Untitled

Uni V3 USDC/WETH 0.05% Pool Liquidity Distribution Changes(Data Source:Ethereum)

Price Range Average Liquidity within Range
2% 12.19%
6% 29.11%
10% 41.47%

The figure shows that the liquidity of Uni V3's 0.05% WETH/USDC pool has a high liquidity concentration most of the time. The liquidity within 10% accounts for an average of 40% of the total liquidity. It almost achieves concentrated liquidity. Overall, the liquidity concentration of Uni V3's WETH 0.05% pool has maintained a high level over a long period, realizing the design purpose of V3.

Untitled

  *Uni V3 USDC/WETH 0.05% Pool Liquidity Distribution (Data Source: Ethereum)*

The data shows that when the market fluctuates greatly, the liquidity distribution of the pool will change significantly, and the liquidity concentration near the market price will decrease rapidly. For example, we take two periods: from May 6th to May 13th and from June 10th to June 19th. In these two periods, along with the sharp drop in the price of ETH, the liquidity distribution of the pool had a rapid adjustment. A large number of user behaviors led to a significant decrease in the degree of liquidity concentration near the market price. The market-making range was adjusted to outside the market price, and the liquidity within 10% was reduced to below 10%. Therefore, we conclude that when the market price fluctuates violently due to the mechanism design of Uni V3, users will predict the market and withdraw liquidity in advance, reducing liquidity concentration.

Untitled

Uni V3 USDC/WETH 0.05% Pool Deviation between Market Price and Price with Highest Liquidity (Data Source: Ethereum)

The above picture compares the price with the highest liquidity and the market price. Observing the degree of deviation between the most liquid tick range and the market transaction price range, we can tell that the tick price with the highest liquidity in UniV3 is relatively close to the market price most of the time. But at some point, there is a big deviation.

DODO

<aside> 💡 The liquidity distribution of DODO's USDC/WETH pool is the most concentrated because DODO market makers generally set the K value to a very small value and update the reference price frequently to concentrate liquidity. Due to the high frequency of quotations by market makers on DODO, the market price and the price with the highest liquidity remain highly anchored.

</aside>