System Overview
High-level architecture of the Aquarius risk intelligence stack.
Aquarius follows an API-first, protocol-isolated, event-driven architecture. Every layer has a clear responsibility boundary and communicates through well-defined contracts.
Aquarius exposes additional versioned routes under /api/v1 for ZG (0G-aligned advisory pipeline) and vault-gateway (manifest + advisory routing). These are server-side integrations: they do not replace Chainlink CRE or custody user keys.
See Zero Gravity (0G) for diagrams, environment variables, and code paths.
AquariusPerChainVault holds ERC-20 shares only today. Staking and delegation plug in via future strategy adapters.
The codebase is organized as a monorepo with clear separation of concerns:
aquarius-defi-lab/
├── apps/
│ ├── web/ → Next.js 16 frontend (consumer of API)
│ └── api/ → Fastify API (the product)
├── services/
│ ├── event-engine/ → Real-time WSS + event routing
│ ├── prediction-engine/ → HF projection, stress testing
│ ├── scheduler/ → Anomaly detection, circuit breaker
│ └── indexers/ → Per-chain blockchain indexers
├── packages/
│ ├── types/ → Shared TypeScript types
│ ├── sdk/ → Aquarius SDK + agent runtime
│ ├── domain/ → CRE workflow orchestration
│ └── utils/ → Shared utilities
├── contracts/
│ └── src/ → Solidity smart contracts
├── scripts/ → Validation + simulation runners
└── infra/ → Deployment configuration
Data flows through Aquarius in a unidirectional pipeline:
Deterministic Core
Steps 1-5 complete in under 100ms (excluding optional LLM reasoning). The deterministic path never depends on or waits for the LLM layer.
Aquarius now supports an informational Risk Co-Pilot for Aave that is strictly grounded in deterministic context.
ethereum, polygonThe co-pilot uses the existing risk APIs and orchestration state as context input. It does not compute protocol math and does not read blockchain data directly.
Upgrade seams are preserved for later phases:
toolRouter reserved for Option B simulation toolsintentEnvelope reserved for Option C confirmed execution flowv1) for non-breaking evolutionAquarius supports a phased enrollment architecture from the Aave CTA (Employ Aqua Agents) with stable API contracts.
alert_only, mitigate_agent, buffer_vaultpending_onchainsigning_requestedpending_txbound_onchainbind_failedArchitecture seam for infra-grade upgrade is preserved through service-port abstraction:
AgentEnrollmentService (application logic)EnrollmentStorePort (storage contract)InMemoryEnrollmentStore (Phase A adapter)Phase B hard-fail is additive: wallet signing and on-chain activation/deactivation are introduced without breaking existing read contracts.
Employ Aqua Agents CTA requires MetaMask on a supported chain and Tenderly RPC configured for that chain.PHASE_B_POLICY_BINDING=1NEXT_PUBLIC_PHASE_B_POLICY_BINDING=1DATA_PROVIDER_MODE=tenderlyAAVE_VALIDATION_REQUIRE_TENDERLY=1/v1/agent-enrollment/bind-intent)/v1/agent-enrollment/confirm-bind)/v1/agent-enrollment/deactivate-intent)/v1/agent-enrollment/confirm-deactivate)Aquarius now treats chain selection as a first-class execution context for Aave risk paths.
ethereum, polygonThis preserves DDD boundaries:
Shared Contract vs Shared Runtime
"Shared chain contract" means shared request/response schema and validation only. It does not mean shared RPC clients or shared chain addresses. Runtime remains chain-specific for correctness and latency.
The API layer uses Fastify over Next.js API routes because risk intelligence endpoints must operate independently of the frontend deployment cycle. Fastify provides schema-based validation, structured logging, and predictable performance characteristics suitable for infrastructure-grade services.
The event engine, prediction engine, and scheduler are independent services — not library functions called by the API. This allows:
Tenderly Virtual TestNets provide deterministic fork-based simulation that mirrors mainnet state. This enables: