Docs · Developers

Read the oracle

Read verdicts and grades from your own contract or app.

In one line

Two view calls tell you what Jev thinks of a vault right now, and the contract grades every call it ever made.

Read the latest verdict

latest(vault) returns the newest verdict id for a vault (0 if there is none), and getPost(id) returns the verdict itself.

Solidity · TareRiskOracle
enum Verdict { HOLD, EXIT, MOVE }

struct Post {
    address vault;
    Verdict verdict;
    uint16 confidenceBps;     // how sure Jev is, 0–10,000
    uint16 riskBps;           // Jev's risk score, 0–10,000
    bytes32 stateHash;        // keccak256 of what Jev was shown
    uint64 postedAt;
    uint256 ppsAtPost;        // share price snapshot
    uint256 assetsAtPost;     // total assets snapshot
    uint256 liquidityAtPost;  // withdrawable now, from the adapter
}

function latest(address vault) external view returns (uint256 id);
function getPost(uint256 id) external view returns (Post memory);
function getResolution(uint256 id) external view returns (Resolution memory);

For example, a vault or lending market that stops taking deposits while a confident, fresh EXIT stands:

Solidity · your contract
uint256 id = oracle.latest(vault);
if (id != 0) {
    TareRiskOracle.Post memory p = oracle.getPost(id);
    bool risky = p.verdict == TareRiskOracle.Verdict.EXIT
        && p.confidenceBps >= 9_000
        && block.timestamp - p.postedAt <= 1 hours;
    require(!risky, "Tare: exit verdict");
}
TypeScript · viem
import { abis } from './shared/contracts';

const id = await client.readContract({ address: oracle, abi: abis.oracle, functionName: 'latest', args: [vault] });
const post = await client.readContract({ address: oracle, abi: abis.oracle, functionName: 'getPost', args: [id] });

How every verdict is graded

Anyone can grade a verdict once its window has passed. The contract compares the vault against the snapshot taken when the verdict was posted.

PhaseMainnetTestnetCall
Openfirst 24 hoursfirst 1 hournothing yet
Samplingthe next 1 hournonesample(id)
Gradableafter thatafter thatresolve(id)

sample keeps the worst share price, total assets and withdrawable cash it sees, so a flash loan can't make a vault look healthier. resolve grades on those worst values, or reads once if nobody sampled. Any reason below makes the grade adverse:

BitReasonWhen
1REASON_PPSshare price fell more than 0.5%
2REASON_TVLtotal assets fell more than 20%
4REASON_LIQwithdrawable cash under 5% of total assets (vaults with an adapter)
8REASON_BROKENthe vault stopped answering

An adverse grade on an EXIT means Jev was right to warn. On a HOLD it means Jev missed something.

Events

Solidity · events
event VerdictPosted(uint256 indexed id, address indexed vault, Verdict verdict,
                    uint16 confidenceBps, uint16 riskBps, bytes32 stateHash, uint64 postedAt);
event VerdictSampled(uint256 indexed id, bool broken, uint256 pps, uint256 assets, uint16 liquidityBps);
event VerdictResolved(uint256 indexed id, bool adverse, uint8 reasons);

Check what Jev saw

Each stateHash is the keccak256 of a JSON file archived at https://ledger.tarefi.xyz/state/{stateHash}.json. The file holds the exact bytes that were hashed, so re-hashing it must give the onchain value:

Shell
H=<stateHash from getPost>
cast keccak "$(curl -s https://ledger.tarefi.xyz/state/$H.json)"   # prints $H

Every signature, response shape and query in one file: docs/developers.md on GitHub.