Data Flow
On-chain, off-chain, and cross-chain data pipelines through the Aquarius system.
Aquarius processes data through three distinct pipelines: on-chain state ingestion, off-chain intelligence computation, and cross-chain risk propagation. Each pipeline is designed for deterministic execution, bounded latency, and graceful degradation.
The primary data pipeline ingests blockchain state and transforms it into actionable risk intelligence.
| Step | Layer | Description | Latency Target |
|---|---|---|---|
| 1 | Ingestion | Aave V3 pool emits supply/borrow/liquidation events | Network-dependent |
| 2 | Routing | Event Router dispatches to subscribers via microtasks | < 1ms |
| 3 | Storage | Position Graph Store updates in-memory state | < 0.5ms |
| 4 | Computation | Prediction Engine computes HF projection, risk velocity, liquidation probability | < 0.1ms per position |
| 5 | Classification | Severity score assigned based on composite risk index | < 0.1ms |
| 6 | Decision | CRE workflow evaluates and selects mitigation action | < 50ms |
| 7 | Execution | Aqua Agent dispatches bounded action on-chain | Transaction-dependent |
| 8 | Validation | Post-execution state verified against expected outcome | < 10ms |
End-to-End Latency
The deterministic path from event ingestion to mitigation dispatch completes in under 100ms, excluding network latency and transaction confirmation.
The off-chain pipeline handles computation that does not require direct blockchain interaction.
┌─────────────────────────────────────┐
│ 1. Data Normalization │
│ Raw events → Canonical types │
├─────────────────────────────────────┤
│ 2. Risk Metric Computation │
│ HF projection, risk velocity, │
│ liquidation probability │
├─────────────────────────────────────┤
│ 3. Severity Score Assignment │
│ 0-100 composite → severity enum │
├─────────────────────────────────────┤
│ 4. Structured Event Emission │
│ Risk signal broadcast via Router │
├─────────────────────────────────────┤
│ 5. Execution Queue Population │
│ Mitigation actions queued for │
│ CRE dispatch │
└─────────────────────────────────────┘
The CRE (Chainlink Runtime Environment) workflow is the orchestration layer that ties intelligence to execution. It runs as a shared domain function callable from both CLI and API:
// Simplified CRE workflow pipeline
const result: CREWorkflowResult = {
protocolStatus: "stable" | "watch" | "high-risk",
riskScore: {
composite: number,
level: RiskSeverity,
dimensions: { utilization, liquidations, oracleHealth },
},
agentDecision: {
decision: "OK" | "ESCALATE" | "OBSERVE_ONLY",
confidence: number,
actionsRequested: string[],
blackSwanDetected: boolean,
},
llmReasoning: {
action: string,
confidence: number,
reason: string,
} | null,
latencies: Record<string, number>,
};The deterministic layers (risk computation, agent decision) always run first. The optional LLM reasoning layer runs asynchronously and never blocks the deterministic path.
Aquarius includes a cross-chain risk propagation layer built on Chainlink CCIP.
CCIPCoordinator contractRoadmap Feature
Cross-chain mitigation execution is on the roadmap. Current implementation supports observe-only risk propagation.
The Event Router is the central nervous system of the data flow. It provides:
"*" channelconst router = new EventRouter();
router.on("risk:evaluated", (event) => {
// Handle risk signal
});
router.onAny((event) => {
// Audit log all events
});
router.dispatch({
type: "risk:evaluated",
payload: riskSignal,
});
router.getStats();
// → { eventCount: 1, lastEventTimestamp: 1708444800000 }