Implementation of Clober library contracts: SegmentedSegmentTree, OctopusHeap, and more.
- SegmentedSegmentTree: A gas-efficient segment tree with a fixed size to support 32768 leaf nodes.
- OctopusHeap: A heap data structure that can store up to 256
uint16
values. Optimized for popping values in close proximity to each other. - PackedUint256: Treats a
uint256
as a group ofuint8
,uint16
, oruint32
and adds, subtracts, or updates the elements of the group by indexing them. - Create1: Utility functions regarding the vanilla
CREATE
operation. - DirtyUint64: Adds, subtracts, and converts clean (original) and dirty (a non-zero representation of the original)
uint64
values.
npm install @clober/library
We use hardhat for code coverage and foundry for fuzzing tests.
npm run hardhat:coverage
open coverage/index.html
npm run forge:test
Visual aid for OctopusHeap.
cd utils/visualization
pip install -r requirements.txt
python octopus_heap.py
Audited by Spearbit from January to February 2023. All security risks are fixed. Full report is available here.
The primary license for Clober Library is the Time-delayed Open Source Software Licence, see License file.