Skip to main content

State-of-the-art, highly opinionated, hyper-optimised, and secure Vyper smart contract building blocks.

Project description

๐Ÿ snekmate

Test smart contracts License: AGPL v3 npm package PyPI package

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
โ”‚  โ”œโ”€ 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

๐Ÿ‘ฉ๐Ÿผโ€โš–๏ธ 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 โœ… โœ… โœ…
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:

๐Ÿซก 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 ๐Ÿค.

๐Ÿ’ข Disclaimer

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snekmate-0.0.1.tar.gz (73.0 kB view hashes)

Uploaded Source

Built Distribution

snekmate-0.0.1-py3-none-any.whl (90.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page