How pcaversaccio/snekmate works
Project Type & Purpose
• Type: Open-source smart-contract building-blocks library in Vyper.
• Purpose: Offer modular, reusable, hyper-optimised, and secure contracts (auth, tokens, governance, extensions, utils) plus tests and mocks, published via PyPI, npm, and Foundry.
Main Components
• Core Modules (src/snekmate/…):
– auth (ownable, access_control)
– tokens (erc20, erc721, erc1155)
– extensions (erc2981, erc4626)
– governance (timelock_controller)
– utils (base64, ecdsa, merkle, multicall, etc.)
• Interfaces: each module’s interface definitions (…/interfaces/*.vyi)
• Mocks: reference implementations under each category (…/mocks/*.vy)
• Tests: Foundry (unit/property/invariant), Echidna, Halmos test harnesses (test/…)
• Build & Packaging:
– scripts/compile.py & VyperDeployer.sol
– packaging configs: pyproject.toml, package.json, lib/ submodules
– CI workflows (.github/workflows/*.yml)
• Audits & Docs: audits/ and README.md
Relationships & Data Flows
• Package Managers → Codebase: show distribution paths (PyPI, npm, Foundry).
• CI/CD → Codebase: pipelines trigger tests and packaging.
Architectural Patterns & Principles
• Composition-over-inheritance: modules are Vyper modules imported via uses/initialize.
• Modular separation by domain (auth, tokens, governance, utils).
• Tests co-located with code; mocks illustrate integration.
• Multi-language packaging ensures broad adoption.