Anchor is a deterministic on-chain risk agent implemented as a Uniswap v4 hook for stablecoin pools.
Anchor is a deterministic, on-chain risk management agent built using Uniswap v4 hooks, designed specifically for stablecoin AMM pools. Stable pools implicitly assume short-term price stability, but in practice experience frequent micro-depegs that lead to unexpected slippage, fee spikes, and liquidity provider exposure. Governance-based interventions are often too slow to respond to these minute-scale events.
Anchor embeds a rule-based agent directly into pool execution. On every swap, the hook observes the pool’s internal price (TWAP) and compares it against an external oracle reference. When deviation exceeds a predefined threshold, Anchor autonomously activates execution guardrails—such as dynamic fee adjustments or trade size limits—to reduce tail-risk exposure while preserving market continuity. Once conditions normalize, the guard deactivates automatically without manual intervention.
The agent is fully deterministic, transparent, and operates entirely on-chain. Anchor does not rely on off-chain bots, AI/ML models, or discretionary governance actions. By leveraging Uniswap v4’s hook architecture, Anchor demonstrates how agent-driven financial systems can be implemented as composable protocol primitives that improve market safety without sacrificing decentralization.
Anchor is built as a Uniswap v4 hook written in Solidity and attached to a stablecoin pool at creation time. The core logic lives in the beforeSwap hook, where Anchor acts as a deterministic on-chain agent. On every swap, the hook reads the pool’s internal price (TWAP) and compares it against an external oracle reference (e.g. Chainlink-style price feed). It computes the relative deviation and evaluates it against a predefined threshold.
When abnormal short-term volatility is detected, Anchor autonomously enforces execution guardrails by modifying swap behavior (e.g. dynamic fee increase or trade-size constraints). These guardrails are applied directly in the execution path, requiring no off-chain bots, cron jobs, or governance intervention. Once the deviation normalizes, the guard automatically deactivates.
The project uses the Uniswap v4 template for pool and hook integration, with a strong emphasis on deterministic behavior, explicit invariants, and composability. A key design choice was intentionally avoiding AI/ML or off-chain automation to keep the agent transparent, auditable, and reliable—demonstrating how agent-driven financial behavior can be embedded directly into protocol infrastructure using hooks

