Skip to content

🐍 snekmate v0.1.2

Latest
Compare
Choose a tag to compare
@pcaversaccio pcaversaccio released this 25 Jun 07:57
· 25 commits to main since this release
908aa9c

β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•‘β–‘β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘
β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–‘β–‘β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•—β–‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β•β–‘β–‘
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–‘β•šβ•β•β–‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β•šβ•β•β•β•β•β•β•β•šβ•β•β–‘β–‘β•šβ•β•β•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β–‘β–‘β•šβ•β•β•šβ•β•β–‘β–‘β–‘β–‘β–‘β•šβ•β•β•šβ•β•β–‘β–‘β•šβ•β•β–‘β–‘β–‘β•šβ•β•β–‘β–‘β–‘β•šβ•β•β•β•β•β•β•

β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–‘β–‘β–ˆβ–ˆβ•—β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘
β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ•—β–‘β–‘β–ˆβ–ˆβ–ˆβ•‘β–‘β–‘β–‘β•šβ•β•β•β•β–ˆβ–ˆβ•—
β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β–‘β–‘β•šβ–ˆβ–ˆβ•‘β–‘β–‘β–‘β–‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
β–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•‘β–‘β–‘β–‘β–ˆβ–ˆβ•”β•β•β•β•β–‘
β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–‘β•šβ•β•β•β•β•β•β–‘β•šβ•β•β•šβ•β•β•šβ•β•β•šβ•β•β•β•β•β•β•

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 native BLOCKHASH opcode.
  • For blocks between 257 and 8,191 blocks ago, the function block_hash queries the EIP-2935 history contract using the specified get 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

♻️ Refactoring

  • Explicitly set nonreentrancy off pragma. (#320)

πŸ› Bug Fixes

  • Extensions
    • erc4626: Fix _max_withdraw check in withdraw function to use owner. (#327)

πŸ“„ Licensing

πŸ”– Release Management

  • Add provenance to npm release. (#314)

❗️ Breaking Changes

  • The contracts create_address.vy and create2_address.vy have been renamed to create.vy and create2.vy, respectively. In create.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, in create2.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 no prague support, you must compile β€” using the cancun 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

πŸ‘€ Full Changelog