Documentation

AI Risk & Anomaly Engine

The Signal Intelligence Layer operates alongside the aggregation core, analyzing data patterns to detect risks, score confidence, and classify market conditions — without interfering with deterministic price generation.

💡 Key Insight: Every ORCAFI price update comes with two additional signals — a Confidence Score (0-100) and a Risk Level (LOW → CRITICAL) — enabling your protocol to make defensive decisions.


1. Anomaly Detection

The engine continuously monitors for structural irregularities that may indicate manipulation or market stress:

🔀

Divergence Detection

Flags sudden decoupling between CEX and DEX prices that may indicate delayed arbitrage or manipulation attempts.

📈

Volatility Profiling

Monitors rapid changes in price volatility that may signal flash loan attacks or coordinated manipulation.

💧

Liquidity Distortion

Identifies patterns characteristic of thin-pool manipulation where small trades cause disproportionate price impact.


2. Source Reliability

Data sources are not treated equally. We track long-term performance to weight their contributions:

  • Accuracy Tracking: How often does the source deviate from consensus?
  • Uptime & Stability: Consistent reporting over time, minimal outages
  • Penalty System: Sources with frequent timeouts or invalid data see their reliability score degrade over time

📊 Reliability scores feed directly into the confidence weighting logic, ensuring that historically accurate sources have more influence.


3. Confidence Score Engine

Every oracle update includes a normalized Confidence Score (0-100) derived from four key signals:

👥

Quorum Strength

Higher node participation = Higher confidence

Reliability

Historical accuracy of reporting sources

📐

Deviation

Tight price clustering = Higher confidence

💰

Liquidity

Deep order books = Higher confidence

Confidence Penalties

The engine actively penalizes specific anomalies:

  • Sudden Liquidity Drops: Rapid withdrawal of order book depth
  • Abnormal Volume Spikes: High volume without price displacement (wash trading)
  • Repeated Rejections: Sources frequently failing validation

4. Risk Classification

Based on anomaly severity, confidence degradation, and structural signal correlation, we assign a discrete risk level to every update:

LevelConditionYour Action
LOWNormal market conditions. Tight spreads, high liquidity.✅ Standard operation
MEDIUMModerate volatility or slight source divergence.👀 Monitor closely
HIGHSignificant decoupling or structural anomaly detected.⚠️ Increase confirmations
CRITICALFlash crash, attack vector, or liquidity collapse.🛑 Halt execution

Using Risk Levels in Your Contract

RiskCheck.sol
// Defensive programming with risk levels
uint8 riskLevel = oracle.getRiskLevel("ETH/USD");

if (riskLevel >= 3) { // CRITICAL
    revert("Market conditions unsafe");
}
if (riskLevel >= 2) { // HIGH
    require(msg.value >= 2 * collateralRequired);
}

💡 Pro Tip: Combine confidence scores with risk levels for layered defense. For example, require confidence > 80 AND risk < HIGH for high-value operations.