Skip to main content

MerchantRegistry

Inherits: IMerchantRegistry

Title: MerchantRegistry

On-chain registry storing merchant profile hashes

Each merchant can set their profile hash, which corresponds to off-chain merchant metadata stored in Postgres. The hash is computed deterministically from canonical JSON metadata. Usage:

  1. Merchant computes hash from canonical JSON metadata (off-chain)
  2. Merchant calls setProfileHash(hash) to store it on-chain
  3. UI/SDK can verify off-chain metadata integrity by recomputing hash and comparing to on-chain hash

State Variables

profileHashOf

Mapping: merchant address => profile hash (bytes32)

mapping(address => bytes32) public profileHashOf

Functions

setProfileHash

Set the profile hash for the calling merchant

Only the merchant themselves can set their hash (msg.sender)

function setProfileHash(bytes32 newHash) external;

Parameters

NameTypeDescription
newHashbytes32The new profile hash (must not be bytes32(0))

Events

MerchantProfileUpdated

Emitted when a merchant updates their profile hash

event MerchantProfileUpdated(
address indexed merchant, bytes32 indexed profileHash, uint256 timestamp
);

Parameters

NameTypeDescription
merchantaddressThe merchant address
profileHashbytes32The new profile hash
timestampuint256Block timestamp when updated

Errors

InvalidHash

Thrown when attempting to set an invalid hash (bytes32(0))

error InvalidHash();