Sample
Implements
Serializable
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new Sample(timestamp?, cumulativeId?, cumulativeVolatilityAccumulated?, cumulativeBinCrossed?): Sample
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
timestamp | u64 | 0 | The timestamp of the sample |
cumulativeId | u256 | ZERO | The weighted average cumulative id |
cumulativeVolatilityAccumulated | u256 | ZERO | The weighted average cumulative volatility accumulated |
cumulativeBinCrossed | u256 | ZERO | The weighted average cumulative bin crossed |
Returns
Defined in
Properties
cumulativeBinCrossed
• cumulativeBinCrossed: u256 = ZERO
The weighted average cumulative bin crossed
Defined in
cumulativeId
• cumulativeId: u256 = ZERO
The weighted average cumulative id
Defined in
cumulativeVolatilityAccumulated
• cumulativeVolatilityAccumulated: u256 = ZERO
The weighted average cumulative volatility accumulated
Defined in
timestamp
• timestamp: u64 = 0
The timestamp of the sample
Defined in
Methods
deserialize
▸ deserialize(data, offset): Result<i32>
Parameters
| Name | Type |
|---|---|
data | StaticArray<u8> |
offset | i32 |
Returns
Result<i32>
Implementation of
Serializable.deserialize
Defined in
serialize
▸ serialize(): StaticArray<u8>
Returns
StaticArray<u8>
Implementation of
Serializable.serialize
Defined in
update
▸ update(_activeId, _volatilityAccumulated, _binCrossed): Sample
Parameters
| Name | Type | Description |
|---|---|---|
_activeId | u64 | The active index of the pair during the latest swap |
_volatilityAccumulated | u64 | The volatility accumulated of the pair during the latest swap |
_binCrossed | u64 | The bin crossed during the latest swap |
Returns
Sample The updated sample
Notice
Function to update a sample