Indexing millions of token prices based on liquidity


Zora has millions of tokens and computing fresh quotes for every token in every wallet on every page load is a complex engineering problem. Our engineering team has recently made further improvements to ensure your wallet accurately displays Estimated Value of Holdings, the total value if you sold everything right now. This number reflects what you'd actually receive if you executed sales across all your positions.
Previously, we calculated this as: number of coins × price.
The new method shows what you'll actually get by simulating real trades through Uniswap V3 and V4 pools.
For each token position, we need to know: "If I sold this right now, what would I actually get, and how much of it can I sell?"
Different tokens have different paths to value: each token on Zora has a route to $USDC through various pairs ($WETH, $ZORA, $CREATOR, $CONTENT, etc.) and Uniswap versions (v3, v4). We calculate the full path to get the actual USD value.
For each path, we simulate swaps through all available pools at each hop, and always carry forward the highest output value to the next hop:
The final number accounts for:
This is what you'll actually receive.
The technical infrastructure:
When calculating prices, it's important to understand how tokens actually trade onchain.
Traditional exchanges use order books: lists of buy and sell orders. AMMs replace this with a mathematical formula and a pool of tokens.
The simplest AMM uses the constant product formula:
x × y = kWhere:
x = amount of token A in the pooly = amount of token B in the poolk = constant that never changesWhen you swap token A for token B:
x increases)k constanty decreases)Example:
x = $CREATOR amount, y = USDC amountx = 1,000,000 and y = 100,000k = 1,000,000 × 100,000 = 100,000,000,000y = 100,000 + 10,000 = 110,000 (you added USDC to pool)x × y = k, so x × 110,000 = 100,000,000,000x: x = 100,000,000,000 ÷ 110,000 = 909,090.91 $CREATORBut if you bought a smaller amount with just 100 USDC, you'd pay ~$0.10 per $CREATOR. The bigger your trade relative to pool size, the worse your price gets.
Price impact is how much your trade moves the price. Large trades relative to pool liquidity cause significant price movement.
Slippage is the difference between expected price and execution price:
slippage = |(execution_price - spot_price) / spot_price|A $1 spot price that executes at $0.95 means 5% slippage.
Liquidity is the total value of tokens available in a pool. Deeper pools handle larger trades with less slippage.
Two pools might show the same spot price ($1), but dramatically different execution:
Deep Pool (1M tokens):
Thin Pool (50K tokens):
This is why we calculate actual quotes instead of using spot price × balance.
Indexing millions of token prices based on liquidity requires simulating actual swaps through liquidity pools, not multiplying balances by spot prices. In this post we’ve walked through Uniswap v3 and v4 tick ranges, consumed available liquidity, applied fees, and handled multi-hop routes to calculate what you'd actually receive from a sale.
Zora caches pool states at the tick level and processes quotes in parallel. This approach scales to millions of tokens while maintaining low latency for wallet loads, giving users real execution prices instead of theoretical values.