Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SolidityLib

A curated Foundry workspace for reusable Solidity libraries, reference contracts, and a small educational EVM opcode interpreter.

Status: Maintained. Reusable libraries are covered by Foundry tests; examples and legacy contracts remain educational and unaudited.

This repository consolidates the former solidity_lib, solidity_code_ex, and opcode repositories. Their Git histories remain connected to this repository, so the original work is still traceable after the old repositories are removed.

Layout

Path Purpose
src/libraries Reusable bytes, bitmap, CREATE2, ERC-20, and transfer helpers
src/interfaces Minimal protocol interfaces used by the libraries
src/examples Access control, token, auction, payment, proxy, and assembly examples
legacy/solidity-v0.5 Historical math examples kept outside the default build
tools/evm Educational Python interpreter for a subset of EVM opcodes
test Foundry tests for the reusable libraries

Libraries

  • Bitmaps: packed boolean storage across 256-bit buckets.
  • BytesLib: memory and storage byte-array utilities, restored from its declared upstream implementation.
  • Create2: deterministic deployment and address calculation helpers.
  • ERC20Lib: defensive ERC-20 balance reads using staticcall.
  • TransferHelper: checked ERC-20 and native-token transfers.

Development

Requirements: Foundry and Python 3. No third-party Python packages are needed.

git clone --recurse-submodules https://github.com/ZhangPeibin/SolidityLib.git
cd SolidityLib
forge fmt --check
forge build
forge test
python3 -m unittest discover -s tools/evm -t . -p 'test_*.py'

License

Original repository code is MIT licensed unless a file says otherwise. Imported or derived files retain their own SPDX headers, including Unlicense and GPL-2.0-or-later code. OpenZeppelin remains under its upstream license.

About

A curated Foundry workspace for reusable Solidity libraries, reference contracts, and EVM learning tools.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages