Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ERC1271Delegated

Git Source

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

NameTypeDescription
_signingDelegateaddressAddress 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

NameTypeDescription
hashbytes32Hash of the data that was signed
signaturebytesSignature bytes to validate

Returns

NameTypeDescription
magicValuebytes4ERC-1271 magic value (0x1626ba7e) if valid, 0xffffffff if invalid