ERC6538Registry
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
| Name | Type | Description |
|---|---|---|
| schemeId | uint256 | The stealth-address scheme id. |
| stealthMetaAddress | bytes | The 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
| Name | Type | Description |
|---|---|---|
| registrant | address | The account authorizing the registration. |
| schemeId | uint256 | The stealth-address scheme id. |
| signature | bytes | The registrant's EIP-712 signature (EOA or ERC-1271). |
| stealthMetaAddress | bytes | The 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
| Name | Type | Description |
|---|---|---|
| <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
| Name | Type | Description |
|---|---|---|
| registrant | address | The account to query. |
| schemeId | uint256 | The stealth-address scheme id. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bytes | The 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
| Name | Type | Description |
|---|---|---|
| <none> | bytes32 |
nonceOf
Returns the current on-behalf-registration nonce for registrant.
function nonceOf(address registrant) external view virtual returns (uint256);Parameters
| Name | Type | Description |
|---|---|---|
| registrant | address | The account to query. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 | The 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
| Name | Type | Description |
|---|---|---|
| selectors | bytes |