DeFi (Decentralized Finance) boomed in 2020 and has attracted tens of billions dollars nowadays. Dex (Decentralized Exchange) and AMM (Automated Marketing Maker) have been welcomed by the majority of blockchain users. One of reprensentative mechanisms is CFMM (Constant Function Market Makers) designed by Uniswap, which has become the most popular decentralized exchanges and conducted billions of dollars volume everyday. Followers like SushiSwap, PancakeSwap, QuickSwap, etc, also adopted CFMM mechanism.
CFMMs as they are implemented today are often capital inefficient, as only a fraction of liquidity in the pool are available at a given price in the scenarios of Uniswap V1&V2. To address this capital inefficiency issue, the team launched Uniswap V3 version in March 2021, and proposed a centralized liquidity AMM mechanism. CFMM in V2 version assume that liquidity is evenly distributed in entire price range from 0 to positive infinity. Instead, V3 allow the LP to concentrate their liquidity by “bounding” it within an arbitrary price range. Through this mechanism, when the price fluctuates in the interval, the capital efficiency can be greatly improved, thereby maximizing the LP gains.
The emergence of Uniswap V3 has aroused the discussion among the liquidity mining enthusiasts. This article hopes to compare the characteristics of Uniswap V2 and V3, analyze the V3 ecosystem, and provide a flexible and controllable solution that can survive through the bull and bear markets.
2. Analysis of Uniswap V2 eco-system
Before discussing the behavioral characteristics of liquidity mining participants in Uniswap V3, we first conduct a framework analysis of Uniswap V2 and other Dexes that use the CFMM mechanism.
In the CFMM mechanism, regardless of platform token subsidies and protocol fees collected by the dex, market participants can be divided into LP liquidity providers and traders, where the traders transfer the swapping fees to the LP through the transaction. Traders can be divided into two categories. The first category is the arbitrage trader, who conducts buying and selling orders simultaneously based on the price differences between Dex and Cex. Arbitrage traders tend not to predict future price and avoid risk exposures.
The second type of traders is the active trader, who makes profit or positive utility by trading in spite of the price in other dex or cex. Active traders include trend traders and utility traders. Trend traders predict the future price and trade when the expected price is better than the current price, which means trend traders accept risk exposure and hold the token without hedging. Utility traders are those who need to consume the token in dapps and choose dex because of the additional convenience, privacy and security features. In brief, the second type of traders doesn’t trade for arbitrage and cares less about the price in other Dex or Cex.
The key to analyze LP’s collected fees is to discuss the ratio between the volume and the TVL (total locked value). The ratio is crucial to the ROI of LP so this paper will discuss the ratio and volume contributed by two kinds of traders separately in the following. To be noted that we suppose that the platform token subsidy policy is a short-term marketing strategy and does not affect the long-term underlying value of the AMM mechanism, thus the platform token subsidy is ignored in this research and will be analyzed with Uniswap V3 mechanism in the future study.
2.1. Arbitrage traders
Based on the definition of arbitrage traders, their key motivation to trade is whether there is a large enough price difference between the Dex and other exchanges. When the price difference exceeds the sum of two platforms’ trading fee together with the blockchain transaction fee, arbitrage traders tend to carry out arbitrage trades. For example, assuming the transaction fee of Uniswap V2 is 0.3% and Binance is 0.1%, and the current price of ETH/USDT in Uniswap is 2000 USDT, while the Binance selling price is 2020. Assuming that the transaction gas fee for Dex is estimated to be $10, so the net profit ratio of the arbitrage trader is:
It should be noted that the above situation does not consider the time delay of blockchain transaction, and arbitrage traders can set a slippage of 0.1% to trade in Uniswap. In reality, considering the delay of block packing and the uncertainty of order withdrawal in centralized exchanges, as well as the potential cost of fund rebalance, the minimum price difference needs to be larger for arbitrage traders to participate. In contrast, what’s the maximum price difference between Dex and Cex? This depends on the competition of arbitrage traders. If there is less or even no competition, then the arbitrage trader will wait for a larger price difference before arbitrage trading. In this case, the trading volume of this pair is not active and the price difference continues to exist, which will reduce the LP’s fee income.
2.2. Active traders
The trading motivations of active traders are more complicated, which are related to market sentiment and personal preferences. On average, the active traders will contribute a greater proportion of the trading volume in the bull market. When the market goes down, the enthusiasm for trading of active traders will decline. The trend traders can’t make money in the spot market and may leave or turn to derivatives, while the increases of utility traders will be slow down due to the market sentiment.
Based on the above analysis of two types of traders and the sources of trading volume, liquidity providers (LPs), as the counterparty of traders, are possible to be inferred about trading mentality and rational motivation. Here we take Uniswap V2’s LP as a typical case analysis. As the present time, TVL of Uniswap V2 still has 4.3 billion dollars, which can avoid the influence of token subsidies of other Dex.
The profit calculation for LP is more complicated. A generally accepted calculation method is to compare impermanent loss and the rewarded trading fees. The definition of impermanence loss is the temporary loss of funds occasionally experienced by liquidity providers because of volatility in a trading pair. This also illustrates how much money someone would have had if they simply held, which is positively correlated with the price fluctuations. The most ideal situation for rational LPs is that at any observation time, the rewarded fee exceeds the impermanence loss.
According to the above analysis, as for liquidity providers, the most important thing to notice is the index of Volume/TVL funds and the rate of price change. If the rate of price change is small and the Volume/TVL is high, this pair should be selected. Otherwise, the trading pair should be given up. One of the extreme cases is that a certain token in the trading pair drops monotonically close to zero (it can be considered that the price change rate of the observation node is infinite). Then the impermanence loss of LP is close to 100%, and the swap fee obtained by LP is only about 0.3%*50%=0.15% (assuming that the swap fee is not placed in the pool and can be withdrawn without re-investing). In this case, the number of price fluctuation is 1, and only 50% of the funds are traded. Mathematically speaking, it can also be generalized that if a token in a trading pair drops monotonously by a during the observation process, the impermanent loss and the collected fee (assuming the fee is 0.3%) are:
In most cases, there is no monotonic price change during the observation process, and the price fluctuation within the range will cause multiple trades and fees for liquidity providers, thereby increasing the Volume/TVL under the condition of a certain impermanence loss. The other insight we can get so far is that when the price change rate between the two observation nodes is constant, the impermanence loss is constant. The more price fluctuations in the price range, the higher the capital utilization is.
The number of price fluctuation is related to the behavior of the two types of traders. The second type of active traders can be characterized by a random selection model, which can be statistically assumed to be evenly distributed along or against price trend. Thus the more active traders, the more price fluctuations, and the greater the trading volume. The number of active traders is associated with the Dex’s brand attraction and community participation. The trading behavior of the first type of arbitrage traders is related to the general market environment. If the current price is volatile and the price spread is greater than the slippage and transaction costs, the arbitrage trades will form and contribute to trading volume. While if the price is on single direction, the arbitrage trader can at most contribute unilateral trading volume.
In summary, we find that the two key factors for rational LP’s choice of liquidity mining are impermanent losses and transaction fees, which could mathematically attribute to one index, the price fluctuation rate. The critical point of whether to provide liquidity is:
Among them, the equivalent number of price fluctuations during the observation period is N, and the swap fee ratio is b.
Note that we can get:
Corollary 1: The optimal swap fee ratio to attract LP is positively correlated with the rate of price change. This point has enlightened significance for the fee setting of different trading pairs in V3.
Corollary 2: If there is only the first type of arbitrage trader, the number of price fluctuations is only positively correlated with external price changes, and negatively correlated with the blochchain transaction fees of swap. This is of great significance to the analysis of value improvement after the deployment of Layer 2 in Uniswap V3.
3. Comparison and Analysis of Uniswap V3 and V2 Ecosystem
According to the white paper Uniswap V3 Core, we found that for centralized liquidity AMM, compared with the CFMM used in the V2 version, the core is to provide LP with a range order liquidity market-making strategy. If LP sets the price corresponding to the range order from 0 to positive infinity, then Uniswap V3 will produce an effect equivalent to V2.
The emergence of range order in Uniswap V3 provides LP with a new choice, and also differentiates LP’s market-making strategy. This is also the source of non-fungible tokens commonly referred to V3 LP. Different LPs can choose different ranges which makes the entry motivation for V3 LPs quite different from the V2
3.1. Arbitrage LP:
One of the differences is that the price range design of the range order has also become an important factor affecting the ratio of impermanent loss to fee income during the oberservation process. If the range order is too small, the price will no longer bring new fees to LP after the price exists the position’s price range. Thus when the price exists the range for the last time during the observation, LP fees collected are less than impermanent loss which means the LP will bear permanent loss. As there will be no fee collected and the price has exists the price range. The loss will continue to expand with the price going further out of the price range, and the comprehensive income will be negative, which can lead to the following inferences:
Corollary 3: the LP supposes that if the chosen price range cannot provide enough fees before price exists, the comprehensive income will be negative. Then the LP will not choose the V3 model. The only reason of arbitrage liquidity providers choosing the range order of V3 model, is that there is enough collected fees to cover the impermanence loss when existing the range and the collected fees need to be higher than the impermanence loss at the end of the observation process.
Corollary 4: The key for LP to choose the V3 model is that the number of price fluctuations within the range is higher than the number of price fluctuations outside the range, and it has nothing to do with whether the price is within or outside the range at the end of the observation process.
Inspiration 1: Combining Corollary 3 and Corollary 4, the keypoint of LP’s choice of the V3 model is to find the range with the most price fluctuations during the observation period. The price interval does not necessarily cover the current position or end position of the observation period, which inspires for the selection of price range in V3 model.
3.2. Passive Trading LP
The second difference of V3 is that LP’s motivation is not limited to obtaining profits between collected fees and impermanent loss. LPs could also use range order to act as market makers with minus trading fee, which is similar to the market makers in tradition exchanges. For this type of passive trading LP, they could select a tiny price range and withdraw the liquidity after the price passes the range. The whole process works like “limit order”. Passive trading LPs will not compare the fees and impermanent loss. Instead they value the order fulfillment ratio.
Inspiration 2: For passive trading LPs, the smaller the price range setting, the easier to achieve the goal of negative transaction fees. This is the new user identity and transaction motivation introduced by Uniswap V3 to the ecosystem compared to V2. For LPs with trend judgments, this should be considered in the optimization of mining strategy design.
4. Uniswap V3 liquidity mining management — R3 system
Combining Corollary 1 and Corollary 2 in Chapter 2, and Inspiration 1 and Inspiration 2 in Chapter 3, we designed the R3 system, a liquidity mining management system for Uniswap V3. Compared with the V2 model, which simply puts the two tokens of LP in the AMM with the same value, the flexibility and features brought by V3 provide LPs with more opportunities to earn. LPs in V3 obtain new entry opportunities and far-reaching opportunities through the optimization of liquidity mining strategies, like super-unexpected returns.
Specifically, the R3 system first divides the observation period into several observation nodes according to the ratio of the blockchain transaction fee to the LP capital volume, and adjusts the liquidity of each observation sub-node. Each liquidity adjustment includes 3 kinds of range orders, which are:
- Limit order (Deploy just above or below the current price, working for rebalancing or trending strategy)
- Full order (Full range cover and symmetrical deployment like V2, designed for long-term asset allocation)
- Concentrated order (Bounding current position within an arbitrary price range, earning fees with capital efficiency)
The R3 system will combine historical price data and the key index Volume/TVL to determine the distribution of funds in the above three range order orders based on the ATR (Average True Range) model and machine learning algorithms. And the range parameter setting of each order, through data mining and dynamic optimization to achieve the maximization of LP income, meets the different needs of arbitrage LP and profitable transaction LP.
The R3 system also plans to open the internally used transaction module as a smart contract formation and API for V3 enthusiasts. If you are interested, please contact Telegram @Jimmy_Yin9.
 H. Adams, N. Zinsmeister, M. Salem et al., Uniswap v3 Core, 2021. https://uniswap.org/whitepaper-v3.pdf
 Hayden Adams, UniSwap whitepaper, 2020