TreeHelper
Table of contents
Constructors
Methods
- _getBottomId
- _getIdsFromAbove
- addToTree
- findFirstBin
- level0
- level1
- level2
- removeFromTree
- setLevel0
- setLevel1
- setLevel2
Constructors
constructor
• new TreeHelper(): TreeHelper
Returns
Methods
_getBottomId
▸ _getBottomId(_branchId
, _leafId
): u32
Private pure function to return the bottom id
Parameters
Name | Type | Description |
---|---|---|
_branchId | u32 | The branch id |
_leafId | u32 | The 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
Name | Type | Description |
---|---|---|
_id | u32 | The 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
Name | Type |
---|---|
_id | u64 |
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
Name | Type | Description |
---|---|---|
_binId | u32 | the binId to start searching |
_rightSide | bool | Whether 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
Name | Type |
---|---|
index | i32 |
Returns
u256
Defined in
assembly/libraries/TreeHelper.ts:148
level2
▸ level2(index
): u256
Parameters
Name | Type |
---|---|
index | i32 |
Returns
u256
Defined in
assembly/libraries/TreeHelper.ts:151
removeFromTree
▸ removeFromTree(_id
): void
Parameters
Name | Type |
---|---|
_id | u64 |
Returns
void
Defined in
assembly/libraries/TreeHelper.ts:53
setLevel0
▸ setLevel0(value
): void
Parameters
Name | Type |
---|---|
value | u256 |
Returns
void
Defined in
assembly/libraries/TreeHelper.ts:154
setLevel1
▸ setLevel1(index
, value
): void
Parameters
Name | Type |
---|---|
index | i32 |
value | u256 |
Returns
void
Defined in
assembly/libraries/TreeHelper.ts:157
setLevel2
▸ setLevel2(index
, value
): void
Parameters
Name | Type |
---|---|
index | i32 |
value | u256 |
Returns
void