// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import { RuntimeCodeGuardV3 } from "./common/RuntimeCodeGuardV3.sol"; /// @notice Legacy KYA read surface. Results are provenance metadata, never authority. interface ILegacyKYAReadV3 { function isRegistered(address wallet) external view returns (bool); function registeredAt(address wallet) external view returns (uint64); function agentType(address wallet) external view returns (string memory); } /// @notice Minimal ERC-8004-family read surface used by this informational adapter. interface IERC8004ReadV3 { function isActive(uint256 agentId) external view returns (bool); function isAuthorizedOperator(uint256 agentId, address operator) external view returns (bool); } interface IERC8004ValidationReadV3 { function validationStatus(uint256 agentId, bytes32 validationId) external view returns (bool valid, bytes32 evidenceHash, uint64 updatedAt); } interface IERC8004ReputationReadV3 { function reputationRecord(uint256 agentId, bytes32 namespace) external view returns (int256 value, uint64 updatedAt, bytes32 evidenceRoot); } abstract contract PinnedReadAdapterV3 is RuntimeCodeGuardV3 { address public immutable registry; bytes32 public immutable registryCodehash; error InvalidRegistry(); constructor(address registry_, bytes32 codehash_) { if (registry_ == address(0) || registry_.code.length == 0 || registry_.codehash != codehash_) { revert InvalidRegistry(); } _rejectDelegatingRuntime(registry_); registry = registry_; registryCodehash = codehash_; } function _requirePinned() internal view { if (registry.codehash != registryCodehash) revert InvalidRegistry(); } function decisionSemantics() external pure returns (string memory) { return "informational-only; MUST NOT grant custody, access, eligibility, pricing, routing, slashing, or settlement"; } } contract PinnedKYAAdapterV3 is PinnedReadAdapterV3 { constructor(address registry_, bytes32 codehash_) PinnedReadAdapterV3(registry_, codehash_) { } function resolve(address wallet) external view returns (bool registered, uint64 since, string memory kind) { _requirePinned(); ILegacyKYAReadV3 source = ILegacyKYAReadV3(registry); registered = source.isRegistered(wallet); if (registered) { since = source.registeredAt(wallet); kind = source.agentType(wallet); } } } contract PinnedERC8004AdapterV3 is PinnedReadAdapterV3 { constructor(address registry_, bytes32 codehash_) PinnedReadAdapterV3(registry_, codehash_) { } function identity(uint256 agentId, address operator) external view returns (bool active, bool authorizedOperator) { _requirePinned(); active = IERC8004ReadV3(registry).isActive(agentId); authorizedOperator = IERC8004ReadV3(registry).isAuthorizedOperator(agentId, operator); } } contract PinnedERC8004ValidationAdapterV3 is PinnedReadAdapterV3 { constructor(address registry_, bytes32 codehash_) PinnedReadAdapterV3(registry_, codehash_) { } function validation(uint256 agentId, bytes32 validationId) external view returns (bool valid, bytes32 evidenceHash, uint64 updatedAt) { _requirePinned(); return IERC8004ValidationReadV3(registry).validationStatus(agentId, validationId); } } contract PinnedERC8004ReputationAdapterV3 is PinnedReadAdapterV3 { constructor(address registry_, bytes32 codehash_) PinnedReadAdapterV3(registry_, codehash_) { } function reputation(uint256 agentId, bytes32 namespace) external view returns (int256 value, uint64 updatedAt, bytes32 evidenceRoot) { _requirePinned(); return IERC8004ReputationReadV3(registry).reputationRecord(agentId, namespace); } }