Overview
The IdentityRegistry is a Solidity smart contract (^0.8.20) that provides a minimal, gas-efficient system for mapping identity labels to ENS names and IPFS content identifiers.
Key Features
- Multi-owner whitelist access control system
- Mapping of human-readable labels to identity records
- Each identity record contains: owner address, ENS name, IPFS CID, and timestamp
- Functions for setting, reading, and revoking identities
Contract Structure
Error Handling
- NotAuthorized(): Thrown when unauthorized access is attempted
- ZeroAddress(): Thrown when zero address is provided
- EmptyCID(): Thrown when empty IPFS CID is provided
- SameValue(): Thrown when attempting to set a value that's already set
Data Structures
struct Identity {
address owner; // controller of this identity record
string ensName; // e.g. "keccake256.eth"
string ipfsCid; // e.g. "ipfs://bafybe..."
uint256 updatedAt;
}
State Variables
- mapping(address => bool) public allowedOwners - Whitelist of authorized owners
- mapping(bytes32 => Identity) private identities - Maps hashed key labels to Identity structs
Events
- IdentitySet - Emitted when an identity is created or updated