1.0.0 • Published 1 year ago

@clober/library v1.0.0

Weekly downloads
-
License
https://license.c...
Repository
github
Last release
1 year ago

Solidity Library by Clober


Docs codecov CI status

Implementation of Clober library contracts: SegmentedSegmentTree, OctopusHeap, and more.

Features

  • 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 of uint8, uint16, or uint32 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.

Installation


npm install @clober/library

Testing


We use hardhat for code coverage and foundry for fuzzing tests.

Check Code Coverage

npm run hardhat:coverage
open coverage/index.html

Run Fuzzing Tests

npm run forge:test

Visulization

Visual aid for OctopusHeap.

cd utils/visualization
pip install -r requirements.txt 
python octopus_heap.py

Licensing


The primary license for Clober Library is the Time-delayed Open Source Software Licence, see License file.