UniswapOracleLibrary

Git Source

Provides functions to integrate with V3 pool oracle

Functions

consult

Calculates time-weighted means of tick and liquidity for a given Uniswap V3 pool

function consult(
    address pool,
    uint32 secondsAgo
)
    internal
    view
    returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity);

Parameters

NameTypeDescription

pool

address

Address of the pool that we want to observe

secondsAgo

uint32

Number of seconds in the past from which to calculate the time-weighted means

Returns

NameTypeDescription

arithmeticMeanTick

int24

The arithmetic mean tick from (block.timestamp - secondsAgo) to block.timestamp

harmonicMeanLiquidity

uint128

The harmonic mean liquidity from (block.timestamp - secondsAgo) to block.timestamp