Skip to main content

TreeHelper

Table of contents

Constructors

Methods

Constructors

constructor

new TreeHelper(): TreeHelper

Returns

TreeHelper

Methods

_getBottomId

_getBottomId(_branchId, _leafId): u32

Private pure function to return the bottom id

Parameters

NameTypeDescription
_branchIdu32The branch id
_leafIdu32The leaf id

Returns

u32

The bottom branchId

Defined in

assembly/libraries/TreeHelper.ts:29


_getIdsFromAbove

_getIdsFromAbove(_id): GetIdsFromAboveReturn

Private pure function to return the ids from above

Parameters

NameTypeDescription
_idu32The current id

Returns

GetIdsFromAboveReturn

The branch id from above

The leaf id from above

Defined in

assembly/libraries/TreeHelper.ts:19


addToTree

addToTree(_id): void

Parameters

NameType
_idu64

Returns

void

Defined in

assembly/libraries/TreeHelper.ts:35


findFirstBin

findFirstBin(_binId, _rightSide): Result<u32>

Returns the first id that is non zero, corresponding to a bin with liquidity in it

Parameters

NameTypeDescription
_binIdu32the binId to start searching
_rightSideboolWhether we're searching in the right side of the tree (true) or the left side (false)

Returns

Result<u32>

The closest non zero bit on the right (or left) side of the tree

Defined in

assembly/libraries/TreeHelper.ts:85


level0

level0(): u256

Returns

u256

Defined in

assembly/libraries/TreeHelper.ts:145


level1

level1(index): u256

Parameters

NameType
indexi32

Returns

u256

Defined in

assembly/libraries/TreeHelper.ts:148


level2

level2(index): u256

Parameters

NameType
indexi32

Returns

u256

Defined in

assembly/libraries/TreeHelper.ts:151


removeFromTree

removeFromTree(_id): void

Parameters

NameType
_idu64

Returns

void

Defined in

assembly/libraries/TreeHelper.ts:53


setLevel0

setLevel0(value): void

Parameters

NameType
valueu256

Returns

void

Defined in

assembly/libraries/TreeHelper.ts:154


setLevel1

setLevel1(index, value): void

Parameters

NameType
indexi32
valueu256

Returns

void

Defined in

assembly/libraries/TreeHelper.ts:157


setLevel2

setLevel2(index, value): void

Parameters

NameType
indexi32
valueu256

Returns

void

Defined in

assembly/libraries/TreeHelper.ts:160