How To Read Data

A developer's guide to reading Uniswap v4 pool data - Explore the methods for querying permanent and transient storage, from low-level `extsload` calls to high-level abstractions like `StateView`. Learn the best practices for accessing on-chain state like prices, ticks, and transaction-specific token deltas.

1. Currency
A foundational look at Uniswap v4's `Currency` Type - Explore the elegant abstraction that unifies native (ETH) and ERC-20 token interactions within the protocol. Learn how the simple zero-address convention simplifies core logic for transfers, balance checks, and PoolKeys. Duration: 2min
2. PoolKey And PoolId
A technical breakdown of PoolKey and PoolId - Explore how the `PoolKey` struct uniquely defines a liquidity pool using its tokens, fee, tick spacing, and hooks. Understand how this struct is hashed into a `PoolId` for efficient and unique on-chain referencing. Duration: 2min
3. PoolKey Example
A practical guide to constructing Uniswap v4 Pool Identifiers - Learn to build a `PoolKey` struct from its core parameters like tokens, fee, and tick spacing. Understand how this struct is hashed into a `PoolID` for efficient on-chain referencing. Duration: 3min
4. Example How To Get PoolKey
A practical guide to reconstructing a Uniswap v4 PoolKey - Explore an event-based method for reverse-engineering a `PoolKey` from its compressed `PoolId` hash. Learn to query Dune Analytics to find the pool creation event and extract the necessary token, fee, and hook data. Duration: 2min
6. Lock
A technical guide to the Uniswap v4 lock-and-callback pattern - Learn why direct calls to the `PoolManager` are locked and how the `unlock` function enables interactions via a required callback. Discover the role of transient storage and settlement checks in this secure, gas-efficient design. Duration: 3min
7. Transient Storage
A technical introduction to transient storage in Solidity - Discover how EIP-1153 introduces a new, gas-efficient data location for data that only needs to persist for a single transaction. Learn how `tstore` and `tload` work and why they are ideal for patterns like re-entrancy locks. Duration: 5min
8. Non-Zero Delta Count
A security-focused breakdown of Uniswap v4's NonzeroDeltaCount - Explore the core safety counter at the heart of the flash accounting system, which guarantees that all token debts are settled. Learn how it tracks unsettled balances and forces a transaction to revert if all debts are not cleared. Duration: 4min
9. Account Delta
A functional breakdown of the `_accountDelta` function - Clarify the core sign convention for tracking temporary user balances within the PoolManager. Learn why taking tokens creates a negative delta (a debt), while sending tokens in creates a positive one (a credit). Duration: 3min
10. Account Delta Example
An operational guide to the Uniswap v4 Account Delta - Delve into the gas-efficient accounting system at the heart of the `PoolManager` contract. Learn how the lock/callback pattern uses virtual deltas to guarantee atomic settlement of swaps and liquidity actions. Duration: 4min
12. Currency Reserves
A technical breakdown of the sync and settle workflow - Explore the mandatory two-step process for repaying token debts in the PoolManager. Learn how `sync` and `settle` use transient storage to calculate payment amounts within a single transaction. Duration: 3min
13. Swap Contract Calls
A technical guide to the Uniswap v4 PoolManager - Discover how the central singleton contract uses "flash accounting" to execute gas-efficient swaps and flash loans. Understand the `unlock` locking mechanism and the sequence of calls required to settle token balance deltas. Duration: 2min
14. Balance Delta
A technical breakdown of the BalanceDelta type - Discover how Uniswap v4 uses bit packing to return two token balance changes in a single variable, a key gas-saving strategy. Learn how to use the provided library to unpack this custom data type in your contracts. Duration: 1min
15. Exercise Flash Loan
A functional exercise to Flash Exercises - Learn how to execute a flash loan from the PoolManager contract by implementing the two-step unlock and unlockCallback process. Reading Time: 0min
16. Exercise Swap
A fundamental exercise to Swap Exercises - Learn how to swap tokens with the PoolManager contract by implementing the core unlock and unlockCallback functions, including slippage protection. Reading Time: 0min
17. How To Read Data
A developer's guide to reading Uniswap v4 pool data - Explore the methods for querying permanent and transient storage, from low-level `extsload` calls to high-level abstractions like `StateView`. Learn the best practices for accessing on-chain state like prices, ticks, and transaction-specific token deltas. Duration: 5min
18. Exercise Read Data
A practical exercise to Reader Exercise - Learn how to read from Uniswap v4's transient storage by implementing a function to get the currency delta from the PoolManager contract. Reading Time: 0min
19. Application Swap Router
A hands-on exercise to Router Exercises - Learn how to build a custom Uniswap v4 router by implementing single-hop and multi-hop token swaps for both exact input and exact output amounts. Reading Time: 0min

Course Overview

About the course

What you'll learn

Difference between Uniswap v3 and v4

Uniswap v4 PoolManager

Uniswap v4 Hooks

Uniswap v4 Singleton architecture

Uniswap v4 flash accounting

Uniswap v4 operations

Uniswap v4 lifecycle

How to build a Uniswap v4 swap router

Course Description

Meet your instructors

Tasuku Nakamura

Tasuku Nakamura

Founder at smartcontract.engineer

Smart contract engineer and educator.

Last updated on September 22, 2025