Skip to content
Lattice

ERC6538Registry

Git Source

Inherits: IERC6538Registry

Title: ERC6538Registry

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from ScopeLift (https://github.com/ScopeLift/stealth-address-erc-contracts), Conforms to ERC-6538 (https://eips.ethereum.org/EIPS/eip-6538)

Stateless Diamond facet implementing the ERC-6538 stealth meta-address registry.

All logic lives in ERC6538RegistryLib. Owns ONLY the registry selectors. It does NOT inherit the EIP712 facet — doing so would re-export eip712Domain() and collide with the standalone EIP712 facet in a Diamond. ERC-5267 domain discovery comes from a separately-cut EIP712 facet; DeployERC6538Registry composes both. The EIP-712 domain (name "ERC6538Registry" / version "1.0") and the registry must be initialized in the diamond initializer.

Notes:

  • lattice-version: 0.1.0
  • lattice-source: Lattice original

Functions

registerKeys

Sets the caller's stealth meta-address for schemeId (last-write-wins).

function registerKeys(uint256 schemeId, bytes calldata stealthMetaAddress) external virtual;

Parameters

NameTypeDescription
schemeIduint256The stealth-address scheme id.
stealthMetaAddressbytesThe caller's stealth meta-address bytes.

registerKeysOnBehalf

Sets registrant's stealth meta-address using an EIP-712 signature from registrant.

Verifies via ECDSA or ERC-1271 over the Erc6538RegistryEntry typed data bound to the registrant's current nonce; the nonce is consumed so the signature is single-use.

function registerKeysOnBehalf(
        address registrant,
        uint256 schemeId,
        bytes calldata signature,
        bytes calldata stealthMetaAddress
    ) external virtual;

Parameters

NameTypeDescription
registrantaddressThe account authorizing the registration.
schemeIduint256The stealth-address scheme id.
signaturebytesThe registrant's EIP-712 signature (EOA or ERC-1271).
stealthMetaAddressbytesThe stealth meta-address bytes to store.

incrementNonce

Advances the caller's nonce by one, invalidating any outstanding on-behalf signatures.

function incrementNonce() external virtual;

DOMAIN_SEPARATOR

Returns the EIP-712 domain separator used for registerKeysOnBehalf signatures.

function DOMAIN_SEPARATOR() external view virtual returns (bytes32);

Returns

NameTypeDescription
<none>bytes32

stealthMetaAddressOf

Returns the stealth meta-address registered by registrant for schemeId.

function stealthMetaAddressOf(address registrant, uint256 schemeId) external view virtual returns (bytes memory);

Parameters

NameTypeDescription
registrantaddressThe account to query.
schemeIduint256The stealth-address scheme id.

Returns

NameTypeDescription
<none>bytesThe registered stealth meta-address bytes (empty if never registered).

ERC6538REGISTRY_ENTRY_TYPE_HASH

Returns the EIP-712 type hash used in registerKeysOnBehalf.

function ERC6538REGISTRY_ENTRY_TYPE_HASH() external view virtual returns (bytes32);

Returns

NameTypeDescription
<none>bytes32

nonceOf

Returns the current on-behalf-registration nonce for registrant.

function nonceOf(address registrant) external view virtual returns (uint256);

Parameters

NameTypeDescription
registrantaddressThe account to query.

Returns

NameTypeDescription
<none>uint256The current nonce.

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 ERC6538Registry methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: DOMAIN_SEPARATOR() 0x3644e515 ERC6538REGISTRY_ENTRY_TYPE_HASH() 0xfe04b106 incrementNonce() 0x627cdcb9 nonceOf(address) 0xed2a2d64 registerKeys(uint256,bytes) 0x042c7aa3 registerKeysOnBehalf(address,uint256,bytes,bytes) 0x428d3d0b stealthMetaAddressOf(address,uint256) 0x7aa8b5ad

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

Returns

NameTypeDescription
selectorsbytes