The technical content top engineers rely on to level up.
7 min read
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 prices in a segment....
14 min read
The Fundamental Theorem of Finite Cyclic Groups The Fundamental Theorem of Cyclic Groups provides guarantees about the existence of cyclic subgroups within a cyclic group. In the context of the...
10 min read
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}) $$...
11 min read
How Ethereum address are derived (EOAs, CREATE, and CREATE2) On Ethereum, smart contracts can be deployed in one of three ways: An Externally Owned Account (EOA) initiates the transaction where the...
11 min read
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 contained in that segment—...
12 min read
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 segment. Each...
17 min read
ERC-6551 Standard: Token Bound Accounts (TBA) Introduction NFTs were originally created to represent ownership of digital or physical assets, like collectibles. However, they were limited to tracking...
8 min read
Tickmath getSqrtRatioAtTick This article explains how the function in Uniswap V3 TickMath library works. The function takes a tick index and returns the square root price at that exact tick as a...
33 min read
Circle FFT — Part 1: Building the Circle Domain Circle STARKs is a new zk-STARK scheme that has been implemented in Stwo and Plonky3, and it has been adopted by several zkVM projects. Its key...
22 min read
Multiplicative Subgroups and Primitive Elements Introduction This chapter continues our study of group theory by exploring subgroups and generators. The concept of a primitive element will be...
8 min read
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$...
7 min read
Computing the Current Tick Given sqrtPriceX96 In the previous chapters, we saw that the protocol stores the square root of the price instead of the price itself. Therefore, it is necessary to relate...