π snekmate
State-of-the-art, highly opinionated, hyper-optimised, and secure πVyper smart contract building blocks.
This is experimental software and is provided on an "as is" and "as available" basis. We do not give any warranties and will not be liable for any losses incurred through any use of this code base.
π Contracts
src
ββ auth
β ββ Ownable β "Owner-Based Access Control Functions"
β ββ Ownable2Step β "2-Step Ownership Transfer Functions"
β ββ AccessControl β "Multi-Role-Based Access Control Functions"
ββ extensions
β ββ ERC2981 β "ERC-721 and ERC-1155 Compatible ERC-2981 Reference Implementation"
β ββ ERC4626 β "Modern and Gas-Efficient ERC-4626 Tokenised Vault Implementation"
ββ tokens
β ββ ERC20 β "Modern and Gas-Efficient ERC-20 + EIP-2612 Implementation"
β ββ ERC721 β "Modern and Gas-Efficient ERC-721 + EIP-4494 Implementation"
β ββ ERC1155 β "Modern and Gas-Efficient ERC-1155 Implementation"
ββ utils
ββ Base64 β "Base64 Encoding and Decoding Functions"
ββ BatchDistributor β "Batch Sending Both Native and ERC-20 Tokens"
ββ CreateAddress β "`CREATE` EVM Opcode Utility Function for Address Calculation"
ββ Create2Address β "`CREATE2` EVM Opcode Utility Functions for Address Calculations"
ββ ECDSA β "Elliptic Curve Digital Signature Algorithm (ECDSA) Functions"
ββ SignatureChecker β "ECDSA and EIP-1271 Signature Verification Functions"
ββ EIP712DomainSeparator β "EIP-712 Domain Separator"
ββ Math β "Standard Mathematical Utility Functions"
ββ MerkleProofVerification β "Merkle Tree Proof Verification Functions"
ββ Multicall β "Multicall Functions"
π Installation
We offer three convenient ways to install the π snekmate contracts:
1οΈβ£ Foundry
You can install π snekmate via submodules using Foundry with:
forge install pcaversaccio/snekmate
2οΈβ£ PyPI
You can install π snekmate from PyPI with:
pip install snekmate
You can use
pip install snekmate -t .
to install the contracts directly into the current working directory!
3οΈβ£ npm
You can install π snekmate from npm with:
npm install --save-dev snekmate
Or if you are using Yarn:
yarn add --dev snekmate
In case you are using pnpm, invoke:
pnpm add --save-dev snekmate
π©πΌββοΈ Tests
This repository contains Foundry-based unit tests, property-based tests (i.e. fuzzing), and invariant tests for all contracts, if applicable. All tests are run as part of the CI pipeline test-contracts
.
Note: An invariant is a property of a program that should always hold true. Fuzzing is a way of checking whether the invariant is falsifiable.
Contract | Unit Tests | Property-Based Tests | Invariant Tests |
---|---|---|---|
Ownable |
β | β | β |
Ownable2Step |
β | β | β |
AccessControl |
β | β | β |
ERC2981 |
β | β | β |
ERC4626 |
β | β | β |
ERC20 |
β | β | β |
ERC721 |
β | β | β |
ERC1155 |
β | β | β |
Base64 |
β | β | β |
BatchDistributor |
β | β | β |
CreateAddress |
β | β | β |
Create2Address |
β | β | β |
ECDSA |
β | β | β |
SignatureChecker |
β | β | β |
EIP712DomainSeparator |
β | β | β |
Math |
β | β | β |
MerkleProofVerification |
β | β | β |
Multicall |
β | β | β |
β Test Type Implemented β β Test Type Not Implemented
ππΌ Acknowledgements
This repository is inspired by or directly modified from many sources, primarily:
- ApeAcademy
- Batch Distributor
CREATE
Factory- Disperse Research
- Multicall
- OpenZeppelin Contracts
- solady
- solmate
π«‘ Contributing
π snekmate only exists thanks to its contributors. There are many ways to get involved and contribute to our high-quality and secure smart contracts. Check out our Contribution Guidelines!
πΈ Donation
I am a strong advocate of the open-source and free software paradigm. However, if you feel my work deserves a donation, you can send it to this address: 0x07bF3CDA34aA78d92949bbDce31520714AB5b228
. I can pledge that I will use this money to help fix more existing challenges in the Ethereum ecosystem π€.