Selector Echo

selector-echo · discovery-registry · 532 B runtime · registry-info

scores

source

pragma solidity ^0.8.13;

contract SelectorEcho {
    function lookup(address candidate, bytes4 selector) external view returns (address agent) {
        (bool ok, bytes memory ret) = candidate.staticcall{gas: 10_000}(abi.encodePacked(selector));
        if (!ok || ret.length < 32) return address(0);
        return abi.decode(ret, (uint256)) != 0 ? candidate : address(0);
    }
}