For the complete documentation index, see llms.txt. This page is also available as Markdown.

oracle.gno

NewObservationsTree

func NewObservationsTree() *bptree.BPTree

NewObservationsTree creates the top-level B+tree that indexes pool observation trees by pool path.

Return Values

Name
Type
Description

tree

*bptree.BPTree

Empty B+tree suitable for storing pool-path observation trees.

source

Types

Observation

source

Methods

BlockTimestamp

Observation getter methods. BlockTimestamp returns the observation's block timestamp.

Return Values

Name
Type
Description

blockTimestamp

int64

Timestamp at which this observation was recorded.

source

Initialized

Initialized reports whether the observation contains initialized oracle data.

Return Values

Name
Type
Description

initialized

bool

True when the observation slot has been initialized; false for an empty slot.

source

SecondsPerLiquidityCumulativeX128

SecondsPerLiquidityCumulativeX128 returns the Q128-encoded cumulative seconds-per-liquidity value recorded by the observation.

Return Values

Name
Type
Description

secondsPerLiquidityCumulativeX128

string

Decimal string containing the cumulative value scaled by 2^128.

source

TickCumulative

TickCumulative returns the signed cumulative tick recorded by the observation.

Return Values

Name
Type
Description

tickCumulative

int64

Cumulative tick value through the observation timestamp.

source

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.

source

Methods

Get

Get looks up an observation by its circular-buffer index.

Parameters

Name
Type
Description

index

uint16

uint16 observation slot to read.

Return Values

Name
Type
Description

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.

source

Has

Has reports whether an observation slot exists in the tree.

Parameters

Name
Type
Description

index

uint16

uint16 observation slot to test.

Return Values

Name
Type
Description

exists

bool

True when the initialized tree contains index; false for nil/uninitialized trees or an absent slot.

source

Set

Set stores an observation at a circular-buffer index.

Parameters

Name
Type
Description

index

uint16

uint16 observation slot to write.

observation

Observation

Observation value to associate with index.

source

Constructors

  • func NewObservationTree() *ObservationTree (source)

  • func NewPoolObservationsTree(currentTime int64) *ObservationTree (source)

Last updated