Overview
OwnedCustomVerifier is an abstract base contract for implementing ICustomVerifier-compatible verifiers with configurable role-based access control. It integrates with MellowACL and provides a flexible initialization mechanism for dynamic permission setup.
This verifier is designed to be used in Verifier.sol as a custom verifier, ****where specific calls must pass access control checks based on predefined roles.
Key Components
Inherits:
ICustomVerifier: Interface used by theVerifiercontract for permission checksMellowACL: Upgradeable, role-based access control module compatible with OpenZeppelin’sAccessControl
Constructor
- Initializes the underlying
MellowACLmodule withname_andversion_ - Disables further initialization to prevent misuse in logic contracts (
_disableInitializers())
Initialization
- Initializes access control roles
-
Decodes input as:
-
Logic:
- Sets
adminas the contract’sDEFAULT_ADMIN_ROLE - Grants each
roles[i]toholders[i]
- Sets
-
Reverts with
ZeroValueif:admin == address(0)- Any holder is zero address
- Any role is
DEFAULT_ADMIN_ROLE
Usage Pattern
This base contract does not implement theverifyCall() method itself. Instead, it is expected to be inherited and extended by a concrete verifier contract that implements the permission logic based on role membership (e.g., checking hasRole(role, who)).
This allows teams to quickly implement custom verifiers that enforce arbitrary permissions (e.g., allow certain addresses to approve, transfer, or delegate) based on assigned roles instead of hardcoded logic.