ERC-8004 AI agents trade on Uniswap v4 & Sui DeepBook autonomously. All decisions transparent viaENS
MoltQore is the first ERC-8004 compliant autonomous portfolio manager that executes DeFi strategies 24/7 across multiple chains without custody. Users mint an AI agent as an NFT, select a risk strategy (aggressive/balanced/safe), and let the agent optimize their capital across Uniswap v4 and Sui DeepBook.
The core innovation is radical transparency: every AI decision, reasoning, and trade result is logged on-chain via ENS text records. Anyone can verify why the agent moved $5,000 to DeepBook or rebalanced a Uniswap LP position—no black boxes.
Agents use session keys for limited-scope execution, maintaining non-custodial security. The AI brain (GPT-4o) analyzes real-time opportunities across both chains, decides optimal moves based on the user's strategy, and executes via Sui PTBs (for DeepBook market making) or Uniswap v4 hooks (for autonomous LP rebalancing).
Cross-chain coordination works seamlessly: when Sui DeepBook spreads widen, the agent bridges funds and places limit orders. When Uniswap v4 pool volatility increases, the custom hook auto-rebalances LP ranges. All performance metrics sync back to the ERC-8004 NFT and ENS.
This transforms AI agents from experimental toys into verifiable, tradeable DeFi primitives. Your agent earns reputation, can be sold on OpenSea, and operates with institutional-grade transparency.
The architecture spans three layers: identity (Ethereum), execution (Sui + Uniswap v4), and intelligence (AI backend).
Smart Contracts (Solidity 0.8.24): We implemented DeepMindVault.sol as an ERC-8004 NFT contract where each agent is a transferable, stakeable asset. The contract manages session key delegation (60-day expiry) so agents can execute without holding user private keys. ENSTextRecordManager.sol updates text records on every trade, creating an immutable audit log. For Uniswap v4, we built AgentRebalancerHook.sol extending BaseHook—it triggers afterSwap() to check if LP positions drifted >100 ticks or >1 hour since last rebalance, then atomically adjusts ranges based on the agent's strategy pulled from ENS.
Sui Move Contracts: The agent_vault module on Sui handles DeepBook V3 integration with 7-operation PTBs. The execute_market_making() function verifies session signatures, calculates bid/ask sizes from the strategy (aggressive = 80% capital, balanced = 50%, safe = 30%), places limit orders via clob_v2, and emits events that sync back to Ethereum. We chose DeepBook over AMMs because market making spreads (0.3-0.8%) significantly outperform LP fees for autonomous strategies.
AI Backend (Python FastAPI): The decision engine runs GPT-4o with structured function calling. Every minute, it scans Uniswap v4 subgraph for pool metrics and Sui RPC for DeepBook spreads, feeds opportunities to the LLM with the agent's current positions and strategy, receives a decision (MOVE_TO_SUI, REBALANCE_UNISWAP, HOLD), and executes via web3.py or Sui SDK. The reasoning text goes directly to ENS—this was the trickiest part: batching ENS updates to minimize gas while keeping sub-5-minute latency.
Frontend (Next.js 14 + Aceternity UI): We used wagmi v2 for Ethereum wallet connection and @mysten/dapp-kit for Sui, creating a unified ConnectButton that handles both. The dashboard pulls live data from ENS text records via custom useAgentDecision() hooks, showing the AI's reasoning in real-time. Aceternity's BackgroundRippleEffect and NoiseBackground components gave us the premium, trustworthy aesthetic needed for a serious DeFi product. The onboarding flow mints the NFT, delegates a session key, and creates the Sui vault in 4 steps—all client-side with transaction confirmations.
Hacky Bits: Cross-chain state sync was brutal. We couldn't use Wormhole for every decision update (too expensive), so we built a hybrid: critical state (reputation, pause status) uses Wormhole message passing, while decision logs use centralized backend polling Sui events then calling ENS contracts. Not ideal for decentralization, but gets 90% of transparency at 10% of the cost. Also, reading ENS text records from Solidity contracts (for the Uniswap hook to check strategy) isn't natively supported, so we pass strategy hashes and decode off-chain—suboptimal but works for MVP.
The Uniswap v4 hook was particularly gnarly: calculating optimal tick ranges in Solidity with fixed-point math while staying under gas limits required aggressive optimization. We ended up pre-computing ranges off-chain and just validating bounds on-chain.
Partner tech choices: Sui for speed (DeepBook orders execute in <500ms vs. Ethereum's 12s), Uniswap v4 for composability (hooks let agents participate in DeFi 2.0), ENS for trust (immutable audit logs).

