LogoLogo
AppBlogTwitterDiscord
  • Overview
    • .bnb Name Service
    • .arb Name Service
    • SPACE ID Token (ID)
    • Roadmap
  • - DOMAIN & PAYMENT ID -
    • Domain Tutorials
      • Set Up a Wallet
      • Discover
      • Register
      • Trade
      • Manage
    • Domain Programs
      • SPACE ID Premier Club
      • SPACE ID DAO
      • SPACE ID Grant Program
      • SPACE ID Referral Program
      • SPACE ID Gift Card
      • SPACE ID Cosmic Council
      • SPACE ID Voyage Season 2 - Calling
    • Using Domain on MetaMask Snap
      • Knowledge Base
      • General FAQ
  • Payment ID
    • Architecture
    • ZK Email Oauth Login
    • Key Terms
    • Core Contracts
      • PID
      • PIDRegistry
      • RegistrationController
      • AddrResolver
      • PublicResolver
    • Contract Addresses
  • - Launch your TLDs with SPACE ID -
    • Overview
    • Step by Step Guide
    • Demos of One-Stop Domain Issuance Toolkit
  • - Developer Guide -
    • Web3 Name API & SDK
      • Web3 Name API
      • Web3 Name SDK
      • FAQ
    • Registration Integration
    • Integration Partners
  • - Legal -
    • Terms of Use
  • Links
    • Github
    • Brand Kit
    • Website
    • Blog
    • Twitter
    • Discord
    • Telegram
Powered by GitBook
On this page
  • Overview
  • Key Concepts
  • Data Structures
  • Functions
  • Events
  • Errors
  1. Payment ID
  2. Core Contracts

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

Concept
Description

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

Name
Type
Description

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

Type
Structure
Description

Record

{address owner; address resolver;}

Structure containing owner and resolver information for a tokenId.

Functions

Constructor

constructor(address _pid) public
Input Parameter
Type
Description

_pid

address

Address of the PID token contract.

Reverts
Description

PIDRegistry__InvalidPIDAddress

Thrown when the provided PID address is zero.

Record Management

setRecord

function setRecord(uint256 _tokenId, address _owner, address _resolver) external
Input Parameter
Type
Description

_tokenId

uint256

The token ID to update the record for.

_owner

address

The new owner address.

_resolver

address

The new resolver address.

setResolver

function setResolver(uint256 _tokenId, address _resolver) public authorised(_tokenId)
Input Parameter
Type
Description

_tokenId

uint256

The token ID to update the resolver for.

_resolver

address

The new resolver address.

Reverts
Description

PIDRegistry__NotAuthorized

Thrown when caller is not the record owner or PID contract.

setOwner

function setOwner(uint256 _tokenId, address _owner) public authorised(_tokenId)
Input Parameter
Type
Description

_tokenId

uint256

The token ID to update the owner for.

_owner

address

The new owner address.

Reverts
Description

PIDRegistry__NotAuthorized

Thrown when caller is not the record owner or PID contract.

Getter Functions

owner

function owner(uint256 tokenId) external view returns (address)
Input Parameter
Type
Description

tokenId

uint256

The token ID to get the owner for.

Returns
Description

address

The owner of the specified tokenId.

resolver

function resolver(uint256 tokenId) external view returns (address)
Input Parameter
Type
Description

tokenId

uint256

The token ID to get the resolver for.

Returns
Description

address

The resolver address for the specified tokenId.

recordExists

function recordExists(uint256 tokenId) external view returns (bool)
Input Parameter
Type
Description

tokenId

uint256

The token ID to check existence for.

Returns
Description

bool

true if a record exists for the tokenId, false otherwise.

Events

Event
Parameters
Description

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

Error
Description

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.

PreviousPIDNextRegistrationController

Last updated 1 month ago