ERC1271Delegated
Inherits: IERC1271, EInvalidAddress
Title: ERC1271Delegated
Abstract contract that implements ERC-1271 by delegating signature validation to a stored delegate
Inheriting contracts set the delegate in the constructor. Uses OpenZeppelin's SignatureChecker so the delegate may be an EOA (ECDSA) or a contract (ERC-1271). See EIP-1271 and OpenZeppelin SignatureChecker documentation.
State Variables
signingDelegate
Address that is allowed to sign on behalf of this contract (e.g. Foundation multisig)
address public signingDelegate
_ERC1271_MAGIC
ERC-1271 magic value returned when the signature is valid
bytes4 private constant _ERC1271_MAGIC = IERC1271.isValidSignature.selector
_ERC1271_INVALID
Value returned when the signature is invalid (per EIP-1271)
bytes4 private constant _ERC1271_INVALID = 0xffffffff
Functions
constructor
Sets the signature delegate
constructor(address _signingDelegate) ;
Parameters
| Name | Type | Description |
|---|---|---|
_signingDelegate | address | Address that may sign on behalf of this contract |
isValidSignature
Validates a signature by delegating to the stored delegate via SignatureChecker
function isValidSignature(bytes32 hash, bytes calldata signature)
public
view
virtual
override
returns (bytes4 magicValue);
Parameters
| Name | Type | Description |
|---|---|---|
hash | bytes32 | Hash of the data that was signed |
signature | bytes | Signature bytes to validate |
Returns
| Name | Type | Description |
|---|---|---|
magicValue | bytes4 | ERC-1271 magic value (0x1626ba7e) if valid, 0xffffffff if invalid |