Overview
ThePaymentVerifierRegistry 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
Core Functions
Adding a Payment Method
_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"))
- Payment method must not already exist
- Verifier address cannot be zero
- At least one currency must be provided
PaymentMethodAdded(bytes32 indexed paymentMethod)
Reference: contracts/registries/PaymentVerifierRegistry.sol:44
Removing a Payment Method
contracts/registries/PaymentVerifierRegistry.sol:68
Managing Currencies
contracts/registries/PaymentVerifierRegistry.sol:88 and :102
View Functions
Query Payment Methods
Query Currencies
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
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()
Ownable with onlyOwner modifier
View Functions
All view functions are publicly accessible, allowing any contract or user to query payment method configurations.Events
Usage Example
Adding a new payment method:Security Considerations
- Owner Control: Only the owner can modify payment method configurations, providing strong governance over supported payment methods
- Validation: All inputs are validated to prevent zero addresses and duplicate entries
- Immutable After Addition: Payment method verifiers cannot be changed after addition (must remove and re-add)
- Hash-Based Identification: Using hashes instead of strings provides gas efficiency and standardization
Related Contracts
- Orchestrator - Uses registry to validate payment methods
- EscrowV2 - References registry for deposit creation
- Payment Verifiers - Contracts registered in this registry for proof verification