CapabilityIndex

capabilityindex · discovery-registry · 490 B runtime · registry-info

scores

source

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

contract CapabilityIndex {
    mapping(bytes32 => bool) private _supported;

    event SelectorSet(address indexed agent, bytes4 indexed selector, bool supported);

    function setSelector(bytes4 selector, bool supported) external {
        bytes32 key = _key(msg.sender, selector);
        _supported[key] = supported;
        emit SelectorSet(msg.sender, selector, supported);
    }

    function isSupported(address agent, bytes4 selector) external view returns (bool) {
        return _supported[_key(agent, selector)];
    }

    function _key(address agent, bytes4 selector) private pure returns (bytes32) {
        return bytes32((uint256(uint160(agent)) << 32) | uint32(selector));
    }
}

published

published on mainnet · 0xe9337179F9AAf8C06ec725B37e65fA3d7b5A143C · tx 0x311c87da3971a662… · base (8453) · mainnet · source as deployed

published on testnet · 0x269E3EeE53884291D7c6EDbEeA3783744c8a5C02 · tx 0x7e6c455069b02b69… · base (84532) · testnet · source as deployed