IUniswapV3Pool
Title: IUniswapV3Pool
Author: Vendored minimal subset of Uniswap V3 (https://github.com/Uniswap/v3-core/blob/main/contracts/interfaces/IUniswapV3Pool.sol
and .../interfaces/pool/IUniswapV3PoolDerivedState.sol). Upstream license: GPL-2.0-or-later.
Minimal vendored subset of a Uniswap V3 pool, covering only what the Lattice
UniswapV3Adapter needs: the time-weighted observe oracle (the manipulation-resistant
valuation source), the immutable token/fee/tick-spacing readers, and slot0 (declared
for completeness / tests — the adapter MUST NEVER value its position from slot0 because
the spot tick is single-block manipulable).
Vendored subset — do not add a uniswap-v3-core dependency. Valuation reads are view.
Functions
observe
Returns cumulative tick and liquidity-in-range values as of each secondsAgo.
The TWAP arithmetic-mean tick over a window w is
(tickCumulatives[0] - tickCumulatives[1]) / int56(uint56(w)) for
secondsAgos = [w, 0]. This is the canonical Uniswap V3 oracle and is the ONLY price
source the adapter uses for NAV — it is resistant to single-block manipulation because it
averages the tick over the whole window.
function observe(uint32[] calldata secondsAgos)
external
view
returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);Parameters
| Name | Type | Description |
|---|---|---|
| secondsAgos | uint32[] | From how long ago each cumulative value should be returned (seconds). |
Returns
| Name | Type | Description |
|---|---|---|
| tickCumulatives | int56[] | Cumulative tick values as of each secondsAgos from the current block. |
| secondsPerLiquidityCumulativeX128s | uint160[] | Cumulative seconds-per-liquidity-in-range values. |
slot0
The current pool state (slot0). Manipulation hazard: sqrtPriceX96/tick here are
the instantaneous spot price, settable within a single block by a flash swap. The
adapter declares this only so callers/tests can observe spot; it is NEVER used for NAV.
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint8 feeProtocol,
bool unlocked
);Returns
| Name | Type | Description |
|---|---|---|
| sqrtPriceX96 | uint160 | The current price as a sqrt(token1/token0) Q64.96 value. |
| tick | int24 | The current tick. |
| observationIndex | uint16 | The index of the last written observation. |
| observationCardinality | uint16 | The current maximum number of observations stored. |
| observationCardinalityNext | uint16 | The next maximum number of observations. |
| feeProtocol | uint8 | The protocol fee for both tokens of the pool. |
| unlocked | bool | Whether the pool is currently locked to reentrancy. |
tickSpacing
The pool tick spacing (governs which ticks may be initialized; full-range positions use the min/max usable ticks aligned to this spacing).
function tickSpacing() external view returns (int24);Returns
| Name | Type | Description |
|---|---|---|
| <none> | int24 |
token0
The first of the two tokens of the pool, sorted by address.
function token0() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
token1
The second of the two tokens of the pool, sorted by address.
function token1() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
fee
The pool's fee in hundredths of a bip (i.e. 1e-6).
function fee() external view returns (uint24);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint24 |