lessonΒ·25 minΒ·Chapter 1 of 3
Constant Product Formula
The core of Uniswap v2 is the constant product formula: x * y = k, where x and y are the reserves of two tokens in a pool, and k is a constant. When you swap token A for token B, you add A to the pool and remove B, such that the product of reserves stays constant. This creates a price curve that gets progressively more expensive for larger trades, providing automatic price discovery. The spot price is the ratio of reserves: price_A = y/x.
π‘ Key Takeaway
This lesson covers the fundamental concepts. Make sure you understand these before moving to the next chapter.