Risk Sentinel is an explainable, on-chain risk oracle powered by an off-chain agent.
This project demonstrates a complete end-to-end pipeline where live on-chain protocol state is analyzed off-chain, scored statistically, explained via an LLM, and published back on-chain in a verifiable and replay-safe manner.
Currently deployed and tested on Arbitrum Sepolia with placeholder LP and Lending contracts for stress testing.
Risk Sentinel explores:
Risk as an on-chain, explainable signal โ generated off-chain, anchored on-chain, and consumable by both humans and smart contracts.
[TestnetLiquidityPool] [TestnetLendingPool]
| |
|______ on-chain state __|
|
v
[Off-chain Agent]
- Reads protocol state
- Computes rolling statistics
- Produces risk score (0โ100)
- Generates human-readable explanation (LLM)
|
v
[RiskFeed.sol]
- Owner-gated publishing
- Explanation hash anchored on-chain
- Emits RiskPublished events
|
v
[Listener / Indexer]
- Subscribes to events
- Replay-safe (txHash + logIndex)
- Resolves explanation from hash
The following contracts are deployed on Arbitrum Sepolia:
-
RiskFeed
- Owner-gated oracle contract
- Stores the latest risk report per protocol
- Emits
RiskPublishedevents
-
TestnetLiquidityPool
- Mock liquidity pool
- Simulates TVL changes and liquidity stress
-
TestnetLendingPool
- Mock lending pool
- Simulates utilization pressure (borrows / deposits)
Contract addresses are injected via environment variables and are configurable.
The Risk Sentinel agent:
- Reads live on-chain state from deployed protocol contracts
- Computes rolling statistics (mean, variance, z-score)
- Derives a bounded risk score (0โ100)
- Generates a human-readable explanation using an LLM
- Hashes the explanation and publishes the score on-chain
Design choices
- The agent signs transactions using the RiskFeed owner key
- This preserves strict access control without delegated publishers
- In production, owner and publisher roles would be separated
The listener acts as a lightweight indexer:
- Subscribes to
RiskPublishedevents - Deduplicates events using
(transactionHash + logIndex) - Resolves explanation hashes to stored explanations
- Outputs human-readable risk updates
Replay safety reflects OP-stack behavior.
- โ Owner-gated on-chain risk publishing
- โ Off-chain statistical risk modeling
- โ Explainability anchored on-chain via hash
- โ LLM-assisted narrative generation
- โ Replay-safe event consumption
- โ Clear trust boundary between agent and contract
This does not include:
- Capital deployment
- Automated parameter changes
- DAO governance hooks
- Production persistence layers
- Multi-publisher authorization
- Slashing or incentive mechanisms
This will be addressed on an on-going basis in future sprints (if possible)
- Explainability
- On-chain anchoring
- Delegated publishers
- Oracle price volatility feeds
- Multi-protocol aggregation
- DAO/User-governed risk thresholds
- Contract-consumable risk hooks
- Mainnet deployment
MIT