The ModuleKit is a development kit for building and testing smart account modules. ModuleKit allows you to:
- Easily build smart account modules with interfaces for:
- Validators
- Executors
- Recovery modules
- Hooks
- Unit test your modules using a dedicated helper library
- Integration test your modules using modular ERC-4337 accounts and a helper library that abstracts away almost all the complexity
forge install rhinestonewtf/modulekitgit clone https://github.com/rhinestonewtf/module-template.git
cd module-template
forge installIExecutorBase: Interface for Executors to inherit from.BaseValidator: Interface for Validator Modules to inherit from.IRecoveryModule: Interface for Recovery Modules to inherit from.
- Validator: Template implementation for Validators.
function exec4337(RhinestoneAccount memory instance, address target, uint256 value, bytes memory callData) internal returns (bool, bytes memory): Executes a UserOperation from the account using atarget, avalueand an already-encodedcallData. Can only use useCALLfrom the account and calculates a default signature.function exec4337(RhinestoneAccount memory instance, address target, uint256 value, bytes memory callData, uint8 operation, bytes memory signature) internal returns (bool, bytes memory): Executes a UserOperation from the account using atarget, avalueand an already-encodedcallData. Can use eitherCALLorDELEGATECALLfrom the account and uses the providedsignature.function addValidator(RhinestoneAccount memory instance, address validator) internal returns (bool): Adds a validator to the account.function addRecovery(RhinestoneAccount memory instance, address validator, address recovery) internal returns (bool): Adds a recovery module to the account.function addExecutor(RhinestoneAccount memory instance, address executor) internal returns (bool): Adds a executor to the account.function removeExecutor(RhinestoneAccount memory instance, address executor) internal returns (bool): Removes a executor from the account.function getUserOpHash(RhinestoneAccount memory instance, address target, uint256 value, bytes memory callData, uint8 operation) internal returns (bytes32): Calculates the hash of a UserOperation in order to be signed for a custom signature.
- Safe{Core} Protocol: ExecutorManager.sol is heavily insprired by Safe's SafeProtocolManager but is compatible across all supported accounts