Trust-Minimized Agentic Liquidity Management as a Service for Uniswap v4
SentinelHook (Sepolia): 0xA7F23aFF760f6e34E823Bbf529fE3Fa54C93A080 TxId transactions can be seen on the above address on Etherscan. clicking the above addesses will show the transactions on Etherscan.
Traditional liquidity provision on Uniswap requires constant monitoring and rebalancing. LPs face:
- Impermanent Loss: Price movements outside their range mean zero fee income
- Active Management: Manual rebalancing is time-consuming and gas-intensive
- Idle Capital: Out-of-range liquidity earns nothing
- Trust Issues: Existing "LP management" solutions require trusting a centralized bot
Sentinel Liquidity Protocol is a Liquidity Management as a Service (LMaaS) platform built on Uniswap v4 Hooks. LPs deposit tokens, receive shares, and Sentinel autonomously manages their positions across any supported pool.
| Problem | Sentinel Solution |
|---|---|
| Trust | Hybrid architecture: Immutable Hook (safety) + Chainlink Automation/Functions (execution) |
| Idle Capital | Automatic routing to Aave v3 for lending yield |
| Multi-Pool | Single hook contract serves unlimited pools |
| Gas Efficiency | Shared infrastructure reduces per-LP costs |
graph TD
subgraph "LPs (Users)"
LP1[LP 1]
LP2[LP 2]
LP3[LP N...]
end
subgraph "SentinelHook (One Contract)"
Hook[Multi-Pool Hook]
States[(Per-Pool State)]
Shares[(LP Shares)]
end
subgraph "Uniswap v4 Pools"
Pool1[mUSDC/mETH]
Pool2[mWBTC/mETH]
Pool3[mUSDT/mETH]
end
subgraph "External Protocols"
Aave[Aave v3 - Yield]
Oracle[Chainlink - Safety]
Automation[Chainlink Automation]
end
LP1 -->|Deposit| Hook
LP2 -->|Deposit| Hook
LP3 -->|Deposit| Hook
Hook --> States
Hook --> Shares
Hook <-->|Liquidity| Pool1
Hook <-->|Liquidity| Pool2
Hook <-->|Liquidity| Pool3
Hook <-->|Yield| Aave
Hook <-->|Price Check| Oracle
Automation -->|maintain| Hook
- Trigger:
beforeSwaphook on all pools using Sentinel - Gas Budget: < 50,000 gas
- Logic: Oracle price deviation check (circuit breaker)
- Output: TickCrossed event if price moved outside range
- Trigger: TickCrossed event or scheduled interval
- Executor: Chainlink Automation (Functions optional for off-chain strategy)
- Logic: Calculate optimal range and Active/Idle split off-chain, then execute
maintain() - Output:
maintain()transaction to rebalance
1. LP approves tokens
2. LP calls depositLiquidity(poolId, amount0, amount1)
3. Hook calculates shares based on NAV
4. LP receives shares, tokens held by Hook
5. Next maintain() deploys tokens to pool + Aave
1. Price moves outside active range
2. beforeSwap emits TickCrossed event
3. Chainlink Automation detects event (or cron)
4. Strategy computes optimal new range
5. Chainlink Automation calls maintain(poolId, newRange, volatility)
7. Hook: Withdraw old range → Calculate split → Deploy new range + Aave
1. LP calls withdrawLiquidity(poolId, shares)
2. Hook calculates proportional claim
3. Withdraw from Aave (if needed)
4. Withdraw from pool (proportional liquidity)
5. Transfer tokens to LP, burn shares
sentinel-protocol/
├── src/ # Smart Contracts
│ ├── SentinelHook.sol # Multi-pool hook (main contract)
│ ├── libraries/
│ │ ├── OracleLib.sol # Price deviation checks
│ │ ├── YieldRouter.sol # Active/Idle split calculations
│ │ └── AaveAdapter.sol # Aave v3 integration
│ └── automation/
│ ├── SentinelAutomation.sol # Chainlink Automation + Functions
│ └── functions/
│ └── rebalancer.js # Off-chain strategy computation
│
├── test/ # Foundry Tests (81 passing)
│ ├── unit/ # SentinelHookUnit, OracleLib, YieldRouter, AaveAdapter
│ ├── fuzz/ # Fuzz + invariant testing
│ ├── integration/ # Multi-pool lifecycle tests
│ └── mocks/ # MockERC20, MockAavePool, MockOracle, etc.
│
├── script/ # Deployment Scripts
│ ├── DeployAll.s.sol # Full demo deploy (mocks + pools + seeds + JSON)
│ ├── DeploySentinel.s.sol # Production-style deploy
│ ├── DeployAutomationFull.s.sol # All-in-one automation deploy + pool registration
│ ├── DeploySentinelAutomation.s.sol # Automation contract deploy (standalone)
│
│
├── frontend/ # React Frontend (Vite + wagmi + shadcn/ui)
│ └── src/
│ ├── pages/ # Dashboard, Pools, Positions, Automation, Faucet
│ ├── components/ # Deposit/Withdraw/Mint dialogs, Sidebar
│ ├── hooks/ # use-sentinel.ts, use-tokens.ts
│ └── lib/ # addresses.ts, abi.ts, wagmi.ts
│
├── workflows/ # Chainlink Automation
│ └── sentinel-workflow.yaml # Workflow spec (Chainlink)
│
├── docs/ # Documentation
│ ├── chainlink_automate.md # Chainlink Automation reference
│ ├── whitepaper.md # Protocol whitepaper
│ ├── reactive_strategy.md # Rebalancing strategy details
│ └── tech_stack.md # Technology details
│
├── agents.md # AI Agent context (START HERE)
├── VISUAL_GUIDE.md # Diagrams and flows
└── README.md # This file
- Foundry (
forge,cast,anvil) - Node.js 18+ (for frontend)
- Sepolia RPC URL (Alchemy/Infura)
# Clone the repository
git clone https://github.com/your-org/sentinel-protocol.git
cd sentinel-protocol
# Install dependencies
forge install
# Build contracts
forge build# Unit + fuzz tests
forge test --match-path "test/unit/*.t.sol"
forge test --match-path "test/fuzz/*.t.sol"
# Integration tests (fork)
forge test --match-path "test/integration/*.t.sol" --fork-url $SEPOLIA_RPC_URL -vvv
# Gas report
forge test --gas-report# MAIN: Full demo deploy (mock tokens, mock Aave, pools, seeds) on Sepolia
forge script script/DeployAll.s.sol --account test1 --rpc-url $SEPOLIA_RPC_URL --broadcast -vvv
# Verify on Etherscan
forge verify-contract <ADDRESS> SentinelHook --chain sepoliaFor deterministic demos, set USE_MOCK_FEEDS=true before running DeployAll.
DeployAll also writes deployment.json; run node update_addresses.js to sync the frontend.
Optional env var for hook deployment:
CHAINLINK_MAINTAINER(sets the initialmaintainer; defaults to deployer)
# Deploy SentinelAutomation + register pools + set maintainer (all-in-one)
forge script script/DeployAutomationFull.s.sol --account test1 --rpc-url $SEPOLIA_RPC_URL --broadcast -vvvRequired env vars for automation (in .env):
SEPOLIA_RPC_URL— Alchemy/Infura Sepolia endpointDEPLOYMENT_JSON(optional — defaults todeployment.jsonfromDeployAll)
Post-deploy Chainlink UI steps:
- Register Automation Upkeep at automation.chain.link → Custom Logic → paste SentinelAutomation address → fund with LINK
All contracts are deployed and verified on Sepolia. View on Etherscan.
| Contract | Address | Status |
|---|---|---|
| Uniswap PoolManager | 0x8C4BcBE6b9eF47855f97E675296FA3F6fafa5F1A |
Canonical |
| SentinelHook | 0xA7F23aFF760f6e34E823Bbf529fE3Fa54C93A080 |
✅ Verified |
| SwapHelper | 0x0ce1552c2146D730e220aB7e9137249e0E651177 |
✅ Verified |
| SentinelAutomation | 0x24A79d2c74dEe4caff80aBEc21cA1C8bbD15135c |
Automation (Sepolia) |
| MockAave (manager) | 0xF8d4681bbFd7946B2f65FE2B7c4Fe043495D40b2 |
Deployed |
| Token | Address |
|---|---|
| mETH (Mock WETH) | 0x0e36C47a2cCf406ee12fac225D3Dd3Da465B859c |
| mUSDC | 0x69810Addf24E88fbfc39Cd207f9EE794E3f7Ba33 |
| mWBTC | 0x4cF23E8f91b86ee28A483d4ed28A6d8e2f3f7FaC |
| mUSDT | 0x001Aa5ae632aF10e4bf068D17be11ee984a3B400 |
| aToken | Address | Underlying |
|---|---|---|
| maETH | 0xE7F85Ee92dd51bbAB76700DF0198C366c2F9D07B |
mETH |
| maUSDC | 0x2b9a68fa35bb2F6f88E90FB68265315B9dc8fb03 |
mUSDC |
| maWBTC | 0x049Ad2fc1b7d105C6c7502Cd1E1EF8af74c59139 |
mWBTC |
| maUSDT | 0x4197Aa46167911C3Ed87d023C0B704e597be8989 |
mUSDT |
| Pool | Pool ID | Oracle |
|---|---|---|
| mUSDC/mETH | 0xd81e2f7075ef839ab7897b6609296cb71b4b951bab1215cff428e8e58d6d9c86 |
ETH/USD |
| mWBTC/mETH | 0xedaee9b731b3f6b66651873d25251d4164f053f6338e20cad90121735c7c25a1 |
BTC/ETH (Ratio) |
| mUSDT/mETH | 0x6c92e8eeb40fe91f771ca88bd635f4df6124ddf26602b17b58dc78c35d821890 |
ETH/USD |
| Component | Details |
|---|---|
| Automation Upkeep | Register via automation.chain.link |
| Functions Subscription | Not used |
| DON ID | Not used |
| Functions Router | Not used |
| Feed | Address |
|---|---|
| ETH/USD | 0x694AA1769357215DE4FAC081bf1f309aDC325306 |
| BTC/USD | 0x1b44F3514812d835EB1BDB0acB33d3fA3351Ee43 |
| USDC/USD | 0xA2F78ab2355fe2f984D808B5CeE7FD0A93D5270E |
| BTC/ETH (Ratio) | 0xc596b108197aEF64c6d349DcA8515dFFe4615502 |
Sentinel can manage ANY Uniswap v4 pool that:
- ✅ Has the SentinelHook attached at initialization
- ✅ Has at least one token supported by Aave v3
- ✅ Has a corresponding Chainlink price feed
| Pool | aToken0 Yield | aToken1 Yield | Oracle | Risk Profile |
|---|---|---|---|---|
| ETH/USDC | aWETH | aUSDC | ETH/USD | Blue chip |
| WBTC/ETH | aWBTC | aWETH | BTC/ETH | High volatility |
| ARB/USDC | — (disabled) | aUSDC | ARB/USD | L2 native |
| stETH/ETH | aStETH | aWETH | stETH/ETH | LST arbitrage |
┌─────────────────────────────────────────────────────────────┐
│ Level 1: Smart Contract (Immutable) │
│ ├── Oracle deviation checks (circuit breaker) │
│ ├── LP share accounting (proportional claims only) │
│ └── Range validation (min/max bounds) │
├─────────────────────────────────────────────────────────────┤
│ Level 2: Chainlink Automation (Execution) │
│ ├── Whitelisted executor (automation contract) │
│ ├── Event/cron driven execution │
│ └── No custody of LP funds │
├─────────────────────────────────────────────────────────────┤
│ Level 3: Strategy Parameters (Configurable) │
│ ├── Volatility thresholds │
│ ├── Range width bounds │
│ └── Yield protocol selection │
└─────────────────────────────────────────────────────────────┘
- ❌ Withdraw LP funds (only LPs can withdraw their shares)
- ❌ Bypass oracle checks (enforced in immutable Hook code)
- ❌ Set invalid ranges (Hook validates all parameters)
- ❌ Bypass the
maintainergate (only the configured executor can callmaintain())
This project addresses the track criteria by:
| Criterion | Implementation |
|---|---|
| Reliability | Hook acts as hard "circuit breaker" - agents can't drain funds |
| Composability | Deep Uniswap v4 + Aave v3 + Chainlink integration |
| Decentralization | Automation execution via Chainlink; safety enforced on-chain |
| Innovation | First multi-pool LP management service on v4 |
The Sentinel frontend is a React single-page app for interacting with deployed pools on Sepolia.
Stack: React 19 + Vite + TypeScript + wagmi v3 + viem v2 + shadcn/ui + Tailwind CSS v4
cd frontend
npm install
npm run dev # http://localhost:5173- Dashboard — TVL, share prices, yield distribution charts
- Pools — Pool detail cards with deposit/withdraw dialogs
- Positions — Per-wallet LP share view
- Automation — Maintainer status and rebalance history
- Faucet — One-click mock token claims for testing
| Document | Purpose |
|---|---|
| agents.md | 🤖 AI Agent context - START HERE |
| VISUAL_GUIDE.md | 📊 Diagrams and flow charts |
| docs/deployment_guide.md | 🚀 End-to-end deployment guide |
| docs/chainlink_automate.md | ⚙️ Chainlink Automation reference |
| docs/tech_stack.md | 📚 Technology deep dive |
- Read agents.md for architectural context
- Follow the Golden Rules for code changes
- All PRs must include fork tests
- Run
forge fmtbefore committing
MIT License - see LICENSE for details.
- Uniswap v4 Docs: docs.uniswap.org/contracts/v4
- Aave v3 Docs: aave.com/docs/aave-v3
- Chainlink Automation: automation.chain.link
- Foundry Book: book.getfoundry.sh
Sentinel Liquidity Protocol - Autonomous Liquidity Management at Scale 🛡️