ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββ
ββββββββββββββββββββββββββ
ββββββββββββββββββββββββββ
ββββββββββββββββββββββββββ
ββββββββββββββββββββββββββ
ββββββββββββββββββββββββββ
Welcome to the π snekmate
0.1.2
release, now aligned with the latest Vyper version 0.4.3
:
pip install vyper snekmate
Important
This release will make all π snekmate contracts now target the new πVyper default EVM version prague
(#331).
Vyper has recently introduced the new raw_create
built-in function via PR #4204. Building on this, this release adds utility functions for contract deployments using CREATE
, CREATE2
, and CREATE3
(i.e. without relying on an initcode factor).
# pragma version ~=0.4.3
# pragma nonreentrancy off
from snekmate.utils import create as c1
from snekmate.utils import create2 as c2
from snekmate.utils import create3 as c3
@external
@payable
def deploy_create(init_code: Bytes[8_192]) -> address:
return c1._deploy_create(init_code)
@external
@payable
def deploy_create2(salt: bytes32, init_code: Bytes[8_192]) -> address:
return c2._deploy_create2(salt, init_code)
@external
@payable
def deploy_create3(salt: bytes32, init_code: Bytes[8_192]) -> address:
return c3._deploy_create3(salt, init_code)
Tip
To showcase the new deployment functions, I deployed a lightweight Vyper implementation of CreateX
on Sepolia at 0x412F9ee470e44e2f53bF18859C41D11d09bba68A
.
Additionally, leveraging EIP-2935, this release introduces a block_hash
function that extends access to historical block hashes beyond the native 256-block limit. It uses the EIP-2935 history contract, which maintains a ring buffer of the last 8,191 block hashes stored in state:
- For blocks within the last 256 blocks, the function
block_hash
uses the nativeBLOCKHASH
opcode. - For blocks between 257 and 8,191 blocks ago, the function
block_hash
queries the EIP-2935 history contract using the specifiedget
method: https://eips.ethereum.org/EIPS/eip-2935#get. - For blocks older than 8,191 blocks or future blocks (including the current one), it returns zero, matching the
BLOCKHASH
behaviour.
# pragma version ~=0.4.3
# pragma nonreentrancy off
from snekmate.utils import block_hash as bh
@external
@view
def block_hash(block_number: uint256) -> bytes32:
return bh._block_hash(block_number)
π Below are the detailed code changes, π snekmate's new contributors, and the full CHANGELOG
. Persist. Excel. Believe.
π₯ New Features
- Utility Functions
β»οΈ Refactoring
- Explicitly set
nonreentrancy off
pragma. (#320)
π Bug Fixes
π Licensing
- Add the MIT License as a dual-licensing option. (#315)
π Release Management
- Add provenance to
npm
release. (#314)
βοΈ Breaking Changes
- The contracts
create_address.vy
andcreate2_address.vy
have been renamed tocreate.vy
andcreate2.vy
, respectively. Increate.vy
, the functions_compute_address_rlp_self
,_compute_address_rlp
, and_convert_keccak256_2_address
have been renamed to_compute_create_address_self
,_compute_create_address
, and_convert_keccak256_to_address
. Similarly, increate2.vy
, the functions_compute_address_self
and_compute_address
have been renamed to_compute_create2_address_self
and_compute_create2_address
. (#323) - All π snekmate contracts now target the new πVyper default EVM version
prague
(#331). If you intend to deploy on an EVM chain with noprague
support, you must compile β using thecancun
EVM version as an example β the main contract that uses the π snekmate module contracts with the--evm-version cancun
option; e.g.vyper --evm-version cancun src/snekmate/tokens/mocks/erc20_mock.vy
, or add the# pragma evm-version cancun
directive to the main contract that uses the π snekmate module contracts:
# pragma version ~=0.4.3
# pragma evm-version cancun
...
ππ½ New Contributors
- @0xkarmacoma made his first contribution via #326.
- @benber86 made his first contribution via #327.