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
cumulativeIdu256ZEROThe weighted average cumulative id
cumulativeVolatilityAccumulatedu256ZEROThe weighted average cumulative volatility accumulated
cumulativeBinCrossedu256ZEROThe weighted average cumulative bin crossed

Returns​

Sample

Defined in​

assembly/structs/Sample.ts:14

Properties​

cumulativeBinCrossed​

• cumulativeBinCrossed: u256 = ZERO

The weighted average cumulative bin crossed

Defined in​

assembly/structs/Sample.ts:18


cumulativeId​

• cumulativeId: u256 = ZERO

The weighted average cumulative id

Defined in​

assembly/structs/Sample.ts:16


cumulativeVolatilityAccumulated​

• cumulativeVolatilityAccumulated: u256 = ZERO

The weighted average cumulative volatility accumulated

Defined in​

assembly/structs/Sample.ts:17


timestamp​

• timestamp: u64 = 0

The timestamp of the sample

Defined in​

assembly/structs/Sample.ts:15

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:67


serialize​

▸ serialize(): StaticArray<u8>

Returns​

StaticArray<u8>

Implementation of​

Serializable.serialize

Defined in​

assembly/structs/Sample.ts:58


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:28