Read the oracle
Read verdicts and grades from your own contract or app.
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.
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:
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");
}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.
| Phase | Mainnet | Testnet | Call |
|---|---|---|---|
| Open | first 24 hours | first 1 hour | nothing yet |
| Sampling | the next 1 hour | none | sample(id) |
| Gradable | after that | after that | resolve(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:
| Bit | Reason | When |
|---|---|---|
| 1 | REASON_PPS | share price fell more than 0.5% |
| 2 | REASON_TVL | total assets fell more than 20% |
| 4 | REASON_LIQ | withdrawable cash under 5% of total assets (vaults with an adapter) |
| 8 | REASON_BROKEN | the vault stopped answering |
An adverse grade on an EXIT means Jev was right to warn. On a HOLD it means Jev missed something.
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:
H=<stateHash from getPost>
cast keccak "$(curl -s https://ledger.tarefi.xyz/state/$H.json)" # prints $HEvery signature, response shape and query in one file: docs/developers.md on GitHub.