OracleLibrary

Overview

License: GPL-2.0-or-later

library OracleLibrary

Provides functions to integrate with V3 pool oracle

Structs info

WeightedTickData

struct WeightedTickData {
	int24 tick;
	uint128 weight;
}

Functions info

consult

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

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

Parameters:

Return values:

getQuoteAtTick

function getQuoteAtTick(
    int24 tick,
    uint128 baseAmount,
    address baseToken,
    address quoteToken
) internal pure returns (uint256 quoteAmount)

Given a tick and a token amount, calculates the amount of token received in exchange

Parameters:

Return values:

getOldestObservationSecondsAgo

function getOldestObservationSecondsAgo(
    address pool
) internal view returns (uint32 secondsAgo)

Given a pool, it returns the number of seconds ago of the oldest stored observation

Parameters:

Return values:

getChainedPrice

function getChainedPrice(
    address[] memory tokens,
    int24[] memory ticks
) internal pure returns (int256 syntheticTick)

Returns the "synthetic" tick which represents the price of the first entry in tokens in terms of the last

Useful for calculating relative prices along routes.

Parameters:

Return values:

Last updated