IndexedUniswapV2Oracle
constructor
updatePrice
token
and returns a boolean indicating whether it was updated.updatePrices
tokens
and returns a boolean array indicating which tokens had their prices updated.hasPriceObservationInWindow
token
at priceKey
.token
: Token to check if the oracle has a price forpriceKey
: Index of the hour to checkgetPriceObservationInWindow
token
recorded in priceKey
. Reverts if no prices have been recorded for that key.token
: Token to retrieve a price forpriceKey
: Index of the hour to querygetPriceObservationsInRange
token
recorded between timeFrom
and timeTo
.canUpdatePrice
token
can be updated.canUpdatePrices
tokens
can be updated.computeTwoWayAveragePrice
token
and the average price of token
in terms of weth.token
and the price of token
in terms of weth by getting the current prices from Uniswap and searching for a historical price which is between minTimeElapsed
and maxTimeElapsed
seconds old.maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour.minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeAverageTokenPrice
token
in terms of weth.token
in terms of weth by getting the current price from Uniswap and searching for a historical price which is between minTimeElapsed
and maxTimeElapsed
seconds old.maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour.minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeAverageEthPrice
token
.token
by getting the current price from Uniswap and searching for a historical price which is between minTimeElapsed
and maxTimeElapsed
seconds old.maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour.minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeTwoWayAveragePrices
tokens
and the average price of each token in terms of weth.minTimeElapsed
and maxTimeElapsed
seconds old.maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour.minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeAverageTokenPrices
tokens
in terms of weth.minTimeElapsed
and maxTimeElapsed
seconds old.maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour.minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeAverageEthPrices
tokens
.minTimeElapsed
and maxTimeElapsed
seconds old.maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour. Note: minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeAverageEthForTokens
tokenAmount
ether in terms of weth. Computes the time-weighted average price of token
in terms of weth by getting the current price from Uniswap and searching for a historical price which is between minTimeElapsed
and maxTimeElapsed
seconds old, then multiplies by wethAmount
. Note: maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour. Note: minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeAverageTokensForEth
wethAmount
ether in terms of token
. Computes the time-weighted average price of weth in terms of the token by getting the current price from Uniswap and searching for a historical price which is between minTimeElapsed
and maxTimeElapsed
seconds old, then multiplies by wethAmount
. Note: maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour. Note: minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeAverageEthForTokens
tokenAmounts
in terms of the corresponding token in tokens
. Computes the time-weighted average price of each token in terms of weth by getting the current price from Uniswap and searching for a historical price which is between minTimeElapsed
and maxTimeElapsed
seconds old, then multiplies by the corresponding amount in tokenAmounts
. Note: maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour. Note: minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour.computeAverageTokensForEth
wethAmounts
in terms of the corresponding token in tokens
. Computes the time-weighted average price of weth in terms of each token by getting the current price from Uniswap and searching for a historical price which is between minTimeElapsed
and maxTimeElapsed
seconds old, then multiplies by the corresponding amount in wethAmounts
. Note: maxTimeElapsed
is only accurate to the nearest hour (rounded down) unless it is less than one hour. Note: minTimeElapsed
is only accurate to the nearest hour (rounded up) unless it is less than one hour._getTwoWayPrice
_getTokenPrice
_getEthPrice