Autonomous DeFi portfolio manager with ENS identity, 0G memory, and natural language steering.
PortfolioGuard.eth is an autonomous DeFi portfolio management platform designed to solve the "black box" problem of AI agents in Web3. While most AI trading bots execute trades invisibly, PortfolioGuard pairs powerful natural language steering with verifiable on-chain identity and immutable decentralized memory trails.
At its core, the platform allows users to connect their wallet and deploy an autonomous agent to monitor their holdings (ETH, WETH, USDC) against specific risk parameters. Users can establish hard guardrails (e.g., "Trim ETH if it exceeds 55% of the portfolio") or steer the agent through a natural language chat console (e.g., "Shift my portfolio to a more conservative posture").
To make this execution entirely transparent and trust-minimized, PortfolioGuard integrates two critical technologies:
ENS Agent Identity: The agent is minted its own ENS subname identity. Instead of operating as a nameless script, the agent dynamically updates its own ENS text records on-chain (such as its core skills, success rate, and last executed action). This allows users and block explorers to instantly verify the agent's operational mandate and history. 0G Network Memory: Before executing any trade, the system runs a mini-swarm (an Analysis Agent and a Decision Agent). These agents ingest live Uniswap V3 quotes and portfolio balances from the Sepolia network. Every piece of analysis, reasoning, and final execution receipt is packed and permanently stored on the 0G Network as an immutable audit trail. This means human operators can always look back and cryptographically verify why the agent decided to make a specific swap. By combining ENS for verifiable identity, 0G for decentralized memory and auditing, and live Sepolia/Uniswap integrations for execution, PortfolioGuard.eth presents a production-ready blueprint for how humans and autonomous agents can safely co-manage capital in decentralized finance.
PortfolioGuard is built on a modern, high-performance web stack utilizing Next.js (App Router), React 19, and Tailwind CSS. We utilized a robust suite of Shadcn UI components to build a sleek, "fintech-grade" dashboard that visualizes complex portfolio allocations in real-time.
For the Web3 orchestration layer, we entirely bypassed clunky ethers.js setups in favor of viem and wagmi to establish highly typed, lightning-fast connections to the Ethereum Sepolia Testnet.
Partner Technologies & Architecture
Uniswap V3 (Execution & Oracle) Rather than relying on centralized APIs (like CoinGecko) to evaluate the user's portfolio, we built a custom script that directly pings the deployed Uniswap V3 Quoter Contract on Sepolia. By actively simulating swaps via quoteExactInputSingle under the hood, the application derives perfectly accurate, live USD valuations and evaluates slippage conditions before the agent even suggests a rebalance.
ENS (Identity & Public State) We integrated the Ethereum Name Service (ENS) to solve the problem of "nameless bot" execution. However, we did something particularly notable here: we treat ENS as a lightweight, decentralized database. When the agent performs an action, it doesn't just execute the trade—it dynamically updates its own ENS Text Records (specifically setting records for skills, success-rate, and last-action). This means anyone looking at the agent's ENS profile on an explorer instantly sees a living resume of its current posture and performance.
0G Network (Immutable Memory) Because AI agents are inherently non-deterministic "black boxes," we integrated the 0G Network to act as a decentralized Data Availability layer. We built a custom orchestration layer (src/lib/agent/orchestrator.ts) that runs a mini-swarm: an Analysis Agent processes the Uniswap quotes, and a Decision Agent proposes the execution. The entire natural language reasoning trail—along with the final execution receipt—is packed and appended to 0G Storage. This provides cryptographic proof of the agent's decision-making process.
Notable & "Hacky" Implementations One of the most complex challenges was converting natural language chat inputs (e.g., "Make my portfolio more conservative") into strict execution logic. To solve this without risking catastrophic on-chain failures, we built a "Gated Execution" state machine. The LLM layer is strictly confined to generating deterministic JSON configurations. These JSON objects are passed into an isolation layer that dry-runs the logic against live Sepolia RPC data. The execution agent forces the UI into a "Staged Action" state, meaning the AI can propose a smart contract payload, but it physically cannot broadcast the transaction until the human operator signs the payload via their connected wallet.

