TickBitmap
Three-level occupancy bitmap for the bounded tick-key domain.
Not a replacement for the 128-bit fee/sequence tree. Changes storage layout.
Constants
MAX_KEY
uint128 internal constant MAX_KEY = 1_774_545;Functions
insert
function insert(Tree storage self, uint128 key) internal returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| self | Tree | |
| key | uint128 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
remove
function remove(Tree storage self, uint128 key) internal;Parameters
| Name | Type | Description |
|---|---|---|
| self | Tree | |
| key | uint128 |
best
function best(Tree storage self, bool highest) public view returns (bool, uint128);Parameters
| Name | Type | Description |
|---|---|---|
| self | Tree | |
| highest | bool |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool | |
| <none> | uint128 |
_bit
function _bit(uint256 bits, bool highest) private pure returns (uint8);Parameters
| Name | Type | Description |
|---|---|---|
| bits | uint256 | |
| highest | bool |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint8 |
Errors
InvalidKey
error InvalidKey();PriceLevelMissing
error PriceLevelMissing();Structs
Tree
struct Tree {
// Each parent bit means its child word is nonempty: root -> middle -> leaf.
uint256 root;
mapping(uint256 group => uint256 bits) middle;
mapping(uint256 word => uint256 bits) leaves;
}Properties
| Name | Type | Description |
|---|---|---|
| root | uint256 | |
| middle | mapping(uint256 group => uint256 bits) | |
| leaves | mapping(uint256 word => uint256 bits) |