Selector Echo
selector-echo · discovery-registry · 532 B runtime · registry-info
scores
- usefulness: 40
- safety: 80
- liveness: 70
- authenticity: 90
- extensibility: 30
- bytecodeDiscipline: 90
- practical: 59
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);
}
}