Your money. Your rules. AI works for you
markdown
YieldMind is an AI-powered yield automation platform that lets users deposit USDC into a vault, define their yield strategy in plain English (or via presets and sliders), and let an autonomous AI agent rebalance their position on Arbitrum every 5 minutes.
### The Problem
DeFi yield farming is fragmented, time-consuming, and favors bots. Retail users must constantly monitor APYs, manually rebalance across protocols, and optimize gas costs. Existing auto-compounders are rigid single-strategy pools with no user customization.
### Our Solution
YieldMind gives every user their own AI agent. You describe your strategy — "aggressive growth, 80% in yield assets, 3-month horizon" — and the agent parses it via DGrid AI Gateway, writes it on-chain through the StrategyRegistry, and autonomously rebalances your vault position. Everything is on-chain and verifiable. No hidden databases, no opaque off-chain logic.
### Features
- **AI Strategy Advisor**: Natural language to on-chain execution with reasoning. Not a keyword matcher — the agent considers portfolio value and time horizon.
- **Leaderboard + Copy Trading**: Auto-discovers all depositors from on-chain vault `Deposit` events (no hardcoded lists). Any user can copy any strategy in one click — real PMF for DeFi adoption.
- **Stylus (Rust → WASM)**: Gas-efficient strategy computation running as an Arbitrum Stylus contract. ~10x cheaper than equivalent Solidity math. Shows deep Arbitrum tech stack expertise.
- **Strategy Templates**: One-click presets (Stable Yield, Balanced, Growth, DeFi Degen) eliminate onboarding friction.
- **Dual-Chain**: Deployed on Arbitrum Sepolia and Robinhood Testnet. Same contracts, same frontend, different chains.
### Architecture
Three smart contracts on Arbitrum: a Vault (ERC4626-like), a StrategyRegistry (per-user config), and an Agent Executor (Stylus/Rust). A Cloudflare Worker cron agent reads on-chain state every 5 minutes and submits rebalance transactions. The Next.js 15 frontend reads directly from contracts via wagmi — no backend database.<pre><code class="language-markdown"><span class="hljs-section">### Smart Contracts + Deploy</span> Started from an empty repo. Wrote the Vault contract (ERC4626-inspired): accepts USDC deposits, mints shares 1:1, only the agent address can call <span class="hljs-code">`rebalance()`</span>. Wrote the StrategyRegistry with <span class="hljs-code">`getStrategy`</span>/<span class="hljs-code">`setStrategy`</span> functions storing on-chain config structs. Created IStrategyRegistry and IERC4626 interfaces. Wrote 7 Foundry tests covering deposit, withdraw, rebalance, access control, zero-amount reverts, and share price math. All passing with gas reports. Deployed both contracts to Arbitrum Sepolia and verified on Arbiscan. <span class="hljs-section">### Frontend</span> Built the entire Next.js 15 frontend from scratch: cyberpunk terminal-themed UI with Tailwind. Implemented wallet connect via RainbowKit + wagmi with multi-chain support (Arbitrum Sepolia, Arbitrum One, Robinhood Testnet). Built 8 core components: Dashboard (stats grid, onboarding flow, agent log), VaultManager (deposit/withdraw with inline USDC approval), StrategyForm (sliders, risk selector, presets), PositionCard (with estimated APY), PortfolioChart (24h reactive), Navbar (network guard with red warning for wrong chain), TransactionToast (real-time confirmation), and AppprovalGuard. Wrote useVaultData hook integrating wagmi reads and writes with chain-aware contract addresses. <span class="hljs-section">### Agent, AI, Stylus, Robinhood</span> Wrote the Cloudflare Worker cron agent: reads vault state every 5 minutes via viem, iterates watched users, computes optimal allocations, submits <span class="hljs-code">`rebalance()`</span> transactions. Added REST API: <span class="hljs-code">`/api/status`</span> (health), <span class="hljs-code">`/api/trigger`</span> (manual), <span class="hljs-code">`/api/parse-strategy`</span> (AI parsing via DGrid Gateway). Deployed to Cloudflare Worker. Fixed and upgraded the Stylus Rust contract from SDK 0.6 to 0.10.7 — patched 5 compilation errors (API changes in <span class="hljs-code">`msg::sender`</span>, <span class="hljs-code">`block::timestamp`</span>, <span class="hljs-code">`StorageMap::set→insert`</span>, <span class="hljs-code">`U256::as_u64→to::<u64>()`</span>, <span class="hljs-code">`vec!→alloc::vec!`</span>). Deployed Stylus contract to Arbitrum Sepolia. Wrote DeployRHC.s.sol + MockUSDC.sol and deployed the full stack to Robinhood Testnet (Chain 46630). Added RHC faucet component for one-click mock USDC minting. <span class="hljs-section">### Final Polish</span> Added PMF features in the last sprint: Leaderboard (auto-discovers depositors from on-chain <span class="hljs-code">`Deposit`</span> events, no hardcoded user lists), Copy Trading (one-click copy any leaderboard entry's strategy), Strategy Templates (4 one-click presets), AI Advisor upgrade (returns reasoning, accepts portfolio value for context-aware recommendations), Estimated APY display based on allocation, guided onboarding banner for first-time users. Fixed CORS on agent, chain-id validation on write functions, and pnpm build issues for Vercel deploy. Created comprehensive docs (README, AGENTS.md).</code></pre>
<p>Not yet.</p>