ERC20Verifier is a role-driven ICustomVerifier implementation that enforces strict, granular permissioning over ERC20 approve and transfer function calls. It builds upon OwnedCustomVerifier, using MellowACL-style roles to validate the caller, target asset, and recipient of each operation.
This verifier is designed for use in modular vaults such as SubVault where only specific ERC20 operations should be allowed through a customizable permission matrix.
To allow or deny ERC20 approve and transfer calls based on:
CALLER_ROLE)ASSET_ROLE)RECIPIENT_ROLE)transfer must not be for zero amountapprove allows any amountvalue sent with the call must be 0Each permission check is mapped to a distinct bytes32 role:
| Role Constant | Purpose |
|---|---|
ASSET_ROLE |
Marks which ERC20 tokens are allowed to be interacted with |
CALLER_ROLE |
Who is allowed to perform approve or transfer |
RECIPIENT_ROLE |
Who is allowed to receive tokens (for transfer) or get approval (for approve) |
These roles are expected to be configured via the initialize() function inherited from OwnedCustomVerifier.
constructor(string memory name_, uint256 version_)
OwnedCustomVerifier and disables further initializersverifyCall Functionfunction verifyCall(
address who,
address where,
uint256 value,
bytes calldata callData,
bytes calldata /* verificationData */
) external view override returns (bool)