Releases: pcaversaccio/snekmate
v0.1.0
██╗░░░██╗██╗░░░██╗██████╗░███████╗██████╗░
██║░░░██║╚██╗░██╔╝██╔══██╗██╔════╝██╔══██╗
╚██╗░██╔╝░╚████╔╝░██████╔╝█████╗░░██████╔╝
░╚████╔╝░░░╚██╔╝░░██╔═══╝░██╔══╝░░██╔══██╗
░░╚██╔╝░░░░░██║░░░██║░░░░░███████╗██║░░██║
░░░╚═╝░░░░░░╚═╝░░░╚═╝░░░░░╚══════╝╚═╝░░╚═╝
███████╗██╗░░░██╗░█████╗░██╗░░██╗██╗███╗░░██╗░██████╗░
██╔════╝██║░░░██║██╔══██╗██║░██╔╝██║████╗░██║██╔════╝░
█████╗░░██║░░░██║██║░░╚═╝█████═╝░██║██╔██╗██║██║░░██╗░
██╔══╝░░██║░░░██║██║░░██╗██╔═██╗░██║██║╚████║██║░░╚██╗
██║░░░░░╚██████╔╝╚█████╔╝██║░╚██╗██║██║░╚███║╚██████╔╝
╚═╝░░░░░░╚═════╝░░╚════╝░╚═╝░░╚═╝╚═╝╚═╝░░╚══╝░╚═════╝░
██████╗░░█████╗░░█████╗░██╗░░██╗░██████╗██╗
██╔══██╗██╔══██╗██╔══██╗██║░██╔╝██╔════╝██║
██████╔╝██║░░██║██║░░╚═╝█████═╝░╚█████╗░██║
██╔══██╗██║░░██║██║░░██╗██╔═██╗░░╚═══██╗╚═╝
██║░░██║╚█████╔╝╚█████╔╝██║░╚██╗██████╔╝██╗
╚═╝░░╚═╝░╚════╝░░╚════╝░╚═╝░░╚═╝╚═════╝░╚═╝
After more than two years of relentless work, we've brought a simple vision to life: Making 🐍Vyper code reusable in a truly composable way. Enough the cheap talk — here's the fucking code!
Let's welcome today the 🐍 snekmate version 0.1.0
, targeting the latest (breaking) 🐍Vyper release 0.4.0
! All you need to do going forward is to invoke (in your virtual environment):
pip install vyper snekmate
and you're ready to go! A simple (exemplary) ERC-20 token implementation looks now as follows:
# pragma version ~=0.4.0
from ethereum.ercs import IERC20
from ethereum.ercs import IERC20Detailed
from snekmate.auth import ownable
from snekmate.tokens import erc20
initializes: ownable
initializes: erc20[ownable := ownable]
exports: (
erc20.owner,
erc20.IERC20,
erc20.IERC20Detailed,
erc20.mint,
erc20.set_minter,
)
@deploy
def __init__():
ownable.__init__()
erc20.__init__("Vyper", "VY", 18, "Vyper", "1")
Blockscout already supports the verification of 🐍Vyper 0.4.0
contracts (an example contract I deployed on Sepolia 0x97E68f1Dc2e86bc87e3c01e2Df1075859B5a4856
):
👇 Below you find the detailed code changes, 🐍 snekmate's new contributors, and the full CHANGELOG
. Persevere with determination. Surpass your boundaries. Move forward resolutely.
Important
The aggregating pull request used to implement the subsequent changes is #207.
💥 New Features
- Authentication
ownable
: Makeownable
module-friendly. (#218)ownable_2step
: Makeownable_2step
module-friendly. (#219)access_control
: Makeaccess_control
module-friendly. (#216)
- Extensions
- Governance
timelock_controller
: Maketimelock_controller
module-friendly. (#220)
- Tokens
- Utility Functions
base64
: Makebase64
module-friendly. (#222)batch_distributor
: Makebatch_distributor
module-friendly. (#223)create_address
: Makecreate_address
module-friendly. (#224)create2_address
: Makecreate2_address
module-friendly. (#225)ecdsa
: Makeecdsa
module-friendly. (#227)p256
: Add NIST P-256 (a.k.a. secp256r1) ECDSA verification function. (#243)message_hash_utils
: Move theecdsa
message hash methods to a separatemessage_hash_utils
library module. (#227)signature_checker
: Makesignature_checker
module-friendly. (#228)eip712_domain_separator
: Makeeip712_domain_separator
module-friendly. (#229)math
: Makemath
module-friendly. (#230)merkle_proof_verification
: Makemerkle_proof_verification
module-friendly. (#231)multicall
: Makemulticall
module-friendly. (#232)
- 🐍Vyper Contract Deployer
VyperDeployer
: Improve error message in the event of a 🐍Vyper compilation error. (#219)
🥢 Test Coverage
- Tokens
- Utility Functions
❗️ Breaking Changes
- The file names of 🐍 snekmate module and mock contracts use the snake case notation (e.g.
my_module.vy
ormy_module_mock.vy
), whilst the 🐍Vyper interface files.vyi
use the Pascal case notation prefixed withI
(e.g.IMyInterface.vyi
). (#242) - The mathematical utility functions
_log_2
,_log_10
, and_log_256
are renamed to_log2
,_log10
, and_log256
. (#242) - All 🐍 snekmate contracts now target the new 🐍Vyper default EVM version
cancun
(#245). If you intend to deploy on an EVM chain with nocancun
support, you must compile — using theshanghai
EVM version as an example — the main contract that uses the 🐍 snekmate module contracts with the--evm-version shanghai
option; e.g.vyper --evm-version shanghai src/snekmate/tokens/mocks/erc20_mock.vy
, or add the# pragma evm-version shanghai
directive to the main contract that uses the 🐍 snekmate module contracts:
# pragma version ~=0.4.0
# pragma evm-version shanghai
...
🙏🏽 New Contributors
- @zhouxianyuan made his first contri...
🐍 snekmate v0.0.5
🫡 Summary
Hey fam, it's been a minute! Vyper is grinding hard, and soon you'll be slithering through 🐍 snekmate contracts like a breeze:
from libraries.snekmate.tokens import ERC20
initializes: ERC20
I've put together a guide to kickstart your journey with Vyper modules right here.
We're not quite there yet, though. The 🐍 snekmate 0.0.5
release is the last version targeting Vyper's 0.3.10
version, featuring not only minor code refactorings and optimisations, but also a multi-role-based timelock controller reference implementation (h/t @cairoeth).
Please note that this release ships the src
layout for the repository to properly implement snekmate
-namespaced distribution package building:
Before (0.0.4
)
snekmate
├── pyproject.toml
├── ...
└── src
├── auth
│ ├── ...
├── extensions
│ ├── ...
├── governance
│ ├── ...
├── tokens
│ ├── ...
└── utils
├── ...
After (0.0.5
)
snekmate
├── pyproject.toml
├── ...
└── src
└── snekmate
├── auth
│ ├── ...
├── extensions
│ ├── ...
├── governance
│ ├── ...
├── tokens
│ ├── ...
└── utils
├── ...
👇 Below you find the detailed code changes, 🐍 snekmate's new contributors, and the full CHANGELOG
. Persist relentlessly. Push beyond limits. Forge ahead.
💥 New Features
- Governance
TimelockController
: A multi-role-based timelock controller reference implementation. (#195)
♻️ Refactoring
- Utility Functions
Math
: Refactor theis_negative
function into a propersign
function that returns the indication of the sign of a 32-byte signed integer. (#187)Math
: Rename the recently addedsign
function tosignum
to avoid any ambiguity with cryptographic signing utility functions. (#188)Math
: Optimise the zero point threshold inwad_exp
. (#189)
🔖 Release Management
- Implement
snekmate
-namespaced distribution package building for TestPyPI and PyPI. (#204) - Implement
src
layout to enable an enhanced localpip install git+https://github.com/pcaversaccio/snekmate.git@<branch>
building. (#206)
🙏🏽 New Contributors
- @engn33r made his first contribution via #189.
- @cairoeth made his first contribution via #195.
- @omnifient made his first contribution via #208.
👀 Full Changelog
🐍 snekmate v0.0.4
🫡 Summary
This is a security patch release that removes the multicall_value_self
function as the msg.value
should not be trusted. (#167)
👀 Full Changelog
🐍 snekmate v0.0.3
🫡 Summary
🐻Bear markets are made for building and you know what, the 🐍sneeek is shipping today 🔥! You might have heard that Vyper shipped version 0.3.10
eight days ago. But you might not know that the latest Vyper version is a heavily performance-oriented version that, among other things, generates selector tables that now offer O(1) performance 🤯 (see PR #3496). And so that you can take advantage of the latest improvements, I ship 🐍 snekmate version 0.0.3
today targeting the latest Vyper version!
Important: The default EVM version since Vyper version 0.3.8
is set to shanghai
(i.e. the EVM includes the PUSH0
instruction).
👇 Below you find the detailed code changes and the full CHANGELOG
. Don't stop. Push harder. Keep going.
💥 New Features
♻️ Refactoring
- Extensions
- Tokens
- Utility Functions
- Vyper Contract Deployer
VyperDeployer
: If you want to leverage 🐍 snekmate'sVyperDeployer
contract for your own testing, ensure that you compile the Vyper contracts with the same EVM version as configured in yourfoundry.toml
file. TheVyperDeployer
contract offers two overloadeddeployContract
functions that allow the configuration of the target EVM version. Please note that since Vyper version0.3.8
the default EVM version is set toshanghai
. (#161)
🥢 Test Coverage
- Utility Functions
MerkleProofVerificationTest
: Add an additional test for a possiblemulti_proof_verify
invariant violation. (#137)
❗️ Breaking Change
- All 🐍 snekmate contracts now target the Vyper version
0.3.10
(#164). It is strongly recommended to upgrade accordingly your local Vyper version prior to using the 🐍 snekmate contracts. Important: The default EVM version since Vyper version0.3.8
is set toshanghai
(i.e. the EVM includes thePUSH0
instruction). If you intend to deploy on an EVM chain with noPUSH0
support, you must compile the 🐍 snekmate contracts with the--evm-version paris
option; e.g.vyper --evm-version paris utils/Math.vy
, or add the# pragma evm-version paris
directive to the 🐍 snekmate contracts:
# pragma version ^0.3.10
# pragma evm-version paris
# pragma optimize gas
"""
@title Modern and Gas-Efficient ERC-20 + EIP-2612 Implementation
...
"""
# @dev We import and implement the `ERC20` interface,
# which is a built-in interface of the Vyper compiler.
from vyper.interfaces import ERC20
implements: ERC20
...
The
# pragma optimize
directive has also been added in Vyper version0.3.10
(see PR #3493). Please refer to here to learn more about the different optionsnone
,codesize
, andgas
(default).
🙏🏽 New Contributors
- @El-Ku made his first contribution via #154.
- @ControlCplusControlV made his first contribution via #160.
- @zobront made his first contribution via #161.
👀 Full Changelog
🐍 snekmate v0.0.2
🫡 Summary
Vyper shipped version 0.3.9
nine days ago, I ship 🐍 snekmate version 0.0.2
today targeting the latest Vyper version!
Talk is cheap. Show me the code.
For all the math 🤓 nerds, I added wad_ln
and wad_exp
to the standard mathematical utility functions! Check them out here. Another noteworthy change is that I have added default support for EIP-5267 for all contracts that support EIP-712, i.e. ERC20
, ERC721
, and ERC4626
.
Important: The default EVM version since Vyper version 0.3.8
is set to shanghai
(i.e. the EVM includes the PUSH0
instruction).
👇 Below you find the detailed code changes and the full CHANGELOG. On that note, have a great week and keep grinding anon!
💥 New Features
- General
- All 🐍 snekmate contracts now contain an Ethereum Natural Language Specification Format (NatSpec)
custom
field@custom:contract-name
. The underlying rationale is that the block explorers plan to use@custom:contract-name
as contract name and@title
as fallback. (#124)
- All 🐍 snekmate contracts now contain an Ethereum Natural Language Specification Format (NatSpec)
- Extensions
- Tokens
- Utility Functions
EIP712DomainSeparator
: Implement additionally the interfaceIERC5267
. (#129)Math
: Addwad_ln
andwad_exp
to the standard mathematical utility functions. (#91)
♻️ Refactoring
- General
- All 🐍 snekmate contracts are now guaranteed to compile with the Vyper CLI flags
userdoc
anddevdoc
, and, if using the Ape framework, withape compile
. (#126)
- All 🐍 snekmate contracts are now guaranteed to compile with the Vyper CLI flags
- Extensions
- Tokens
- Utility Functions
Base64
: Use the shift operators>>
and<<
introduced in Vyper0.3.8
instead of theshift
instruction. (#127)ECDSA
: Use the shift operators>>
and<<
introduced in Vyper0.3.8
instead of theshift
instruction. (#127)SignatureChecker
: Use the shift operators>>
and<<
introduced in Vyper0.3.8
instead of theshift
instruction. (#127)Math
:- Use directly 🐍 snekmate's
log_2
function in the internal calculation ofwad_cbrt
. (#91) - Use the shift operators
>>
and<<
introduced in Vyper0.3.8
instead of theshift
instruction. (#127) - Use of the ternary operator introduced in Vyper
0.3.8
in the functionceil_div
instead of anif-else
statement. (#128)
- Use directly 🐍 snekmate's
❗️ Breaking Change
- All 🐍 snekmate contracts now target the Vyper version
0.3.9
. It is strongly recommended to upgrade accordingly your local Vyper version prior to using the 🐍 snekmate contracts. Important: The default EVM version since Vyper version0.3.8
is set toshanghai
(i.e. the EVM includes thePUSH0
instruction). If you intend to deploy on an EVM chain with noPUSH0
support, you must compile the 🐍 snekmate contracts with the--evm-version paris
option; e.g.vyper --evm-version paris utils/Math.vy
. (#122)
👀 Full Changelog
🐍 snekmate v0.0.1 🥳
Summary
I am just fucking proud and so happy to release the first official version of 🐍 snekmate
🥳!
Honestly, what a feat:
- 582 commits
- 6,471 source lines of 🐍Vyper code
- 15,137 source lines of Solidity test code
🙏🏻 Special thanks go to all the contributors who supported me during this journey, you're all badass!
🎛 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
Full Changelog
The following 🐍Vyper contracts are available within 🐍 snekmate:
- Authentication
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. (#74)
- Tokens
- Utility Functions
Base64
: Base64 encoding and decoding functions. (#47)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. (#74, #77, #86)MerkleProofVerification
: Merkle tree proof verification functions. (#30)Multicall
: Multicall functions.