Skip to content
Lattice

ERC1271Signature

Git Source

Inherits: IERC1271

Title: ERC1271Signature

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/draft-ERC7739Utils.sol)

ERC-1271 contract-signature facet. Lets the Diamond declare a signature valid (for permits, Seaport orders, Permit2) when it is a valid signature from the configured AccountSigner owner.

Stateless delegator — logic lives in ERC1271SignatureLib. Implements ERC-7739 defensive rehashing: accepts only nested TypedDataSign / PersonalSign envelopes bound to this account's EIP-712 domain (a plain signature over the raw hash is rejected), defeating cross-account replay.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: ERC-7739

Functions

isValidSignature

Returns 0x1626ba7e when signature is a valid signature over hash for this contract.

The magic value is bytes4(keccak256("isValidSignature(bytes32,bytes)")). Any other return (or a revert) means invalid.

function isValidSignature(bytes32 hash, bytes calldata signature) external view virtual returns (bytes4);

Parameters

NameTypeDescription
hashbytes32The hash of the signed data.
signaturebytesThe signature bytes (opaque; format is account-defined).

Returns

NameTypeDescription
<none>bytes40x1626ba7e if valid, any other value otherwise.

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect ERC1271Signature methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: isValidSignature(bytes32,bytes) 0x1626ba7e

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes