Skip to main content
Provides price and liquidity data useful for a wide variety of system designs Instances of stored oracle data, “observations”, are collected in the oracle array Every pool is initialized with an oracle array length of 1. Anyone can pay the SSTOREs to increase the maximum length of the oracle array. New slots will be added when the array is fully populated. Observations are overwritten when the full length of the oracle array is populated. The most recent observation is available, independent of the length of the oracle array, by passing 0 to observe()

Functions

initialize

Initialize the oracle array by writing the first slot. Called once for the lifecycle of the observations array

Parameters:

Return Values:

write

Writes an oracle observation to the array Writable at most once per block. Index represents the most recently written element. cardinality and index must be tracked externally. If the index is at the end of the allowable array length (according to cardinality), and the next cardinality is greater than the current one, cardinality may be increased. This restriction is created to preserve ordering.

Parameters:

Return Values:

grow

Prepares the oracle array to store up to next observations

Parameters:

Return Values:

observe

Returns the accumulator values as of each time seconds ago from the given time in the array of secondsAgos Reverts if secondsAgos > oldest observation

Parameters:

Return Values: