Skip to main content

Validator Modules

IModule

This base interface defines the common methods and properties that all modules should implement. It allows for installation, uninstallation, and type checking of modules.

Interface Breakdown:

interface IModule {
error AlreadyInitialized(address smartAccount);
error NotInitialized(address smartAccount);

function onInstall(bytes calldata data) external;
function onUninstall(bytes calldata data) external;
function isModuleType(uint256 moduleTypeId) external view returns (bool);
function isInitialized(address smartAccount) external view returns (bool);
}

Module Types Overview

Each module type in the AXR wallet system is specialized for a particular function. These include validators, executors, hooks, and fallback modules, which are built upon the base IModule interface.


Validator Modules

Overview

Validator modules are responsible for validating user operations within the wallet. These operations are crucial for verifying transactions and ensuring that all actions are authorized before being executed.

  • Module Type ID: MODULE_TYPE_VALIDATOR
  • Interface: Implements IValidator.

Interface

interface IValidator is IModule {
error InvalidTargetAddress(address target);

function validateUserOp(
PackedUserOperation calldata userOp,
bytes32 userOpHash
) external returns (uint256);

function isValidSignatureWithSender(
address sender,
bytes32 hash,
bytes calldata data
) external view returns (bytes4);
}

Sample Validator Modules

  • MultiSig Validator: Requires multiple signatures from different authorized addresses before a transaction can proceed.
  • Threshold Validator: Allows transactions only if the value being transferred exceeds a specific threshold.

Installation and Uninstallation

All modules follow a similar installation and uninstallation process. When a module is installed or uninstalled, the corresponding onInstall or onUninstall functions are called with any necessary initialization or cleanup data.

Module Type Verification

Modules implement the isModuleType function to verify their type (Validator, Executor, Hook, Fallback), as specified by their moduleTypeId.