Skip to content

clober-dex/library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

13d8b38 · Jan 23, 2024

History

53 Commits
Jan 16, 2024
Feb 13, 2023
Jan 23, 2024
Feb 13, 2023
Jan 23, 2024
Jan 16, 2024
Jan 22, 2024
Jan 16, 2024
Feb 13, 2023
Feb 13, 2023
Feb 13, 2023
Feb 13, 2023
Jan 16, 2024
Feb 13, 2023
Feb 13, 2023
Jan 16, 2024
Feb 13, 2023
Feb 13, 2023
Feb 14, 2023
Feb 13, 2023
Jan 16, 2024
Jan 16, 2024
Jan 16, 2024
Jan 16, 2024
Jan 16, 2024

Repository files navigation

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

Visualization

Visual aid for OctopusHeap.

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

Audits

Audited by Spearbit from January to February 2023. All security risks are fixed. Full report is available here.

Licensing


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