First-Past Manifest Registry

first-past-manifest-registry · discovery-registry · 682 B runtime · registry-info

scores

source

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

contract FirstPastManifestRegistry {
    struct Record {
        address owner;
        bytes32 contentHash;
    }

    mapping(bytes32 => Record) private records;

    event NameClaimed(bytes32 indexed name, address indexed owner, bytes32 contentHash);
    event ContentHashUpdated(bytes32 indexed name, bytes32 oldHash, bytes32 newHash);

    function claim(bytes32 name, bytes32 contentHash) external {
        require(records[name].owner == address(0), "already claimed");
        records[name] = Record(msg.sender, contentHash);
        emit NameClaimed(name, msg.sender, contentHash);
    }

    function update(bytes32 name, bytes32 newContentHash) external {
        Record storage rec = records[name];
        require(rec.owner == msg.sender, "not owner");
        bytes32 oldHash = rec.contentHash;
        rec.contentHash = newContentHash;
        emit ContentHashUpdated(name, oldHash, newContentHash);
    }

    function getRecord(bytes32 name) external view returns (address owner, bytes32 contentHash) {
        Record storage rec = records[name];
        return (rec.owner, rec.contentHash);
    }
}

published

published on mainnet · 0xbA6B469865986CdaC6bC968441532E6B8D7570EE · tx 0xdb3366398631213c… · tempo (4217) · mainnet

published on testnet · 0x07575A4163259211a4FA3AF87FdC8BB4eE80c611 · tx 0xdf75f0f94990c2bb… · tempo (42431) · testnet