The core of Uniswap V3 is to provide liquidity through intervals (Concentrated Liquidity), where liquidity providers add liquidity to a range that has the potential for price fluctuations to improve capital utilization. TWAMM automated market makers as a new type of AMM protocol can also use Concentrated Liquidity. Capital Utilization Let's look at the utilization rate of Uniswap V2 using non-concentrated liquidity. The above graph shows the volume change curve of $x-y$ in the pool. The current price in the pool is at $c$ and is assumed to fluctuate between $a$ price point and $b$ price point. Sliding from point $c$ to point $a$ consumes the maximum $y_{real}$ and sliding from point $c$ to point $b$ consumes the maximum $x_{real}$. That is, the current price $c$ point, oscillating between $a$ and $b$ points, consumes only $x_{real}$ and $y_{real}$ at maximum. Theoretically it is enough to provide $x_{real}$ and $y_{real}$. And in fact, as shown above, at the price $c$ point, $x$ and $y$ are provided greater than $x_{real}$ and $y_{real}$, respectively. It is obvious that the funds $x-x_{real}$ and $y-y_{real}$ are never used in this case, which is also called idle funds. In this case, the capital utilization rate is $\dfrac{x_{real}}{x}$ or $\dfrac{y_{real}}{y}$. If the price fluctuation is very small, the capital utilization is very low. How to add liquidity in a certain price interval and provide Swap function is the focus point of Uniswap V3, which needs to start with the virtual Reserves.
4/1/2022Uniswap V3 核心是通过盘口区间提供流动性(集中式流动性),流动性提供者将流动性添加到有可能价格波动到的区间范围,提高资金使用率。 TWAMM 做市商作为新型的 AMM 协议同样可以采用集中流动性(Concentrated Liquidity)。 资金利用率 先看看 Uniswap V2 使用非集中流动性的资金利用率。 上图为资金池中的 $x-y$ 的量变化曲线。资金池中的当前价格在 $c$ 点,并且假设会在 $a$ 价格点和 $b$ 价格点之间波动。从 $c$ 点向 $a$ 点滑动,消耗最大 $y_{real}$,从 $c$ 点向 $b$ 点滑动,消耗最大为 $x_{real}$。也就是说,当前价格 $c$ 点,在 $a$ 点和 $b$ 点之间震荡的话,最大只需要消耗 $x_{real}$ 和 $y_{real}$。理论上只要提供 $x_{real}$ 和 $y_{real}$ 就足够了。而事实上,如上图所示,在价格 $c$ 点,分别提供了大于 $x_{real}$ 和 $y_{real}$ 的 $x$ 和 $y$。明显可以看出,$x-x_{real}$ 和 $y-y_{real}$ 的资金在这种情况下是永远用不上的,也就称为闲置资金。在这种情况下,资金利用率为 $\dfrac{x_{real}}{x}$ 或者 $\dfrac{y_{real}}{y}$。如果价格波动非常小的话,资金利用率是非常低的。 如何在某个区间添加流动性并提供 Swap 功能是 Uniswap V3 的重点,这需要先从虚拟资金池说起。
3/29/2022Definition Assume that TWAMM requires $N$ blocks to execute a large virtual transaction, and that the pool selling $X$ sells at a rate of $x_{rate}$ per block, while the pool selling $Y$ sells at a rate of $y_{rate}$ per block. Thus, the total amount of $X$ sold during the whole period is $x_{in}=Nx_{rate}$ and the total amount of $Y$ sold is $y_{in}=Ny_{rate}$. Also, we note the initial reserves $x_{reserve}$ and $y_{reserve}$ for this time period in embeded AMM as $x_{0}=x_{ammStart}$ and $y_{0}=y_{ammStart}$, respectively. According to the design of TWAMM, large orders are traded with blocks, each block sells $x_{rate}$ to get $y_{out}$, or sells $y_{rate}$ to get $x_{out}$, while AMM updates the values of $x_{reserve}$ and $y_{reserve}$, the whole process $N$ transactions in total. It is worth noting that each block transaction of AMM always follows a constant product market making. Formula
3/9/2022