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.
| 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 |
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 usingstaticcall.TransferHelper: checked ERC-20 and native-token transfers.
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'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.