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

AddrResolver

Overview

AddrResolver is an abstract contract responsible for managing address records associated with Payment ID tokens, supporting both direct updates and signature-based authorization.

Key Concepts

Concept
Description

Address Resolution

Stores address mappings for Payment ID tokens, allowing structured lookup and updates.

EIP-712 Signature-Based Updates

Enables gasless transactions using off-chain signatures, ensuring security through nonce management and signature verification.

Public Key Registry Integration

Ensures ownership validation by linking public keys to addresses.

Data Structures

Immutable Components

Name
Type
Description

publicKeyRegistry

IPublicKeyRegistry

Stores the reference to the public key registry contract.

State Variables

Name
Type
Description

_addrs

mapping(uint256 => mapping(uint256 => mapping(uint256 => bytes)))

Nested mapping storing addresses for different source and address types per token.

nonces

mapping(address => uint256)

Tracks the nonce for each address to prevent replay attacks.

Type Hashes

Name
Type
Description

SET_ADDR_TYPEHASH

bytes32

Type hash for setting a single address via signature.

BATCH_SET_ADDR_TYPEHASH

bytes32

Type hash for setting multiple addresses via signature.

Functions

Initialization

Constructor

constructor(address _publicKeyRegistry)
Input Parameter
Type
Description

_publicKeyRegistry

address

Address of the public key registry contract.

Address Management

addr

function addr(uint256 tokenId, uint256 sourceType, uint256 addrType) external view returns (bytes memory)
Input Parameter
Type
Description

tokenId

uint256

ID of the token.

sourceType

uint256

Type of source for the address.

addrType

uint256

Type of address to retrieve.

Returns

bytes memory

The stored address record.

setAddr

function setAddr(uint256 tokenId, uint256 sourceType, uint256 addrType, bytes memory newAddr) external
Input Parameter
Type
Description

tokenId

uint256

ID of the token.

sourceType

uint256

Type of source for the address.

addrType

uint256

Type of address to set.

newAddr

bytes memory

The new address value.

Signature-Based Address Management

setAddrWithSig

function setAddrWithSig(uint256 tokenId, uint256 sourceType, uint256 addrType, bytes memory newAddr, address owner, bytes calldata signature) external
Input Parameter
Type
Description

tokenId

uint256

ID of the token.

sourceType

uint256

Type of source for the address.

addrType

uint256

Type of address to set.

newAddr

bytes memory

The new address value.

owner

address

The owner authorizing the change.

signature

bytes calldata

The EIP-712 signature.

batchSetAddrWithSig

function batchSetAddrWithSig(uint256 tokenId, uint256[] calldata sourceTypes, uint256[] calldata addrTypes, bytes[] calldata newAddrs, address owner, bytes calldata signature) external
Input Parameter
Type
Description

tokenId

uint256

ID of the token.

sourceTypes

uint256[]

Array of source types.

addrTypes

uint256[]

Array of address types.

newAddrs

bytes[]

Array of new address values.

owner

address

The owner authorizing the change.

signature

bytes calldata

The EIP-712 signature.

Nonce Management

getNonce

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

owner

address

The address to get the nonce for.

Returns

uint256

The current nonce value.

Events

Event
Parameters
Description

AddressChanged

(uint256 tokenId, uint256 sourceType, uint256 addrType, bytes newAddr)

Emitted when an address record is updated.

AddressChangedWithSig

(uint256 tokenId, uint256 sourceType, uint256 addrType, bytes newAddr, uint256 nonce)

Emitted when an address is updated using a signature.

BatchAddressChangedWithSig

(uint256 tokenId, uint256 nonce)

Emitted when multiple addresses are updated using a signature.

Errors

Error
Description

AddrResolver__InvalidSignature

Thrown when a signature is invalid.

AddrResolver__InvalidPublicKey

Thrown when the recovered public key is not associated with an owner.

AddrResolver__ArrayLengthMismatch

Thrown when input arrays have different lengths.

PreviousRegistrationControllerNextPublicResolver

Last updated 1 month ago