Skip to content

🐍 snekmate v0.1.1

Choose a tag to compare

@pcaversaccio pcaversaccio released this 03 Apr 17:36
· 126 commits to main since this release
b72412a

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

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

It's been a while since the last module release, but now 🐍 snekmate version 0.1.1 is here, optimised for the latest 🐍Vyper release 0.4.1:

pip install vyper snekmate

This release is primarily focused on refining contract code structure, expanding test coverage, and introducing the new pausable feature:

# pragma version ~=0.4.1

from ethereum.ercs import IERC20
from ethereum.ercs import IERC20Detailed
from snekmate.auth import ownable
from snekmate.tokens import erc20
from snekmate.utils import pausable

initializes: ownable
initializes: erc20[ownable := ownable]
initializes: pausable

implements: IERC20
implements: IERC20Detailed

exports: (
    erc20.owner,
    erc20.transfer_ownership,
    erc20.renounce_ownership,
    erc20.totalSupply,
    erc20.balanceOf,
    erc20.approve,
    erc20.allowance,
    erc20.IERC20Detailed,
    erc20.mint,
    erc20.set_minter,
    pausable.paused,
)

@deploy
def __init__():
    ownable.__init__()
    erc20.__init__("Vyper", "VY", 18, "Vyper", "1")
    pausable.__init__()

@external
def transfer(to: address, amount: uint256) -> bool:
    pausable._require_not_paused()
    erc20._transfer(msg.sender, to, amount)
    return True

@external
def transferFrom(owner: address, to: address, amount: uint256) -> bool:
    pausable._require_not_paused()
    erc20._spend_allowance(owner, msg.sender, amount)
    erc20._transfer(owner, to, amount)
    return True

@external
def pause():
    ownable._check_owner()
    pausable._pause()

@external
def unpause():
    ownable._check_owner()
    pausable._unpause()

I deployed and verified the contract on Sepolia at 0x19dD047ecA50C037e848fbc5Fb4c875Bfc35A4D5.

πŸ‘‡ Below are the detailed code changes, 🐍 snekmate's new contributors, and the full CHANGELOG. Keep pushing with persistence. Exceed your limits. Forge ahead with confidence.

πŸ’₯ New Features

  • Utility Functions

♻️ Refactoring

  • Authentication
  • Extensions
    • erc2981:
      • Use relative interfaces imports. (#263)
      • Remove unnecessary denominator variable declaration. (#267)
    • erc4626: Use keyword arguments for event instantiation. (#280)
  • Governance
  • Tokens
    • erc20:
      • Use relative interfaces imports. (#263)
      • Use keyword arguments for event instantiation. (#280)
    • erc721:
      • Use relative interfaces imports. (#263)
      • Use keyword arguments for event instantiation. (#280)
    • erc1155:
      • Use relative interfaces imports. (#263)
      • Use keyword arguments for event instantiation. (#280)
  • Utility Functions

πŸ₯’ Test Coverage

  • All 🐍 snekmate contract tests, i.e. unit tests, stateless and stateful fuzzing tests (including Echidna), and Halmos-based symbolic tests, are now also run against the experimental Venom backend. (#268)

  • Tokens

    • erc20:
      • Use native halmos createCalldata cheat code. (#273)
      • Use the EVM version cancun in echidna-based tests. (#286)
    • erc721:
      • Use native halmos createCalldata cheat code. (#273)
      • Use the EVM version cancun in echidna-based tests. (#286)
    • erc1155: Use native halmos createCalldata cheat code. (#273)

πŸ™πŸ½ New Contributors

πŸ‘€ Full Changelog