VaultFlow
VaultFlow is an AI-powered, gasless, cross-chain DeFi optimizer deployed on the Monad testnet, built using MetaMask Smart Accounts for secure delegated automation, Envio HyperSync for real-time yield
ビデオ
説明
💧 VaultFlow — AI-Powered Smart Account Yield Optimizer
⚡ Automating DeFi Yield on Monad Using MetaMask Smart Accounts & Envio Infrastructure
VaultFlow is an AI-powered, gasless, cross-chain DeFi optimizer deployed on the Monad testnet, built using MetaMask Smart Accounts for secure delegated automation and Envio HyperSync for real-time yield indexing and notifications.
It autonomously reallocates your stablecoins (like USDC) across DeFi protocols on Monad and other chains to maximize yield — with zero manual intervention and full transparency.
🏆 Hackathon Qualification Summary
| Track | Eligibility | 
|---|---|
| 🦊 MetaMask Smart Accounts | Uses Delegation Toolkit for gasless AI-driven execution | 
| 🔗 Monad Testnet | Fully deployed & functional on Monad | 
| ⚡ Envio Infrastructure | Uses HyperIndex for real-time yield tracking and event notifications | 
💡 Problem Statement
DeFi yield optimization today is:
- Manual, time-consuming, and costly in gas 
- Fragmented across chains and protocols 
- Inaccessible to casual users 
VaultFlow Solves This By:
- Using MetaMask Smart Accounts to automate on-chain reallocation 
- AI yield intelligence to find the best protocol daily 
- Envio indexer to fetch and update real-time yield and vault data 
- Monad testnet deployment for ultra-fast execution 
🧠 Core Idea
VaultFlow acts as your AI DeFi assistant — a self-custodial agent that monitors, reallocates, and compounds your funds across chains and vaults automatically.
You delegate limited transaction rights to VaultFlow’s agent through MetaMask Smart Accounts, enabling it to act on your behalf while preserving full control of your assets.
⚙️ Tech Stack
| Layer | Tech | 
|---|---|
| Frontend | Next.js + Tailwind + Viem SDK | 
| Smart Account Layer | MetaMask Delegation Toolkit (ERC-7710, ERC-4337) | 
| Chain | Monad Testnet + Connext Bridge | 
| Indexing | Envio HyperIndex + HyperSync | 
| Backend | Node.js + n8n + Supabase | 
| AI Layer | OpenAI GPT API (yield reasoning) | 
| DeFi Protocols | Aave, Compound, Yearn (simulated on Monad) | 
🧩 System Architecture Overview
┌──────────────────────────────────────────────┐
│                User Interface                │
│──────────────────────────────────────────────│
│  - Next.js Frontend Dashboard                │
│  - MetaMask Smart Account Connection          │
│  - Yield Summary & Portfolio UI              │
└───────────────────┬───────────────────────────┘
                    │
                    ▼
┌──────────────────────────────────────────────┐
│             AI & Backend Layer               │
│──────────────────────────────────────────────│
│  - AI Yield Router (analyzes APY & risks)    │
│  - Transaction Scheduler (n8n)               │
│  - Envio HyperIndex Query Engine             │
│  - Supabase for storage                      │
└───────────────────┬───────────────────────────┘
                    │
                    ▼
┌──────────────────────────────────────────────┐
│             Blockchain Layer (Monad)         │
│──────────────────────────────────────────────│
│  - MetaMask Smart Account (Delegation)       │
│  - Paymaster (Gasless Transactions)          │
│  - DeFi Vault Contracts                      │
│  - Envio HyperSync Event Listener            │
└──────────────────────────────────────────────┘
🧠 Workflow (Mermaid Sequence Diagram)
sequenceDiagram
    participant User
    participant VaultFlow UI
    participant AI Engine
    participant Smart Account
    participant Envio
    participant Monad Chain
    User->>VaultFlow UI: Connect MetaMask Smart Account
    VaultFlow UI->>Envio: Query current yields via HyperIndex
    Envio-->>VaultFlow UI: Return live APY data
    VaultFlow UI->>AI Engine: Request optimal allocation
    AI Engine-->>VaultFlow UI: Suggest new vault (best yield)
    VaultFlow UI->>Smart Account: Delegate reallocation authority
    Smart Account->>Monad Chain: Execute gasless vault reallocation
    Monad Chain->>Envio: Emit events (Deposit, Rebalance, YieldEarned)
    Envio-->>User: Update dashboard + send yield notification
🧬 Envio Integration (Core to Qualification)
🔍 HyperIndex
- Used to index all vaults and yield pools in real time from the Monad testnet. 
- Exposes a GraphQL endpoint that the frontend uses to show: - Live APYs 
- Total TVL 
- User vault balances 
 
⚡ HyperSync
- Syncs yield and transaction data every block. 
- Triggers events for “Vault Updated”, “Rebalance Complete”, and “New Best APY Found”. 
- Pushes these updates to users via Telegram/Email notifications. 
Example Schema:
type Vault {
  id: ID!
  protocol: String!
  apy: Float!
  chain: String!
  tvl: Float!
}
🦊 MetaMask Smart Accounts Integration
VaultFlow uses MetaMask’s Delegation Toolkit to:
- Create user smart accounts ( - Implementation.Hybrid)
- Delegate limited permissions to the AI agent 
- Automate yield reallocations via - redeemDelegations()
- Enforce rules with caveat enforcers (e.g., spend cap = $1000, protocol whitelist) 
Example Delegation Flow:
await createDelegation({
  delegate: "0xVaultFlowAgent",
  caveats: [
    { type: "SpendLimit", value: "1000 USDC" },
    { type: "ProtocolWhitelist", value: ["Aave", "Compound"] }
  ],
});
🔗 Monad Testnet Deployment
VaultFlow is deployed and tested on the Monad testnet, chosen for its:
- Low latency block finality 
- EVM compatibility (easy integration with MetaMask AA) 
- Envio support for HyperSync indexing 
Deployment contracts include:
| Contract | Address | Description | 
|---|---|---|
| VaultFactory | 
 | Creates individual user vaults | 
| VaultAgent | 
 | AI execution delegate | 
| Paymaster | 
 | Handles gas abstraction | 
| SmartAccount | 
 | User-owned smart account | 
🧠 Yield Routing Logic
The AI Agent:
- Fetches live yield & risk data from Envio-indexed DeFi protocols. 
- Scores each protocol based on: - Score=APY−(Volatility×RiskFactor)Score = APY - (Volatility \times RiskFactor)Score=APY−(Volatility×RiskFactor) 
- If new score > current yield + threshold (1.5%), triggers reallocation. 
- Executes a delegated transaction through the Smart Account. 
- Confirms event via Envio HyperSync → updates dashboard. 
📊 Architecture Diagram (Mermaid)
graph TD
A[User] --> B[VaultFlow Frontend]
B --> C[AI Backend + n8n]
C --> D[Envio HyperIndex + HyperSync]
D --> E[Monad Testnet]
E --> F[MetaMask Smart Account]
C --> G[Supabase DB]
🧩 Unique Innovation
| Feature | Description | 
|---|---|
| AI Yield Agent | Delegated to act automatically for users using MetaMask Smart Accounts | 
| Gasless Cross-Chain Execution | Removes gas fees through paymasters | 
| Envio-Powered Data Layer | Real-time DeFi indexing and notifications | 
| Monad Deployment | Uses Monad’s high throughput for instant rebalancing | 
| Caveat Enforcers | Prevent overspending or unapproved protocol interactions | 
💬 Example User Flow
1️⃣ User connects MetaMask Smart Account
2️⃣ VaultFlow shows indexed live yields from Envio HyperIndex
3️⃣ User deposits USDC into vault
4️⃣ VaultFlow AI decides best yield route
5️⃣ Smart Account executes gasless delegated transfer
6️⃣ Envio updates dashboard + sends notification
7️⃣ User earns yield continuously
🧠 Security Model
- Non-custodial: Only user’s smart account owns funds. 
- Delegated rights: AI Agent has limited permission (caveats). 
- Envio verifiability: Indexed data publicly queryable. 
- Gas abstraction: Paymaster ensures safe transaction sponsorship. 
🔧 Setup Instructions
# Clone
git clone https://github.com/arpitdev/vaultflow.git
cd vaultflow
# Install dependencies
npm install
# Setup env
cp .env.example .env
# Add:
# OPENAI_API_KEY
# METAMASK_API_KEY
# ENVO_API_KEY
# MONAD_RPC_URL
# SUPABASE_URL / KEY
# Run frontend + backend
npm run dev
🧭 Future Roadmap
- ✅ Add EigenLayer Restaking Support 
- 🔄 Deploy auto DCA & reinvest logic 
- 🧠 Enhance AI with on-chain sentiment data 
- 💬 Add Farcaster mini-app integration (optional) 
- 📱 Mobile-friendly UI 
🏆 Qualification Matrix
| Requirement | Fulfilled By | 
|---|---|
| MetaMask Smart Account | Delegation Toolkit + Caveat Enforcers | 
| Monad Testnet | Deployed Smart Vault Contracts | 
| Envio | Used HyperIndex + HyperSync | 
| AI Integration | OpenAI-powered yield intelligence | 
| Gasless Execution | MetaMask Paymaster System | 
🧩 Diagram Summary
User
│
│ (connects)
▼
VaultFlow UI — queries → Envio (HyperIndex)
│                              │
│                              ▼
│                         Monad Blockchain
│                              │
│     (via MetaMask Smart Account Delegation)
│                              ▼
AI Engine  →  Executes vault reallocation gaslessly
│
▼
Envio HyperSync  →  Updates yields + notifies user
🪙 Summary
VaultFlow = AI x Smart Accounts x Envio x Monad
A fully autonomous, non-custodial, and gasless AI yield router
that acts on your behalf, leveraging MetaMask Delegation,
deployed on Monad testnet, and indexed in real-time using Envio.
ハッカソンの進行状況
Currently in deploying stage
テックスタック
資金調達の状況
NA