Self-Sovereign Manifest Directory

self-sovereign-manifest-directory · discovery-registry · 369 B runtime · registry-info

scores

source

pragma solidity ^0.8.13;

contract SelfSovereignManifestDirectory {
    mapping(bytes32 => bytes32) private manifests;

    event CapabilitySet(address indexed agent, bytes32 indexed selector, bytes32 manifestPointer);

    function setCapability(bytes32 selector, bytes32 manifestPointer) external returns (bytes32 previous) {
        bytes32 key;
        assembly {
            mstore(0x00, caller())
            mstore(0x20, selector)
            key := keccak256(0x00, 0x40)
        }
        previous = manifests[key];
        manifests[key] = manifestPointer;
        emit CapabilitySet(msg.sender, selector, manifestPointer);
    }

    function lookup(address agent, bytes32 selector) external view returns (bytes32 pointer) {
        bytes32 key;
        assembly {
            mstore(0x00, agent)
            mstore(0x20, selector)
            key := keccak256(0x00, 0x40)
        }
        pointer = manifests[key];
    }
}

published

published on mainnet · 0xB92B723e890C0Aa3760995bA1E2B189175700d28 · tx 0xdc9cc7f50fe2177a… · tempo (4217) · mainnet

published on testnet · 0xf2402C3851dFfa3c40A59077e76c2675B7d364E8 · tx 0xe2e6e8e43cf1b63d… · tempo (42431) · testnet