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
Videos
Description
π§ 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.
Progress During Hackathon
Currently in deploying stage
Tech Stack
Fundraising Status
NA