PIDRegistry
Overview
PIDRegistry
is a core contract in the Payment ID system that manages the mapping between tokenIds and their respective owners and resolvers. It serves as the central registry for all Payment ID records, maintaining ownership information and resolver configurations for each tokenId.
Key Concepts
Record Management
Stores and manages owner and resolver information for each tokenId.
Authorization Control
Ensures only authorized parties (token owner or PID contract) can modify records.
Ownership Tracking
Maintains a record of who owns each tokenId.
Resolver Assignment
Associates each tokenId with a resolver contract that handles address resolution.
Data Structures
State Variables
records
mapping(uint256 => Record)
Private mapping that stores owner and resolver information for each tokenId.
pid
address
Address of the PID token contract that is authorized to modify records.
Custom Types
Record
{address owner; address resolver;}
Structure containing owner and resolver information for a tokenId.
Functions
Constructor
_pid
address
Address of the PID token contract.
PIDRegistry__InvalidPIDAddress
Thrown when the provided PID address is zero.
Record Management
setRecord
_tokenId
uint256
The token ID to update the record for.
_owner
address
The new owner address.
_resolver
address
The new resolver address.
setResolver
_tokenId
uint256
The token ID to update the resolver for.
_resolver
address
The new resolver address.
PIDRegistry__NotAuthorized
Thrown when caller is not the record owner or PID contract.
setOwner
_tokenId
uint256
The token ID to update the owner for.
_owner
address
The new owner address.
PIDRegistry__NotAuthorized
Thrown when caller is not the record owner or PID contract.
Getter Functions
owner
tokenId
uint256
The token ID to get the owner for.
address
The owner of the specified tokenId.
resolver
tokenId
uint256
The token ID to get the resolver for.
address
The resolver address for the specified tokenId.
recordExists
tokenId
uint256
The token ID to check existence for.
bool
true
if a record exists for the tokenId, false
otherwise.
Events
NewResolver
(uint256 indexed tokenId, address resolver)
Emitted when a resolver is set for a tokenId.
Transfer
(uint256 indexed tokenId, address owner)
Emitted when ownership of a tokenId is transferred.
Errors
PIDRegistry__NotAuthorized
Thrown when a caller attempts to modify a record they don't own.
PIDRegistry__InvalidPIDAddress
Thrown when initializing with a zero address for the PID contract.
Last updated