BlackHartBlackHart

Solidity Interface

The complete IBROOracle interface. Import directly or use the ABI for off-chain reads. All functions are view -- reading is free (no gas).

IBROOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

interface IBROOracle {
    struct ProtocolScore {
        uint16 bri;              // Composite score, 300-1000 (higher = safer)
        uint8 forgeScale;        // 0=RAW .. 6=ADAMANTINE
        uint64 updatedAt;        // Timestamp of last update
        uint64 sequenceNumber;   // Monotonically increasing per protocol
        bool exists;             // Whether this protocol has been scored
        uint16[12] dimensions;   // D1-D12, each 0-100
        bytes32 evidenceHash;    // Hash of evidence/dimension data
    }

    /// @notice Composite BRI, forge scale, timestamp, and staleness
    function getScore(string calldata slug)
        external view returns (uint16 bri, uint8 forgeScale, uint64 updatedAt, bool isStale);

    /// @notice Full ProtocolScore struct including all 12 dimensions
    function getFullScore(string calldata slug)
        external view returns (ProtocolScore memory);

    /// @notice Single dimension score by index (0-11)
    function getDimension(string calldata slug, uint8 dimensionIndex)
        external view returns (uint16 score);

    /// @notice Batch read for portfolio monitoring
    function batchGetScores(string[] calldata slugs)
        external view returns (uint16[] memory bris, uint8[] memory forgeScales, bool[] memory stale);

    /// @notice Convenience staleness check
    function isStale(string calldata slug) external view returns (bool);
}

Function Reference

getScore(string)(uint16, uint8, uint64, bool)

Returns composite BRI, Forge Scale tier, last update timestamp, and staleness flag. The primary read function for most integrations.

getFullScore(string)ProtocolScore memory

Full score struct with all 12 dimension scores, evidence hash, sequence number, and existence flag.

getDimension(string, uint8)uint16

Single dimension score (0-100) by index. Use for custom re-weighting or dimension-specific gates.

batchGetScores(string[])(uint16[], uint8[], bool[])

Batch read BRI, Forge Scale, and staleness for multiple protocols in one call. Ideal for portfolio monitoring.

isStale(string)bool

True if the score exceeds the staleness threshold (default 24h). Always check before acting on a score.