oracle.gno
NewObservationsTree
func NewObservationsTree() *bptree.BPTreeNewObservationsTree creates the top-level B+tree that indexes pool observation trees by pool path.
Return Values
tree
*bptree.BPTree
Empty B+tree suitable for storing pool-path observation trees.
Types
Observation
Methods
BlockTimestamp
Observation getter methods. BlockTimestamp returns the observation's block timestamp.
Return Values
blockTimestamp
int64
Timestamp at which this observation was recorded.
Initialized
Initialized reports whether the observation contains initialized oracle data.
Return Values
initialized
bool
True when the observation slot has been initialized; false for an empty slot.
SecondsPerLiquidityCumulativeX128
SecondsPerLiquidityCumulativeX128 returns the Q128-encoded cumulative seconds-per-liquidity value recorded by the observation.
Return Values
secondsPerLiquidityCumulativeX128
string
Decimal string containing the cumulative value scaled by 2^128.
TickCumulative
TickCumulative returns the signed cumulative tick recorded by the observation.
Return Values
tickCumulative
int64
Cumulative tick value through the observation timestamp.
Constructors
func DefaultObservation() Observation(source)func GetObservationAt(poolPath string, index uint16) (Observation, error)(source)func MakeObservation(blockTimestamp int64, tickCumulative int64, secondsPerLiquidityCumulativeX128 string, initialized bool) Observation(source)
ObservationTree
ObservationTree is a pool-local oracle ring buffer keyed by index. It owns the B+tree key encoding so oracle code works with uint16 indices.
Methods
Get
Get looks up an observation by its circular-buffer index.
Parameters
index
uint16
uint16 observation slot to read.
Return Values
observation
Observation
Stored observation when the tree contains a value of the expected type; otherwise the zero observation.
ok
bool
True when a stored value was found and decoded as an Observation; false for nil/uninitialized trees, missing slots, or a type mismatch.
Has
Has reports whether an observation slot exists in the tree.
Parameters
index
uint16
uint16 observation slot to test.
Return Values
exists
bool
True when the initialized tree contains index; false for nil/uninitialized trees or an absent slot.
Set
Set stores an observation at a circular-buffer index.
Parameters
index
uint16
uint16 observation slot to write.
observation
Observation
Observation value to associate with index.
Constructors
Last updated