Skip to main content

Sample

Implements

  • Serializable

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Sample(timestamp?, cumulativeId?, cumulativeVolatilityAccumulated?, cumulativeBinCrossed?): Sample

Parameters

NameTypeDefault valueDescription
timestampu640The timestamp of the sample
cumulativeIdu256u256.ZeroThe weighted average cumulative id
cumulativeVolatilityAccumulatedu256u256.ZeroThe weighted average cumulative volatility accumulated
cumulativeBinCrossedu256u256.ZeroThe weighted average cumulative bin crossed

Returns

Sample

Defined in

assembly/structs/Sample.ts:13

Properties

cumulativeBinCrossed

cumulativeBinCrossed: u256 = u256.Zero

The weighted average cumulative bin crossed

Defined in

assembly/structs/Sample.ts:17


cumulativeId

cumulativeId: u256 = u256.Zero

The weighted average cumulative id

Defined in

assembly/structs/Sample.ts:15


cumulativeVolatilityAccumulated

cumulativeVolatilityAccumulated: u256 = u256.Zero

The weighted average cumulative volatility accumulated

Defined in

assembly/structs/Sample.ts:16


timestamp

timestamp: u64 = 0

The timestamp of the sample

Defined in

assembly/structs/Sample.ts:14

Methods

deserialize

deserialize(data, offset): Result<i32>

Parameters

NameType
dataStaticArray<u8>
offseti32

Returns

Result<i32>

Implementation of

Serializable.deserialize

Defined in

assembly/structs/Sample.ts:66


serialize

serialize(): StaticArray<u8>

Returns

StaticArray<u8>

Implementation of

Serializable.serialize

Defined in

assembly/structs/Sample.ts:57


update

update(_activeId, _volatilityAccumulated, _binCrossed): Sample

Parameters

NameTypeDescription
_activeIdu64The active index of the pair during the latest swap
_volatilityAccumulatedu64The volatility accumulated of the pair during the latest swap
_binCrossedu64The bin crossed during the latest swap

Returns

Sample

Sample The updated sample

Notice

Function to update a sample

Defined in

assembly/structs/Sample.ts:27