An AI-powered DeFi yield farming optimizer that helps users build personalized portfolio strategies across Aerodrome Finance pools on Base network.
- Real-time Pool Data: Fetches live pool data from Quicknode's Aerodrome API
- AI-Powered Optimization: Uses Claude AI for intelligent portfolio recommendations
- Risk Assessment: Comprehensive 5-step quiz to determine user risk profile
- Smart Allocation: Automated portfolio diversification with percentage allocations
- Detailed Reasoning: AI-generated explanations for each pool recommendation
- Multi-criteria: TVL, APR, and volume analysis
- Pool Type Support: Stable pairs, volatile pairs, and concentrated liquidity pools
- Token Verification: Integration with verified token lists for safety
- Real-time Metrics: Live APR, TVL, and trading volume data
- 3-Step Workflow: Pool overview → Risk assessment → Strategy results
- Interactive Quiz: Investment amount, risk tolerance, time horizon, and preferences
- Visual Portfolio: Pie charts and detailed breakdowns of recommendations
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ User Input │ │ AI Processing │ │ Pool Data API │
│ │ │ │ │ │
│ • Risk Quiz │───▶│ Claude AI API │◀───│ Quicknode API │
│ • Preferences │ │ • Analysis │ │ • Live Pools │
│ • Investment $ │ │ • Optimization │ │ • Token Data │
└─────────────────┘ │ • Reasoning │ │ • Verification │
└──────────────────┘ └─────────────────┘
│
▼
┌──────────────────┐
│ Optimized Strategy│
│ │
│ • Pool Selection │
│ • Allocations │
│ • Risk Scores │
│ • Reasoning │
└──────────────────┘
├── app
│ ├── api
│ │ └── optimize # Server-side API route for AI optimization
│ ├── globals.css # Global styles and CSS variables
│ ├── layout.tsx # Root layout with providers and metadata
│ └── page.tsx # Main orchestrator component for the 3-phase flow
├── components
│ ├── pools
│ │ ├── enhanced-pool-card.tsx # Rich pool data display with metrics
│ │ └── pool-overview.tsx # Pool grid with sorting and filtering
│ ├── quiz
│ │ └── risk-assessment-quiz.tsx # Multi-step risk profiling interface
│ ├── strategy
│ │ └── strategy-results.tsx # AI-generated strategy visualization
│ ├── theme-provider.tsx # Theme context for dark/light mode
│ └── ui # Reusable UI components (shadcn/ui)
├── hooks
│ ├── use-mobile.tsx # Responsive design hook
│ └── use-toast.ts # Toast notification system
├── lib
│ ├── ai-optimizer.ts # Claude AI integration and prompt engineering
│ ├── api.ts # Aerodrome API client and data fetching
│ ├── mock-data.ts # Fallback data for demo mode
│ ├── optimizer.ts # Portfolio optimization orchestrator
│ └── utils.ts # Utility functions and formatting
├── types
│ ├── pool.ts # Pool data structures and API responses
│ ├── strategy.ts # Strategy and risk profile interfaces
│ └── token.ts # Token metadata and verification types
-
Anthropic Claude API:
- Sign up at console.anthropic.com
- Get API key
-
Quicknode Account:
- Sign up at quicknode.com
- Subscribe to Aerodrome API add-on
- Get endpoint URL
git clone https://github.com/quiknode-labs/qn-guide-examples.git
cd qn-guide-examples/sample-dapps/ai-powered-defi-yield-optimizerpnpm install
# or
npm installcp .env.example .env
Edit .env:
# Required for AI optimization
ANTHROPIC_API_KEY=your_claude_api_key_here
# Optional for live data (falls back to demo data)
NEXT_PUBLIC_QUICKNODE_ENDPOINT=https://your-quicknode-endpoint.com/your-api-key/pnpm dev
# or
npm run devVisit http://localhost:3000 to see the application.
pnpm build
pnpm start| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY |
Yes | Claude AI API key for optimization |
NEXT_PUBLIC_QUICKNODE_ENDPOINT |
Yes | Quicknode Aerodrome API endpoint |
Generates AI-powered portfolio optimization.
Request:
{
pools: DetailedPool[],
riskProfile: RiskProfile
}Response:
{
success: boolean,
optimization: {
recommendations: PoolRecommendation[],
portfolioSummary: PortfolioMetrics
},
usedAI: boolean
}- Browse real-time Aerodrome pools
- Filter by pool type, tokens, or characteristics
- Sort by TVL, APR, or volume
- Click "Build My Strategy" to start
Complete the 5-step questionnaire:
- Investment Amount: $1,000 - $100,000+
- Risk Tolerance: Conservative, Moderate, or Aggressive
- Time Horizon: Short (1-3mo), Medium (3-6mo), or Long (6mo+)
- Pool Preferences: Stable, Major tokens, Volatile, Concentrated liquidity
- Minimum TVL: $100K - $10M+ for liquidity requirements
View your personalized recommendations:
- Portfolio Overview: Expected APR, risk score, diversification
- Allocation Chart: Visual breakdown of recommended investments
- Pool Details: Specific reasoning for each recommendation
- Implementation Guide: Step-by-step instructions
- Documentation: This README and inline code comments
- API Documentation: