This blog explains how Uniswap v3 works under the hood, focusing on concentrated liquidity, ticks, and key smart contract functions.
Unlike earlier AMMs, Uniswap v3 introduces concentrated liquidity.
Instead of providing liquidity across the entire price range (0 → ∞), liquidity providers (LPs) can choose a specific price range where their capital is active.
👉 This makes capital far more efficient.
Tick spacing defines which price points (ticks) LPs are allowed to use when setting their liquidity range.
Think of ticks as grid points on the price axis.
If:
tickSpacing = 10
Then valid ticks are:
…, -20, -10, 0, 10, 20, 30, …
Example
An LP can provide liquidity between:
If every possible tick were allowed:
So tick spacing ensures:
💡 Important: Tick spacing does not directly affect price, only how liquidity positions are defined.
A tick is an integer that represents a specific price level.
Uniswap defines price as:
Where:
Intuition
So ticks discretize price into very fine steps.
Ticks are not for pricing, but for liquidity accounting.
They act as boundaries where liquidity turns ON or OFF.
Without Ticks:
With Ticks:
Instead of storing price directly, Uniswap stores:
sqrtPriceX96 = sqrt(price) × 2⁹⁶
Why?
💡 Most calculations in Uniswap v3 are done using this value, not raw price.
Now let’s walk through the important functions and what they actually do.
This is the first function called after pool deployment.
Purpose:
Input:
What it does:
👉 Without calling this, the pool cannot operate.
This function is used when adding liquidity.
Purpose:
Inputs:
What happens internally:
This is not a function but an important concept.
Used internally to update positions.
This is the core internal function for managing positions.
Responsibilities:
👉 Think of this as the engine behind both mint() and burn().
Handles actual updates to a user’s position.
What it does:
Called internally by _modifyPosition().
Used to remove liquidity.
Inputs:
What it does:
👉 Important: It only updates accounting.
This is when tokens are actually transferred to the user.
Purpose:
What it does:
👉 Separation of burn() and collect() helps optimize gas and flexibility.
Here are some deeper insights that show strong understanding:
1. Discrete Liquidity Model
Uniswap v3 converts continuous price ranges into discrete ticks → enabling efficient computation.
2. Capital Efficiency
LPs can concentrate liquidity → earn more fees with less capital.
3. Gas Optimization
4. Separation of Concerns
Uniswap v3 is not just an AMM — it’s a highly optimized financial engine.
Key innovations:
Github: https://github.com/kshitij011/uniswap-v3-finance
LinkedIn: https://www.linkedin.com/in/kshitijbhoite011
#blockchain #defi #uniswap #finance #solidity #smartcontracts
Understanding Concentrated Liquidity in Uniswap v3 was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.


