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:
- Merchant computes hash from canonical JSON metadata (off-chain)
- Merchant calls setProfileHash(hash) to store it on-chain
- 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
| Name | Type | Description |
|---|---|---|
newHash | bytes32 | The 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
| Name | Type | Description |
|---|---|---|
merchant | address | The merchant address |
profileHash | bytes32 | The new profile hash |
timestamp | uint256 | Block timestamp when updated |
Errors
InvalidHash
Thrown when attempting to set an invalid hash (bytes32(0))
error InvalidHash();