New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lions-mane/sol-datastructs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lions-mane/sol-datastructs

Common gas-optimized data structures implemented in solidity. Currently supports:

  • 0.1.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Solidity Data Structures

Common gas-optimized data structures implemented in solidity. Currently supports:

  • ArrayLib: Gas Optimized Array for uint16, uint32, uint64, uint128
  • TreeLib: A flexible tree index library, supports wide tress with more than 2 leaves per node.
  • HeapLib: A gas optimized compact heap datastructure. Uses ArrayLib as its storage layer and TreeLib to navigate the heap.
  • Math: A LogBaseN calculator. Used to compute height of tree for informational purposes.

Contracts

These contracts are all solidity libraries meant to be used within externally facing contracts. See the test contracts as an example on how to use the libraries.

ArrayLib

Optimized packed array library (uint16,uint32...), conforms to general Solidity storage layout structure by storing data at keccak256(slot) + i. ArrayLibUtils also implements a naive push() function for in-memory arrays (returns a copy with appended element).

TreeLib

Packed tree stores multiple nodes per storage slot. TreeLib helps with computations such as finding out the parent() or leaves() of a node.

HeapLib

Optimized heap using ArrayLib as storage and TreeLib to compute tree traversal. See tests for benchmarks.

LogBaseNLib

Computes logarithm for any base (provided magic constant logN(2) is stored). This is used for informational purposes when computing the tree height only, though other applications are also possible.

License

2020 Lionsmane Development MIT License.

FAQs

Package last updated on 13 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc