Skip to content

FraxGuardian AI is an autonomous AI agent that scans Frax Finance for arbitrage opportunities, executes profitable trades, and generates passive income for token holders using advanced risk assessment and GPT-powered decision-making.

License

Notifications You must be signed in to change notification settings

h30s/FraxGuardian-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ FraxGuardian AI

The AI Agent That Makes Money for Token Holders

An autonomous AI agent built with ADK-TS that finds profitable arbitrage opportunities in the Frax Finance ecosystem using advanced 6-factor risk assessment and GPT-powered decision-making.

License: MIT TypeScript Powered by ADK-TS Tests Passing

Built for Agent Arena Hackathon | Nov 10 - Dec 9, 2025


🎯 What is FraxGuardian AI?

FraxGuardian AI is an intelligent autonomous agent that:

  • πŸ” Monitors Frax Finance pools 24/7 for arbitrage opportunities
  • 🧠 Analyzes opportunities using 6-factor risk assessment + GPT-4
  • ⚑ Executes profitable trades automatically on Base testnet
  • πŸ’° Generates revenue for ATP token holders (20% performance fees)
  • πŸ›‘οΈ Protects against DeFi risks with production-grade safety checks

Why This Matters

Frax Finance has $2B TVL, but millions in arbitrage opportunities go unclaimed daily. FraxGuardian AI captures these inefficiencies using sophisticated AI-powered decision-making that outperforms traditional bots.


⭐ Key Features

🧠 Advanced AI Risk Assessment

6-Factor Risk Engine (Industry bots typically use 2-3):

  • Liquidity Risk (25%) - Pool depth analysis with multi-tier thresholds
  • Price Impact Risk (20%) - Trade size impact prediction
  • Gas Cost Risk (20%) - Profit margin vs gas efficiency
  • Volatility Risk (15%) - FRAX peg stability monitoring
  • Slippage Risk (10%) - Estimated slippage calculation
  • Competition Risk (10%) - MEV bot competition assessment

πŸ’¬ GPT-Powered Analysis

  • Structured AI prompts for consistent decision-making
  • Natural language explanations for every trade
  • Context-aware risk assessment
  • 3-factor confidence scoring (risk + profit + efficiency)

βœ… Production-Ready Code

  • 8 passing tests with Jest
  • TypeScript strict mode
  • Comprehensive error handling
  • Modular ADK-TS architecture
  • Simulation + Testnet + Mainnet modes

πŸ—οΈ Architecture

FraxGuardian implements the ADK-TS Perception-Reasoning-Action framework:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    DATA LAYER                               β”‚
β”‚  Blockchain Monitor β†’ Frax Contracts β†’ Price Feeds β†’ KRWQ   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 AI BRAIN (ADK-TS Agent)                     β”‚
β”‚  Perception β†’ Opportunity Scanner                           β”‚
β”‚  Reasoning β†’ 6-Factor Risk Assessment + GPT Analysis        β”‚
β”‚  Action β†’ Safe Execution Planner                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  EXECUTION LAYER                            β”‚
β”‚  Simulation β†’ Testnet β†’ Mainnet (Progressive Deployment)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              TOKENIZATION & UI                              β”‚
β”‚  ATP Token β†’ Investor Dashboard β†’ Performance Analytics     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

  • Core Framework: @iqai/adk (ADK-TS Agent Development Kit)
  • Agent Architecture: AgentBuilder with custom Tools
  • AI/ML: OpenAI GPT-3.5/GPT-4 via ADK-TS
  • Blockchain: Ethers.js v6, Base Sepolia Testnet
  • Language: TypeScript 5.6, Node.js 18+
  • Testing: Jest with TypeScript ES modules
  • Integrations: Frax Finance, KRWQ stablecoin

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • (Optional) OpenAI API key for AI analysis
  • (Optional) Base Sepolia testnet wallet

Installation

# Clone the repository
git clone https://github.com/yourusername/fraxguardian-ai.git
cd fraxguardian-ai

# Install dependencies (450+ packages)
npm install

# Copy environment template
cp .env.example .env
# Edit .env with your API keys if you have them

Run Demos

# ADK-TS Demo (RECOMMENDED - Official hackathon framework)
npm run demo:adk

# Basic demo (original version)
npm run demo

# Enhanced demo (shows Day 2 improvements)
npm run demo:enhanced

# Run tests
npm test

# Build for production
npm run build

πŸ“Š Demo Output

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
πŸ›‘οΈ  FRAXGUARDIAN AI
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

πŸš€ NEW FEATURES:
   βœ“ 6-factor risk assessment (up from 4)
   βœ“ MEV competition analysis
   βœ“ Slippage prediction
   βœ“ Advanced AI prompts
   βœ“ Enhanced confidence scoring

πŸ“ ITERATION 1/3
────────────────────────────────────────────────────────────────
πŸ” PERCEPTION: Scanning blockchain for opportunities...
βœ… PERCEPTION: Found 1 potential opportunities

πŸ’‘ Found opportunity: FraxSwap FRAX/USDC Pool A β†’ Pool B
   Price Difference: 0.60%
   Net Profit: $6.01

🧠 REASONING: Analyzing with enhanced 6-factor risk engine...
βœ… REASONING: Decision = EXECUTE | Confidence = 76.5%
   Risk Category: LOW (24/100)

πŸ“Š RISK BREAKDOWN:
   Liquidity Risk:     20/100  βœ“ Safe
   Price Impact Risk:  35/100  βœ“ Moderate
   Gas Cost Risk:      20/100  βœ“ Safe
   Volatility Risk:    10/100  βœ“ Very Safe
   Slippage Risk:      15/100  βœ“ Safe
   Competition Risk:   30/100  βœ“ Acceptable

⚑ EXECUTING TRADE...
βœ… SIMULATION SUCCESS: Profit = $5.93
   TX Hash: 0xa219bc59153de3b923402d48d107db295a3fb70b...

πŸŽ‰ EXECUTION SUCCESSFUL!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

πŸ“Š EXECUTION SUMMARY
Total Executions: 3
Successful: 3 (100% success rate)
Failed: 0
Total Profit: $17.89

πŸ’Ό Business Model

Revenue Generation

  • Performance Fees: 20% of arbitrage profits
  • Token Holders: Receive 80% of profits via ATP
  • Projected APR: 18-25% for token holders

Market Opportunity

  • TAM: $2B Frax Finance TVL
  • Addressable: $10-20M/year in inefficiencies (0.5-1%)
  • Target: Capture 1% = $100-200K/year revenue

Competitive Advantages

  1. βœ… 6-factor risk model (vs 2-3 for typical bots)
  2. βœ… AI-powered decisions (GPT-based, not just heuristics)
  3. βœ… First-mover in Frax ecosystem
  4. βœ… Community-owned via ATP tokenization
  5. βœ… Production-grade with test coverage

πŸ“– Documentation


πŸ§ͺ Testing

# Run all tests
npm test

# Test output
PASS  tests/risk-engine.test.ts
  Enhanced Risk Engine
    βœ“ should calculate risk score within 0-100 range
    βœ“ should categorize low risk correctly
    βœ“ should recommend EXECUTE for low risk and good profit
    βœ“ should recommend SKIP for high risk
    βœ“ should recommend SKIP for low profit below threshold
    βœ“ should generate readable risk explanation
  Price Difference Calculations
    βœ“ should detect 0.6% price difference
    βœ“ should calculate profit correctly

Test Suites: 1 passed, 1 total
Tests:       8 passed, 8 total

🀝 Contributing

This project was built from scratch for the Agent Arena Hackathon. Contributions welcome after hackathon submission!


πŸ“œ License

MIT License - see LICENSE file for details


πŸ™ Acknowledgments

  • Frax Finance - For the innovative DeFi ecosystem
  • KRWQ - For stablecoin integration
  • IQAI - For the ADK-TS framework and ATP platform
  • Agent Arena Hackathon - For the opportunity to build this

πŸ† Why FraxGuardian AI Stands Out

Technical Strength

  • Advanced 6-factor risk engine
  • Robust ADK-TS architecture with tests
  • GPT-driven analysis pipeline

Innovation

  • Frax-native arbitrage intelligence
  • MEV-aware, slippage-optimized strategy layer
  • AI-powered decision system with refined prompting

Business Impact

  • Clear revenue path via performance fees
  • Large market opportunity within Frax ecosystem
  • Defined token and growth strategy

Execution

  • Fully functional demo
  • Solid documentation
  • Polished presentation and complete delivery

Built with ❀️ for the Frax Finance community

FraxGuardian AI - Making money while you sleep πŸ’°πŸ€–

About

FraxGuardian AI is an autonomous AI agent that scans Frax Finance for arbitrage opportunities, executes profitable trades, and generates passive income for token holders using advanced risk assessment and GPT-powered decision-making.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages