Early rate$2,400 of senior audit time for $500. Early members keep the rate as it climbs.$2,400 of senior audit time for $500See how

Slot0

The single packed storage slot in a Uniswap V3 pool holding the current square-root price, tick, oracle indices, protocol fee, and unlock flag, so the hottest values in the protocol cost one storage read.

Slot0 is a struct in UniswapV3Pool deliberately sized to fit one 256-bit storage slot. It holds the values that almost every operation touches: sqrtPriceX96 (160 bits), tick (24), the oracle's observationIndex and observationCardinality and observationCardinalityNext (16 each), feeProtocol (8), and unlocked (1).

The packing is the point. Reading a cold storage slot costs 2,100 gas and every additional slot costs the same again. By fitting the price, the tick, the oracle cursor and the lock into one slot, a swap loads all of them for a single read, and writes them back with a single write.

The lock lives here for a reason

unlocked is Uniswap V3's reentrancy guard, and putting it in slot0 rather than in its own variable is what makes the guard nearly free. A conventional guard costs a full cold read and two writes. Here the flag rides along with data the function was already loading and storing, so the marginal cost is close to zero.

That guard is what makes the rest of the protocol's design safe. Mint, swap and flash all transfer tokens optimistically and then call back into the caller before verifying payment. A single lock covering all three entry points is the reason that pattern does not become an open door.

Reading slot0 from outside is a trap

slot0().sqrtPriceX96 is the pool's instantaneous price, and it is manipulable within a single transaction by anyone willing to move the price and move it back. Using it as an oracle is one of the most reliably exploited mistakes in DeFi integrations.

The protocol provides the safe alternative in the same contract: the TWAP oracle, read through observe(), which returns a time-weighted average over a window the caller chooses. The cost of manipulating that average scales with the window length, which is what makes it defensible.

An integration that reads slot0 for pricing is not reading a price. It is reading whatever the last transaction in the block decided the price should be.

What to check in a fork

Two things. First, that the struct still fits one slot — a fork that widens a field or adds one pushes the struct into two slots and silently doubles the cost of every swap, which is a bug in the sense that it defeats a design decision even though nothing reverts.

Second, that unlocked is initialized to true on the same write that sets the initial price. A pool whose lock defaults to false and is never set is permanently bricked, and because initialize() is the only function that can set it, the failure is unrecoverable.

Need expert guidance on Slot0?

Our team at Zealynx has deep expertise in blockchain security and DeFi protocols. Whether you need an audit or consultation, we're here to help.

Get a Quote