A comprehensive collection of smart contract wallet implementations and supporting infrastructure, featuring modular account abstraction contracts compatible with ERC-4337 and ERC-7579 standards.
This repository contains production-ready smart contract implementations for:
- Modular Account Wallets - Full-featured ERC-4337/ERC-7579 compatible smart wallets
- Minimal Accounts - Lightweight ERC-7702 account implementations
- Paymaster Contracts - Transaction sponsorship and gas abstraction
- Validation Systems - Signature verification and transaction validation
- Access Control - Ownership and role-based permission management
The MinimalAccount and Paymaster contracts have been audited by 0xMacro. View the full audit report: https://0xmacro.com/library/audits/thirdweb-22
- Purpose: Full-featured smart contract wallet with modular architecture
- Standards: ERC-4337, ERC-7579, ERC-1271 compatible
- Features:
- Modular plugin system (validators, executors, hooks, fallbacks)
- Multi-signature support
- Role-based access control
- Batch transaction execution
- Upgradeable via UUPS proxy pattern
- Gas-efficient execution with EntryPoint integration
- Purpose: Lightweight account implementation for ERC-7702
- Features:
- Session-based permissions
- Multi-signer support
- Call and transfer policies
- Minimal gas overhead
- EIP-712 signature validation
- Purpose: Deploy and manage ModularAccount instances
- Features:
- Deterministic account addresses
- Module whitelist management
- Beacon proxy pattern for upgrades
- Gas-optimized deployment
- Purpose: Minimal proxy for account contracts
- Features:
- Low deployment cost
- Delegate all calls to implementation
- Purpose: Standard ECDSA signature validation for accounts
- Features:
- EIP-712 structured signature validation
- Multi-signer support with threshold
- Session key validation
- Compatible with ERC-7579 validator interface
- Purpose: Manage executor modules for accounts
- Features: Install, uninstall, and validate executor modules
- Purpose: Manage validator modules for signature verification
- Features: Validator lifecycle management and validation routing
- Purpose: Manage pre/post execution hooks
- Features: Hook installation and execution flow management
- Purpose: Manage fallback handlers for unknown function calls
- Features: Fallback routing and handler management
Transaction sponsorship and gas abstraction layer supporting multiple EntryPoint versions.
- BasePaymasterV7 - Base implementation for v0.7 EntryPoint
- VerifyingPaymasterV7 - Signature-based transaction sponsorship
- ShieldedVerifyingPaymasterV7 - Enhanced security with additional verification
- BasePaymasterV6 - Base implementation for v0.6 EntryPoint
- VerifyingPaymasterV6 - Signature-based sponsorship for v0.6
- ShieldedVerifyingPaymasterV6 - Enhanced v0.6 implementation
- MultiSigner - Multi-signature verification for paymasters
- Purpose: Single owner access control pattern
- Features:
- Owner transfer functionality
- 2-step ownership transfer for security
- Zero address protection
- Purpose: Role-based access control with ownership
- Features:
- Hierarchical role system
- Role granting/revoking
- Role-based function access
- Owner has super-admin privileges
Standard interfaces ensuring compatibility with ecosystem standards:
- IERC4337Account - Account abstraction interface
- IERC7579Account - Modular account interface
- IERC7579Module - Module interface (validator, executor, hook, fallback)
- IModularAccount - Thirdweb modular account interface
- IERC165 - Interface detection
- IERC721Receiver - NFT receiving capability
- IERC1155Receiver - Multi-token receiving capability
- Foundry toolkit installed
git clone <repository-url>
cd contracts-modular-account
forge install
forge build
forge test
forge fmt
forge snapshot
The modular account system follows a plugin-based architecture:
- Core Account: Base wallet functionality with standard features
- Validators: Handle signature verification and authorization
- Executors: Process and execute transactions
- Hooks: Pre/post execution logic (logging, validation, etc.)
- Fallbacks: Handle calls to non-existent functions
- Paymasters: Sponsor gas costs for user operations
This design enables:
- Composability: Mix and match components based on needs
- Upgradeability: Add new features without changing core contracts
- Gas Efficiency: Only pay for features you use
- Security: Isolated module permissions and validation
- ERC-4337: Account Abstraction via Entry Point Contract Specification
- ERC-7579: Minimal Modular Smart Accounts
- ERC-7702: Set EOA account code for one transaction
- ERC-1271: Standard Signature Validation Method for Contracts
- EIP-712: Typed structured data hashing and signing
This project is licensed under the Apache-2.0 License.