[DeFi Math] About Uniswap V2 Lazy Liquidity

Chaisomsri
5 min readFeb 2, 2024

--

Uniswap’s V2 uses the CPMM model of AMM to measure the trading ratio of two cryptocurrencies traded in a liquidity pool.

The amount of cryptocurrencies traded is determined by maintaining a set ratio. However, if the supply of one cryptocurrency is significantly lower than the other, high slippage occurs, and a much lower swap amount is executed than the actual price. The price continues to decrease, but due to the nature of AMM, the price does not become 0. In other words, there are tokens that are not traded to the end, and this is referred to as the lazy liquidity of V2.

Looking at the CPMM formula X×Y=K, the value of K is calculated at the point when the liquidity pool is formed and is a fixed value (constant) except in specific situations.

CPMM uses the constant K to calculate the trading ratio of the two cryptocurrencies. At this point, the price (P) of the tokens is determined based on the ratio of the two tokens.

When trades proceed with K fixed at the value determined at the point of liquidity pool formation, the graph is formed as shown above. Let’s understand what this graph means through the example below.

Example

Before Swap

  • X: Current supply of MTK in the MTK/USDC liquidity pool = 1,000 units
  • Y: Current supply of USDC in the MTK/USDC liquidity pool = 4,000 units
  • K: Liquidity of the MTK/USDC liquidity pool = 1,000×4,000=4,000,000
  • P: Price of the base token MTK = 1,000/4,000=4 USDC

The MTK/USDC liquidity pool was established, and a CPMM graph like the one above was formed.

After Swap (1)

Alice wants to swap 500 MTK for USDC.

After the transaction of sending 500 MTK to the liquidity pool is completed, the liquidity pool graph and the number of USDC settled can be calculated as follows:

  • X: Current supply of MTK in the MTK/USDC liquidity pool = 1,000 units
  • Y: Current supply of USDC in the MTK/USDC liquidity pool = 4,000 units
  • dx: Number of MTK tokens added by the trader to the MTK/USDC liquidity pool = 500 MTK
  • dy: Number of USDC tokens taken by the trader from the MTK/USDC liquidity pool = 1,333.33 USDC
  • P: Price of the base token MTK before the swap = 4,000/1,000=4 USDC
  • P1: Price of the base token MTK after the swap = 2,666.66/1,500=1.78 USDC
  • K: Liquidity of the MTK/USDC liquidity pool = 1,500×2,666.66=4,000,000

The total supply of MTK in the MTK/USDC liquidity pool increased by 500 units, and the total supply of USDC decreased by 1,333.33 units. We can see that the price P1 also changes according to the change in the total supply of both tokens.

After Swap (2)

At this point, Alice wants to swap 500 MTK for USDC once again.

After the transaction of sending 500 MTK to the liquidity pool is completed, the liquidity pool graph and the number of USDC settled can be calculated as follows:

  • X: Current supply of MTK in the MTK/USDC liquidity pool = 1,500 units
  • Y: Current supply of USDC in the MTK/USDC liquidity pool = 2,666.66 units
  • dx: Number of MTK tokens added by the trader to the MTK/USDC liquidity pool = 500 MTK
  • dy: Number of USDC tokens taken by the trader from the MTK/USDC liquidity pool = 666.66 USDC
  • P: Price of the base token MTK before the swap = 2,666.66/1,500=1.78 USDC
  • P1: Price of the base token MTK after the swap = 2,000/2,000=1 USDC
  • K: Liquidity of the MTK/USDC liquidity pool = 2,000×2,000=4,000,000

When comparing After Swap (1) and After Swap (2), Alice received 1,333.33 USDC in the first swap but only 666.66 USDC in the second swap.

A drawback and limitation of the CPMM formula, as shown in the graph, is that the swap amount is determined based on the constant K, which leads to varying swap amounts depending on the total remaining supply in the liquidity pool. This disadvantage directly affects traders, with the difference between the current price (P) and the actual executed trade price (P1) referred to as slippage. The CPMM of AMM results in increasing slippage as more trades are executed, leading to progressively greater losses for traders.

Furthermore, as this swap process continues, the swap amount finalized for traders decreases, but the total supply never reaches zero. In other words, no matter how many trades are executed, some cryptocurrency will always remain in the liquidity pool until the end.

The cryptocurrency that remains until the end is referred to as Uniswap V2’s lazy liquidity.

This issue arises because, by the nature of CPMM, there is no limit to the trading range. Therefore, Uniswap introduced concentrated liquidity with the V3 update to address this problem. By reconfiguring the CPMM formula for concentrated liquidity, the issues inherent in V2 were resolved. In the next post, we will discuss Uniswap V3’s concentrated liquidity and its new formula.

--

--