Twa

Functions

updateValue

Update the TWA (Time-Weighted Average) value in the State memory.

function updateValue(IMaverickV2Pool.State memory self, int256 value, uint256 lookback) internal view;

Parameters

NameTypeDescription

self

IMaverickV2Pool.State

The State memory to update.

value

int256

The new value to set.

lookback

uint256

The lookback period to use for calculating the TWA.

floor

Get the floored TWA value from the State memory.

function floor(IMaverickV2Pool.State memory self) internal pure returns (int32);

Parameters

NameTypeDescription

self

IMaverickV2Pool.State

The State memory to read from.

Returns

NameTypeDescription

<none>

int32

The floored TWA value as an int32.

getTwa

Get the TWA value from the State memory, considering a lookback period.

function getTwa(IMaverickV2Pool.State memory self, uint256 lookback) internal view returns (int256);

Parameters

NameTypeDescription

self

IMaverickV2Pool.State

The State memory to read from.

lookback

uint256

The lookback period to use for calculating the TWA.

Returns

NameTypeDescription

<none>

int256

The TWA value as an int256.

getTwaFloor

Get the floored TWA value from the State memory, based on the lookback period.

function getTwaFloor(IMaverickV2Pool.State memory self, uint256 lookback) internal view returns (int32);

Parameters

NameTypeDescription

self

IMaverickV2Pool.State

The State memory to read from.

lookback

uint256

The lookback period to use for calculating the TWA.

Returns

NameTypeDescription

<none>

int32

The floored TWA value as an int32.

Last updated