You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Uniswap v4 hook on Base that turns a standard liquidity pool into a managed vault. Human LPs deposit tokens and choose an AI curator agent. The curator uses Venice AI's private inference — verified inside an EigenCompute TEE — to analyze market data, adjust concentrated liquidity ranges, and set dynamic swap fees. Every execution log is stored on Filecoin with PDP proofs and indexed on-chain via a LogRegistry contract. The human retains full withdrawal rights at all times. The curator's permissions are scoped via MetaMask Delegation Framework — it can rebalance but never withdraw LP funds.
Concentrated liquidity on Uniswap v3/v4 offers dramatically higher capital efficiency — but it demands constant, active management. Most LPs face three painful realities:
Gap
Why It Matters
Active management required
Concentrated LP positions go out of range as prices move. LPs who don't rebalance earn zero fees. Most retail LPs can't watch markets 24/7.
No trustless delegation
LPs who want to delegate to a manager must hand over full custody. There's no way to say "you can rebalance but never withdraw my funds."
Manager accountability is zero
Fund managers have no verifiable on-chain track record. LPs choose blindly. Poor performance has no consequences, good performance has no proof.
The result: most concentrated liquidity is either passively mismanaged (earning nothing) or locked in opaque vaults with full-custody risk.
No existing protocol solves all three simultaneously.
How CuratedLP Works
CuratedLP is a complete vault primitive where the AI agent operates autonomously but can never touch LP funds:
LPs deposit wstETH + USDC into the vault. An AI curator — orchestrated by OpenClaw on a 5-minute heartbeat and deployed on DigitalOcean — analyzes markets privately via Venice AI inside an EigenCompute TEE. It rebalances the position and adjusts fees via MetaMask delegation. Every decision is logged to Filecoin with verifiable proofs. Performance is recorded on-chain via ERC-8004 ReputationRegistry.
The Lifecycle
Phase
What Happens
Trust Model
A. Curator Registration
Agent registers with ERC-8004 identity NFT. Identity is load-bearing — no NFT, no registration.
On-chain identity verification
B. LP Deposit
LP deposits wstETH + USDC, receives VaultShare tokens (ERC-20). Hook adds liquidity to the Uniswap v4 pool at the current tick range.
LP retains shares = withdrawal rights
C. Delegation Setup
LP creates a MetaMask smart account, delegates rebalance authority to the curator with custom caveats: correct target, allowed functions, fee bounds, rate limiting.
Curator can rebalance, never withdraw
D. AI Analysis
Every 5 minutes: agent reads pool state, fetches market data from Uniswap Trading API, sends everything to Venice AI for private inference inside an EigenCompute TEE. Returns attestation hash for verifiability.
Venice AI in TEE — private, verifiable analysis
E. Rebalance
If recommendation differs from current position: agent constructs rebalance calldata, redeems MetaMask delegation. Atomic: remove all liquidity, re-add at new range with new fee.
Caveat enforcer validates every parameter
F. Fee Override
beforeSwap hook returns curator's recommended fee via OVERRIDE_FEE_FLAG. Dynamic fees adjust in real-time based on market conditions.
~200 gas overhead per swap
G. Performance Tracking
After each cycle, agent stores the full execution log on Filecoin (IPFS + PDP proofs) and records the CID in LogRegistry on Filecoin mainnet. Performance feedback written to ERC-8004 ReputationRegistry on Base Sepolia.
Verifiable on-chain log trail
H. Withdrawal
LP burns VaultShare tokens anytime. Hook removes proportional liquidity and returns tokens. No lockups, no permission needed.
Unconditional withdrawal rights
Key Features
Scoped Delegation — Custom CuratedVaultCaveatEnforcer ensures the curator can only call rebalance() and claimPerformanceFee() on the hook contract, with fee bounds and rate limiting enforced on-chain.
Private AI Inference — Venice AI runs analysis inside an EigenCompute TEE. Market reasoning never touches the chain — only the resulting rebalance action is visible. Each inference produces a verifiable attestation hash.
Dynamic Fees — Pool was initialized with DYNAMIC_FEE_FLAG. The curator adjusts swap fees based on volatility, volume, and market conditions — optimizing LP revenue in real-time.
Verifiable Reputation — ERC-8004 IdentityRegistry gates registration. ReputationRegistry records performance after every rebalance. LPs can inspect a curator's full history before choosing.
Filecoin Log Storage — Every execution log (pool state, market data, AI recommendation, action taken) is stored on Filecoin via filecoin-pin with PDP proofs. CIDs are indexed on-chain in a LogRegistry contract on Filecoin mainnet.
System Flow
CURATEDLP
PHASE A: CURATOR REGISTRATION
────────────────────────────────────────────────────────────────
Agent
| registerCurator(performanceFeeBps, erc8004IdentityId)
v
CuratedVaultHook
| verify IDENTITY_REGISTRY.ownerOf(identityId) == msg.sender
| verify performanceFeeBps <= 2000 (max 20%)
| store Curator { wallet, identityId, fee, active: true }
|
--> emit CuratorRegistered(curatorId, wallet, identityId)
PHASE B: LP DEPOSIT
────────────────────────────────────────────────────────────────
LP
| deposit(amount0Desired, amount1Desired, amount0Min, amount1Min, minShares, deadline)
v
CuratedVaultHook
| verify deadline not expired, pool initialized
| transferFrom(LP -> hook) for USDC + wstETH
| calculate shares:
| if totalShares == 0: shares = sqrt(amount0 * amount1)
| else: shares = min(a0/total0, a1/total1) * totalShares
|
| ┌─── Unlock Pattern ───────────────────────────────┐
| │ hook -> poolManager.unlock(data) │
| │ poolManager -> hook._unlockCallback(data) │
| │ hook -> poolManager.modifyLiquidity(+delta) │
| │ hook settles actual deltas (NOT pre-calculated) │
| └───────────────────────────────────────────��──────┘
|
--> VaultShares.mint(LP, shares)
PHASE C: METAMASK DELEGATION
────────────────────────────────────────────────────────────────
LP (Delegator) Curator (Delegate)
| |
| toMetaMaskSmartAccount() | toMetaMaskSmartAccount()
| (Implementation.Hybrid) |
| |
| createDelegation(delegate, caveats)
| |
| v
| CuratedVaultCaveatEnforcer checks:
| ✓ target == CuratedVaultHook address
| ✓ selector == rebalance() or claimPerformanceFee()
| ✓ fee parameter within bounds (100-50000 bps)
| ✓ block.number > lastRebalance + MIN_BLOCKS
|
--> Delegation signed and stored
PHASE D: AI ANALYSIS LOOP (every 5 minutes — OpenClaw on DigitalOcean)
────────────────────────────────────────────────────────────────
OpenClaw (Agent Orchestrator)
|
|-(1)-> Read pool state from Base RPC
| (current tick, liquidity, recent swap volume)
|
|-(2)-> Uniswap Trading API: POST /v1/quote
| (wstETH/USDC price quotes — real API key required)
|
|-(3)-> EigenCompute TEE: POST /analyze
| Runs inside Intel TDX enclave (http://34.87.99.35:3000)
| Internally calls Venice AI twice:
| a) Sentiment analysis (web search ON)
| b) Rebalance recommendation (web search OFF)
| Model: glm-4.7 (primary) / llama-3.3-70b (fallback)
| ┌─────────────────────────────────────────────┐
| │ System: You manage concentrated liquidity │
| │ for wstETH/USDC on Uniswap v4. │
| │ Recommend: tick range, fee (bps), │
| │ confidence score, reasoning. │
| │ Respond ONLY in JSON. │
| │ │
| │ User: {pool state + prices + sentiment} │
| └─────────────────────────────────────────────┘
| Returns: recommendation + attestation hash
|
|-(4)-> If recommendation differs significantly:
| construct rebalance calldata
| redeem MetaMask delegation → execute on-chain
|
|-(5)-> Store execution log on Filecoin via filecoin-pin
| Record CID in LogRegistry on Filecoin mainnet
|
--> Log all actions with timestamps + TxIDs + attestation
PHASE E: REBALANCE EXECUTION
────────────────────────────────────────────────────────────────
Agent
| redeemDelegations(rebalanceCalldata)
v
DelegationManager
| validate delegation signature
| call CuratedVaultCaveatEnforcer.beforeHook()
| ✓ correct target, function, fee bounds, rate limit
v
CuratedVaultHook.rebalance(newTickLower, newTickUpper, newFee, maxIdleToken0, maxIdleToken1)
|
| ┌─── Atomic Rebalance ─────────────────────────────┐
| │ 1. Remove ALL liquidity (unlock + negative delta)│
| │ 2. Update stored tick range + fee │
| │ 3. Re-add ALL liquidity (unlock + positive delta)│
| │ 4. Update lastRebalanceBlock │
| │ If any step fails → entire tx reverts │
| └──────────────────────────────────────────────────┘
|
--> emit Rebalanced(curatorId, newTickLower, newTickUpper, newFee)
PHASE F: DYNAMIC FEES (every swap)
────────────────────────────────────────────────────────────────
Swapper
| swap(poolKey, params)
v
CuratedVaultHook._beforeSwap()
| read curator's recommendedFee from storage (warm SLOAD, ~100 gas)
| return (selector, ZERO_DELTA, fee | OVERRIDE_FEE_FLAG)
|
CuratedVaultHook._afterSwap()
| cumulativeVolume += |swapDelta|
| cumulativeFeeRevenue += volume * feeRate
|
--> Fee applied transparently, ~200 gas overhead
PHASE G: REPUTATION FEEDBACK
────────────────────────────────────────────────────────────────
Agent (after each rebalance cycle)
|
| compute performance delta (vault value before vs after)
| encode payload: { rebalanceCount, avgFeeRevenue,
| tickAccuracy, timestamp }
|
| REPUTATION_REGISTRY.submitFeedback(curatorIdentityId, payload)
| (Base Sepolia: 0x8004B663056A597Dffe9eCcC1965A193B7388713)
|
--> Permanent, verifiable on-chain reputation trail
PHASE H: LP WITHDRAWAL
────────────────────────────────────────────────────────────────
LP
| withdraw(sharesToBurn)
v
CuratedVaultHook
| proportion = sharesToBurn / totalShares
|
| ┌─── Unlock Pattern ───────────────────────────────┐
| │ Remove proportional liquidity (negative delta) │
| │ Transfer tokens back to LP │
| └──────────────────────────────────────────────────┘
|
| VaultShares.burn(LP, sharesToBurn)
|
--> LP receives wstETH + USDC proportional to shares
TRUST BOUNDARY SUMMARY
────────────────────────────────────────────────────────────────
CURATOR CAN DO CURATOR CANNOT DO
────────────────────── ──────────────────────────
Rebalance tick range Withdraw LP funds
Adjust dynamic fee (within bounds) Transfer VaultShare tokens
Claim performance fee Bypass caveat enforcer
Read pool state Exceed rate limits
Call Venice AI via TEE Change curator parameters
Store logs on Filecoin Access other curators' vaults
System Participants
Actor
Role
Liquidity Provider (LP)
Deposits wstETH + USDC into vault, receives VaultShare tokens, chooses a curator, retains unconditional withdrawal rights
AI Curator Agent
Registered with ERC-8004 identity. Orchestrated by OpenClaw on a 5-minute heartbeat (deployed on DigitalOcean). Analyzes markets via Venice AI (inside EigenCompute TEE), rebalances positions via MetaMask delegation, logs decisions to Filecoin
OpenClaw
Agent orchestration framework. Runs the curator as a collection of CLI tools on a 5-minute heartbeat cycle: observe (pool state) → analyze (market data + TEE inference) → decide → act → store (Filecoin). Deployed on DigitalOcean
CuratedVaultHook
Uniswap v4 hook — vault core. Manages deposits, withdrawals, liquidity, dynamic fees. Only the hook can add/remove liquidity from the pool
VaultShares
ERC-20 receipt token. Minted on deposit, burned on withdrawal. Represents proportional claim on vault assets
CuratedVaultCaveatEnforcer
MetaMask delegation caveat — validates every curator action against target, function, fee bounds, and rate limits
Venice AI
Private inference engine — analyzes market data and recommends optimal tick ranges and fees
EigenCompute TEE
Intel TDX Trusted Execution Environment that wraps Venice AI inference for verifiable computation
Filecoin + LogRegistry
Execution logs stored on Filecoin (IPFS + PDP proofs). CIDs indexed on-chain via LogRegistry contract on Filecoin mainnet
ERC-8004 Registries
IdentityRegistry gates curator registration. ReputationRegistry records performance history
Smart Contracts
Contract
Purpose
CuratedVaultHook.sol
Core Uniswap v4 hook — vault deposit/withdraw, liquidity management via unlock pattern, curator rebalance, dynamic fee override in beforeSwap, fee tracking in afterSwap
VaultShares.sol
ERC-20 share token. Mint/burn controlled exclusively by the hook. Represents proportional vault ownership
CuratedVaultCaveatEnforcer.sol
MetaMask Delegation caveat enforcer — validates target address, function selector, fee bounds, and rate limiting for every delegated action
Architecture Decisions
Decision
Rationale
Hook manages all liquidity
beforeAddLiquidity and beforeRemoveLiquidity revert unless sender == hook. Forces all flows through vault functions
Separate VaultShares contract
Hook address is fixed by permission bits — share token needs its own deployment
DYNAMIC_FEE_FLAG on pool
Enables curator-controlled fees without redeploying. ~200 gas overhead per swap
Atomic rebalance
Remove-all then re-add-all in one tx. If any step fails, entire tx reverts — no partial state
ERC-8004 as primary identity gate
Curators MUST hold an identity NFT. Not decorative — registerCurator() reverts without it
Reputation writes after each cycle
Creates a permanent on-chain track record. LPs can query before choosing a curator
Venice AI for private inference
Market analysis stays private. Only the resulting on-chain action (rebalance tx) is visible
MetaMask delegation over EOA signing
Scoped permissions with on-chain enforcement. Curator literally cannot call withdraw()
Integrations
Integration
Role in CuratedLP
How It's Used
Bounty
Uniswap v4
Core pool infrastructure
v4 hook for vault logic, beforeSwap for dynamic fees, Trading API for price quotes with real API key and TxIDs
Agentic Finance
Venice AI
Private market analysis
Agent sends pool state + market data to Venice AI. Recommendation (tick range, fee, confidence) drives on-chain rebalance. Private inference — reasoning never on-chain
Private Agents, Trusted Actions
MetaMask Delegation
Scoped curator permissions
Custom CuratedVaultCaveatEnforcer — LP delegates rebalance authority with fee bounds and rate limiting. Agent redeems delegation via Pimlico bundler
Best Use of Delegations
EigenCompute TEE
Verifiable AI inference
Venice AI sentiment analysis and rebalance recommendation run inside an Intel TDX enclave via EigenCompute. Each inference returns an attestation hash proving computation integrity. Endpoint: http://34.87.99.35:3000
Verifiable Compute
Filecoin
Permanent execution log storage
Every heartbeat cycle produces a full execution log (pool state, market data, AI recommendation, action taken). Stored on Filecoin via filecoin-pin with PDP proofs. CID recorded on-chain in LogRegistry (0x3b53eb6FCc0b0a618db98F05BB4007aFcDbde94d) on Filecoin mainnet. Frontend reads LogRegistry to display full agent history
Decentralized Storage
ERC-8004
Identity + reputation
IdentityRegistry gates curator registration (load-bearing). ReputationRegistry records performance after every rebalance cycle
cd agent
npm install
cp .env.example .env
# Fill in VENICE_API_KEY, UNISWAP_API_KEY, PIMLICO_API_KEY, etc.
npm start
6. Launch Frontend
cd frontend
npm install
npm run dev
# http://localhost:3000
End-to-End Flow
1. Curator registers with ERC-8004 identity → identity verified on-chain
2. LP deposits wstETH + USDC → receives VaultShare tokens
3. LP creates MetaMask delegation → curator scoped to rebalance only
4. Agent reads pool state from Base RPC → current tick, liquidity, volume
5. Agent fetches market data via Uniswap API → price quotes, spread, impact
6. Agent calls Venice AI inside TEE → verifiable inference, attestation hash
7. Agent rebalances via delegation → atomic remove + re-add at new range
8. Dynamic fee updates on next swap → beforeSwap returns new fee
9. Execution log stored on Filecoin → CID recorded in LogRegistry on-chain
10. Performance written to ReputationRegistry → verifiable curator track record
11. LP withdraws anytime → burns shares, receives tokens