Category: Uniswap V3

Calculating the real reserves between two prices in the Uniswap V3 codebase
Calculating the real reserves between two prices in the Uniswap V3 codebase In previous chapters, we derived formulas to calculate the real reserves of tokens X and Y between two…

The constant product formula in Uniswap v3
The constant product formula in Uniswap v3 Our goal is to derive the constant product formula based on real reserves for a segment, given by $$ L^2 = (x_r+\frac{L}{\sqrt{p_u}})(y_r+L\sqrt{p_l})$$ and…

Real reserves in Uniswap v3
Real reserves in Uniswap v3 In the last chapter, we introduced two new concepts: real reserves and virtual reserves. The real reserves of a segment are the amount of tokens…

Real and virtual reserves in Uniswap v3
Real and virtual reserves in Uniswap v3 Uniswap v3 uses two types of reserves: real reserves and virtual reserves. Real reserves represent the actual amount of tokens present in a…

Square and Multiply Algorithm
Square and Multiply Algorithm The square and multiply algorithm computes integer exponents in $\mathcal{O}(\log n)$ (logarithmic time). The naive way to compute an exponent $x^n$ is to multiply $x$ by…