Skip to main content

Overview

The PaymentVerifierRegistry is a central registry contract that manages the configuration of supported payment methods, their associated verifier contracts, and the currencies each payment method supports. It provides a flexible system for adding and managing different payment methods (like Venmo, Revolut, etc.) along with their specific verification logic. Contract Location: contracts/registries/PaymentVerifierRegistry.sol

Purpose

The PaymentVerifierRegistry serves several critical functions:
  • Payment Method Management: Register and manage different off-chain payment methods
  • Verifier Assignment: Associate each payment method with its specific verifier contract
  • Currency Support: Define which currencies (USD, EUR, etc.) each payment method supports
  • Centralized Configuration: Provide a single source of truth for payment method configurations

Key Components

State Variables

  • store: Maps payment method hashes to their configuration (verifier address and supported currencies)
  • paymentMethods: Array of all registered payment method identifiers

PaymentMethodConfig Struct

Stores the complete configuration for a payment method including its verifier contract and supported currencies.

Core Functions

Adding a Payment Method

Registers a new payment method with its verifier and initial set of supported currencies. Parameters:
  • _paymentMethod: Hash of the payment method name (lowercase, e.g., keccak256("venmo"))
  • _verifier: Address of the verifier contract for this payment method
  • _currencies: Array of currency code hashes (e.g., keccak256("USD"))
Requirements:
  • Payment method must not already exist
  • Verifier address cannot be zero
  • At least one currency must be provided
Emits: PaymentMethodAdded(bytes32 indexed paymentMethod) Reference: contracts/registries/PaymentVerifierRegistry.sol:44

Removing a Payment Method

Removes a payment method and all its associated configuration. Reference: contracts/registries/PaymentVerifierRegistry.sol:68

Managing Currencies

Add or remove supported currencies for a specific payment method. Reference: contracts/registries/PaymentVerifierRegistry.sol:88 and :102

View Functions

Query Payment Methods

Query registered payment methods and their verifiers.

Query Currencies

Check currency support for specific payment methods.

Integration with Core Contracts

Orchestrator

The Orchestrator contracts (Orchestrator.sol and OrchestratorV2.sol) reference the PaymentVerifierRegistry to:
  • Validate that intents use registered payment methods
  • Retrieve the appropriate verifier contract for payment verification
  • Ensure the requested currency is supported by the payment method
Reference: contracts/Orchestrator.sol:83

EscrowV2

EscrowV2 uses the registry to validate payment method configurations when creating deposits. Reference: contracts/EscrowV2.sol:128

Payment Verifiers

Verifier contracts registered in this registry are called to validate ZK proofs of off-chain payments.

Access Control

Owner-Only Functions

All state-modifying functions are restricted to the contract owner:
  • addPaymentMethod()
  • removePaymentMethod()
  • addCurrencies()
  • removeCurrencies()
Access Control Pattern: OpenZeppelin’s Ownable with onlyOwner modifier

View Functions

All view functions are publicly accessible, allowing any contract or user to query payment method configurations.

Events

These events enable off-chain monitoring of payment method configuration changes.

Usage Example

Adding a new payment method:

Security Considerations

  1. Owner Control: Only the owner can modify payment method configurations, providing strong governance over supported payment methods
  2. Validation: All inputs are validated to prevent zero addresses and duplicate entries
  3. Immutable After Addition: Payment method verifiers cannot be changed after addition (must remove and re-add)
  4. Hash-Based Identification: Using hashes instead of strings provides gas efficiency and standardization
  • Orchestrator - Uses registry to validate payment methods
  • EscrowV2 - References registry for deposit creation
  • Payment Verifiers - Contracts registered in this registry for proof verification