IUniswapV3PoolState

Overview

License: GPL-2.0-or-later

interface IUniswapV3PoolState

These methods compose the pool's state, and can change with any frequency including multiple times per transaction

Functions info

slot0 (0x3850c7bd)

function slot0()
    external
    view
    returns (
        uint160 sqrtPriceX96,
        int24 tick,
        uint16 observationIndex,
        uint16 observationCardinality,
        uint16 observationCardinalityNext,
        uint8 feeProtocol,
        bool unlocked
    )

The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas when accessed externally.

Return values:

feeGrowthGlobal0X128 (0xf3058399)

function feeGrowthGlobal0X128() external view returns (uint256)

The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool

This value can overflow the uint256

feeGrowthGlobal1X128 (0x46141319)

function feeGrowthGlobal1X128() external view returns (uint256)

The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool

This value can overflow the uint256

protocolFees (0x1ad8b03b)

function protocolFees() external view returns (uint128 token0, uint128 token1)

The amounts of token0 and token1 that are owed to the protocol

Protocol fees will never exceed uint128 max in either token

liquidity (0x1a686502)

function liquidity() external view returns (uint128)

The currently in range liquidity available to the pool

This value has no relationship to the total liquidity across all ticks

ticks (0xf30dba93)

function ticks(
    int24 tick
)
    external
    view
    returns (
        uint128 liquidityGross,
        int128 liquidityNet,
        uint256 feeGrowthOutside0X128,
        uint256 feeGrowthOutside1X128,
        int56 tickCumulativeOutside,
        uint160 secondsPerLiquidityOutsideX128,
        uint32 secondsOutside,
        bool initialized
    )

Look up information about a specific tick in the pool

Parameters:

Return values:

tickBitmap (0x5339c296)

function tickBitmap(int16 wordPosition) external view returns (uint256)

Returns 256 packed tick initialized boolean values. See TickBitmap for more information

positions (0x514ea4bf)

function positions(
    bytes32 key
)
    external
    view
    returns (
        uint128 _liquidity,
        uint256 feeGrowthInside0LastX128,
        uint256 feeGrowthInside1LastX128,
        uint128 tokensOwed0,
        uint128 tokensOwed1
    )

Returns the information about a position by the position's key

Parameters:

Return values:

observations (0x252c09d7)

function observations(
    uint256 index
)
    external
    view
    returns (
        uint32 blockTimestamp,
        int56 tickCumulative,
        uint160 secondsPerLiquidityCumulativeX128,
        bool initialized
    )

Returns data about a specific observation index

You most likely want to use #observe() instead of this method to get an observation as of some amount of time ago, rather than at a specific index in the array.

Parameters:

Return values:

Last updated