Skip to content

Fyclub (Fight for You Club ) is an AI-powered on-chain security agent that analyzes DeFi treasuries, detects risk, and recommends protective actions in real time

License

Notifications You must be signed in to change notification settings

dkwhitedevil/FyClub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

33 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸฅŠ FY Club โ€” Fight For You Club

The First Rule of DeFi Safety is Protection

An AI-powered on-chain security agent for DeFi treasuries. FY Club doesn't react to lossโ€”it prevents loss.

Built for the AGENT ARENA โ€“ AI Agent Hackathon ๐Ÿš€ Hosted by IQAI, OpenMind, and EwhaChain


๐Ÿ† AGENT ARENA โ€“ AI Agent Hackathon

This project is submitted to the AGENT ARENA โ€“ AI Agent Hackathon, a global 1-month hackathon inviting university builders to create innovative on-chain AI agents.

What Makes FY Club Perfect for This Hackathon

โœ… Built entirely with ADK-TS (Agent Development Kit โ€“ TypeScript)
โœ… Multi-agent AI system for autonomous decision-making
โœ… Deployed on ATP (Agent Tokenization Platform)
โœ… On-chain security agent with real-world DeFi impact
โœ… Production-ready monorepo architecture
โœ… Fully open-source and transparent


๐ŸŽฏ The Problem

Decentralized Finance has unlocked trillion-dollar opportunitiesโ€”but it has also created one of the most dangerous financial environments ever built.

Today, DeFi users, DAOs, and treasuries face:

  • โŒ Rug pulls
  • โŒ Smart contract exploits
  • โŒ Overexposure to a single asset
  • โŒ Liquidity collapses
  • โŒ Human delay in risk response
  • โŒ No real-time defensive AI layer

Most security systems in DeFi are:

  • Reactive โ†’ they respond after funds are lost
  • Manual โ†’ humans must interpret dashboards
  • Slow โ†’ attacks happen in seconds

โš ๏ธ The Truth

In DeFi, by the time you "notice" risk, it is already too late.


โœ… The Solution

FY Club is an AI-powered on-chain security agent that acts as a real-time defensive layer for DeFi treasuries.

Instead of waiting for damage, FY Club:

โœ… Continuously monitors treasury activity โœ… Analyzes DeFi exposure using AI agents โœ… Detects financial and protocol-level risk โœ… Predicts dangerous concentration patterns โœ… Generates real-time protective actions โœ… Acts as a digital bodyguard for DeFi funds

FY Club doesn't react to loss. It prevents loss.


๐Ÿš€ How It Works (In 3 Steps)

Users just:

  1. Enter their treasury address
  2. Click "Scan"
  3. Instantly get:
    • Risk score
    • Exposure breakdown
    • AI-generated protection advice

Example Output:

โ— "Your treasury is 78% exposed to one asset."
โ— "Liquidity risk detected."
โœ… "Diversification recommended."
โœ… "Reduce exposure to prevent cascade failure."

๐Ÿ›๏ธ Project Structure

FY Club is built as a full-stack, AI-powered DeFi security system with a modular, scalable monorepo architecture.

FyClub/
โ”œโ”€โ”€ apps/                    # User-facing applications
โ”‚   โ”œโ”€โ”€ api/                 # Backend API (Fastify)
โ”‚   โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ routes/      # API endpoints
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ controllers/ # Request handlers
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ services/    # Business logic
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ config/      # Configuration
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ middlewares/ # Error handling
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ types/       # TypeScript types
โ”‚   โ”‚   โ””โ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ web/                 # Frontend Dashboard (Next.js)
โ”‚       โ”œโ”€โ”€ src/
โ”‚       โ”‚   โ”œโ”€โ”€ app/         # Page routes
โ”‚       โ”‚   โ”œโ”€โ”€ components/  # UI components
โ”‚       โ”‚   โ”œโ”€โ”€ hooks/       # Custom hooks
โ”‚       โ”‚   โ”œโ”€โ”€ lib/         # Utilities
โ”‚       โ”‚   โ””โ”€โ”€ types/       # Types
โ”‚       โ””โ”€โ”€ package.json
โ”œโ”€โ”€ packages/                # Shared libraries
โ”‚   โ””โ”€โ”€ agents-core/         # AI Agent system
โ”‚       โ”œโ”€โ”€ src/
โ”‚       โ”‚   โ”œโ”€โ”€ agents/      # AI workers
โ”‚       โ”‚   โ”œโ”€โ”€ tools/       # External capabilities
โ”‚       โ”‚   โ”œโ”€โ”€ workflows/   # Agent orchestration
โ”‚       โ”‚   โ”œโ”€โ”€ memory/      # Historical data
โ”‚       โ”‚   โ”œโ”€โ”€ policies/    # Risk policies
โ”‚       โ”‚   โ”œโ”€โ”€ schemas/     # Data schemas
โ”‚       โ”‚   โ””โ”€โ”€ types.ts     # Shared types
โ”‚       โ””โ”€โ”€ package.json
โ”œโ”€โ”€ docs/                    # Documentation
โ”‚   โ”œโ”€โ”€ ARCHITECTURE.md      # System design
โ”‚   โ”œโ”€โ”€ DEMO-SCRIPT.md       # Video narration
โ”‚   โ”œโ”€โ”€ JUDGING-MAP.md       # Hackathon mapping
โ”‚   โ”œโ”€โ”€ ATP-DEPLOYMENT.md    # ATP integration
โ”‚   โ”œโ”€โ”€ API-DOCS.md          # API reference
โ”‚   โ””โ”€โ”€ ROADMAP.md           # Future vision
โ”œโ”€โ”€ scripts/                 # Automation scripts
โ”‚   โ”œโ”€โ”€ build-all.ts         # Build entire project
โ”‚   โ”œโ”€โ”€ deploy-atp.ts        # Deploy agent to ATP
โ”‚   โ””โ”€โ”€ seed-demo-data.ts    # Add demo data
โ”œโ”€โ”€ .github/                 # CI/CD workflows
โ”œโ”€โ”€ tsconfig.base.json       # Global TypeScript config
โ”œโ”€โ”€ pnpm-workspace.yaml      # Monorepo workspace
โ””โ”€โ”€ .env.example             # Environment template

๐Ÿ“Š Architecture Overview

User โ†’ Web Dashboard โ†’ API โ†’ AI Agents โ†’ Risk Analysis โ†’ Protection Advice โ†’ User

Core Components:

Component Technology Role
Web Next.js + React User interface & dashboard
API Fastify + TS Backend server & orchestrator
Agents ADK-TS AI decision-making engine
Tools RPC/DeFi APIs Blockchain & protocol access
Policies Config files Risk management rules

๐Ÿค– AI Agent System

FY Club runs a multi-agent AI system where each agent is specialized and autonomous:

AI Agent Role
Watcher Agent Reads treasury & asset balances
Risk Agent Calculates exposure & danger
Planner Agent Generates safety actions
Governance Agent Enforces policy constraints

How They Work Together:

  1. Watcher โ†’ Fetches treasury data from blockchain
  2. Risk Agent โ†’ Analyzes exposure & detects patterns
  3. Planner โ†’ Generates protection recommendations
  4. Governance โ†’ Validates against user policies

๐Ÿง  Built with ADK-TS

FY Club is fully implemented using IQAI's Agent Development Kit for TypeScript (ADK-TS), the industry standard for building autonomous AI agents on blockchain.

ADK-TS Implementation

Our four specialized agents are built using AgentBuilder pattern:

// Example: Risk Analysis Agent using ADK-TS
import { AgentBuilder } from "@iqai/adk";

export async function initRiskAgent() {
  return await AgentBuilder.create("risk_analysis_agent")
    .withModel("qwen2.5")
    .withInstruction("Analyze treasury concentration and financial risk...")
    .build();
}

Agent Architecture

Each agent follows the ADK-TS pattern:

1. Watcher Agent โ€“ Real-time Treasury Monitor

import { AgentBuilder } from "@iqai/adk";
// Fetches on-chain data using RPC calls
// Validates treasury balances and positions
// Returns structured TreasurySnapshot

2. Risk Agent โ€“ Autonomous Risk Analyzer

// Uses ADK-TS AgentBuilder for LLM decision-making
// Analyzes concentration, diversification, and size risk
// Generates risk scores with deterministic fallbacks
// Returns RiskResult with level (LOW/MEDIUM/HIGH)

3. Planner Agent โ€“ Protection Strategy Generator

// Generates mitigation actions based on risk assessment
// Returns structured ProtectionPlan with action types:
// - ALERT: Notify operators
// - REDUCE: Lower exposure
// - DIVERSIFY: Add assets

4. Governance Agent โ€“ Policy Enforcer

// Final safety decision-maker
// Enforces hard rules: HIGH risk + large treasury = BLOCKED
// Uses ADK-TS LLM with deterministic fallbacks
// Returns GovernanceDecision with approval/block reasoning

LLM Integration with ADK-TS

FY Club uses a LLM + Deterministic Fallback Pattern:

// ADK Agent calls LLM (Qwen model)
const llmResponse = await callQwenLLM(prompt);

// Robust JSON extraction from LLM response
const parsed = extractJSON<RiskResult>(llmResponse);

// Validates structure and types
if (validated) {
  return llmResult;
}

// Falls back to deterministic logic if LLM response malformed
return treasuryTools.generateBaseRisk(snapshot);

Tools & Capabilities

ADK-TS agents leverage custom tools:

export const treasuryTools = {
  analyzeConcentration: (snapshot) => {...},
  analyzeSizeExposure: (totalValue) => {...},
  generateBaseRisk: (snapshot) => {...}
};

Multi-Agent Orchestration Workflow

All agents are orchestrated in a sequential decision pipeline using ADK-TS:

export async function runTreasuryWorkflow(address: string) {
  // 1. Initialize all ADK agents
  await initRiskAgent();
  await initPlannerAgent();
  await initGovernanceAgent();

  // 2. Run sequential pipeline
  const snapshot = await watchTreasury(address);        // Watcher
  const risk = await analyzeRisk(snapshot);             // Risk Agent (ADK)
  const plan = await generateProtectionPlan(risk);      // Planner Agent (ADK)
  const governance = await enforceGovernance({...});    // Governance Agent (ADK)

  return { snapshot, risk, plan, governance };
}

Why ADK-TS?

  • โœ… Native TypeScript support โ€“ Full type safety across agent ecosystem
  • โœ… AgentBuilder pattern โ€“ Declarative, composable agent definitions
  • โœ… LLM flexibility โ€“ Supports Gemini, GPT-4, Claude, custom models
  • โœ… Production-ready โ€“ Error handling, timeouts, retries built-in
  • โœ… ATP compatible โ€“ Agents launch directly on IQAI's ATP platform
  • โœ… Deterministic fallbacks โ€“ Never fails completely, always returns valid decisions
  • โœ… Tool integration โ€“ Seamless blockchain and external API access

Deployment Ready

FY Club's ADK-TS agents are ready for ATP (Agent Tokenization Platform) deployment, where they will operate as autonomous, tokenized agents on IQAI's infrastructure.


๐Ÿ› ๏ธ Tech Stack

Frontend

  • Next.js 15 - React framework
  • TypeScript - Type safety
  • Tailwind CSS - Styling
  • React Hooks - State management

Backend

  • Fastify - HTTP server
  • TypeScript - Type safety
  • Node.js - Runtime

AI/Agents

  • ADK-TS - Agent framework
  • Vector Store - Memory & learning
  • JSON Schemas - Data validation

Blockchain

  • Web3.js / ethers.js - RPC calls
  • Multi-chain - Support for major chains
  • Real-time indexing - Live data feeds

DevOps

  • pnpm - Package manager
  • Monorepo - Workspace structure
  • TypeScript - Global type safety
  • GitHub Actions - CI/CD

๐Ÿ“‹ Features

โœ… Current (MVP)

  • Treasury scanning via contract address
  • Real-time risk assessment
  • Asset exposure analysis
  • Protection recommendation engine
  • Web dashboard interface
  • REST API endpoints
  • Multi-chain support
  • Risk policy configurations

๐Ÿš€ Roadmap

  • Automated on-chain execution
  • Advanced vector memory system
  • Cross-chain risk aggregation
  • Real-time notifications
  • DAO governance integration
  • ATP protocol deployment
  • Autonomous defense layer
  • Global security network

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • pnpm 8+
  • An Ethereum RPC endpoint
  • An API key (for price feeds if needed)

Installation

  1. Clone the repository

    git clone https://github.com/dkwhitedevil/FyClub.git
    cd FyClub
  2. Install dependencies

    pnpm install
  3. Set up environment variables

    cp .env.example .env.local
    # Edit .env.local with your RPC URLs and API keys
  4. Build the project

    pnpm run build

Running Locally

Start the Backend API

cd apps/api
pnpm run dev

The API will start on http://localhost:3001

Start the Frontend

cd apps/web
pnpm run dev

The dashboard will be available at http://localhost:3000

Using the API

Scan a treasury for risk:

curl -X POST http://localhost:3001/api/scan \
  -H "Content-Type: application/json" \
  -d '{
    "treasuryAddress": "0x1234...",
    "chainId": 1,
    "riskPolicy": "balanced"
  }'

Response:

{
  "riskScore": 7.2,
  "exposure": {
    "ETH": 45,
    "USDC": 30,
    "USDT": 25
  },
  "alerts": [
    "High concentration in single stablecoin",
    "Potential liquidity risk detected"
  ],
  "recommendations": [
    "Diversify stablecoin holdings",
    "Consider rebalancing to reduce concentration"
  ],
  "protectionActions": [
    {
      "action": "REDUCE_EXPOSURE",
      "token": "USDC",
      "targetPercentage": 15
    }
  ]
}

๐Ÿ“š API Documentation

See docs/API-DOCS.md for detailed endpoint documentation.


๐Ÿ”— Hackathon Resources & Support

Communication & Support

ADK-TS (Agent Development Kit for TypeScript)

ATP (Agent Tokenization Platform)

OpenMind


๐Ÿ“š API Documentation

See docs/API-DOCS.md for detailed endpoint documentation.


๐Ÿ—๏ธ System Architecture

See docs/ARCHITECTURE.md for detailed system design and data flow diagrams.


๐ŸŽฌ Demo & Testing

Run Demo Script

pnpm run seed-demo

This loads example treasuries and their risk profiles.

Watch the Demo Video Script

See docs/DEMO-SCRIPT.md for the narration of how to present FY Club.


๐Ÿ† What Makes FY Club Unique

Aspect Traditional Tools FY Club
Approach Static dashboards Live AI monitoring
Decision-Making Manual Automated
Response Time Reactive (too slow) Preventive (real-time)
User Interaction Complex dashboards One-click scanning
Scalability Limited Autonomous network

FY Club is not just a dashboard. It is a combat-ready AI defense system for DeFi.


๐Ÿ’ผ Use Cases

  • ๐Ÿ” DAOs - Protect treasury assets
  • ๐Ÿ” Crypto Funds - Manage fund risk
  • ๐Ÿ” DeFi Startups - Monitor protocol safety
  • ๐Ÿ” Treasury Managers - Real-time oversight
  • ๐Ÿ” Web3 Security Teams - Automated monitoring
  • ๐Ÿ” Hackathon Projects - Prize vault protection

๐Ÿ”ฎ Vision for the Future

FY Club is designed to evolve into:

โœ… A fully autonomous DeFi firewall โœ… A global network of security agents โœ… A DAO-governed on-chain defense protocol โœ… A real-time AI risk intelligence layer for Web3

Long-term, FY Club can:

  • Block malicious treasury flows automatically
  • Execute defensive transactions on-chain
  • Coordinate security across multiple chains
  • Protect billions in DeFi capital

๐Ÿ“– Documentation

Complete documentation available in the docs/ folder:


๐Ÿงช Testing

Run tests:

pnpm run test

Run linting:

pnpm run lint

Build all packages:

pnpm run build

๐Ÿค Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License

This project is licensed under the MIT License - see LICENSE file for details.


๐Ÿ‘ฅ Team & Acknowledgments

FY Club is built with โค๏ธ for DeFi security and submitted to the AGENT ARENA โ€“ AI Agent Hackathon.

Hackathon Organizers

IQAI - Integrates artificial intelligence with decentralized finance through the Agent Tokenization Platform (ATP). Enables developers to create, deploy, and manage tokenized AI agents that operate autonomously within blockchain ecosystems.

OpenMind - Creating the universal operating system for intelligent machines. The OM1 platform allows robots and intelligent systems to perceive, adapt, and act in human environments, powered by FABRIC, a decentralized coordination layer. Based in San Francisco and founded by a Stanford-led team.

EwhaChain - The blockchain academic society at Ewha Womans University, empowering students to become active contributors to Korea's blockchain ecosystem through structured learning and hands-on project experience.

Prize Sponsors

  • ๐ŸŒพ Frax Finance - Leader in stablecoin technology
  • ๐Ÿ‡ฐ๐Ÿ‡ท KRWQ - First digital Korean Won

๐Ÿšจ Security Disclaimer

FY Club provides risk assessment and recommendations. Always conduct your own due diligence. AI predictions are not financial advice. Use at your own risk.


๐ŸฅŠ Final Tagline

FY Club โ€” Fight For You. The First Rule of DeFi Safety is Protection.

DeFi is powerful. DeFi is open. But DeFi is also dangerous.

FY Club exists for one reason:

๐ŸฅŠ To fight risk before it destroys your protocol.


Built with AI. Secured by Intelligence. Protected by FY Club. ๐Ÿš€

About

Fyclub (Fight for You Club ) is an AI-powered on-chain security agent that analyzes DeFi treasuries, detects risk, and recommends protective actions in real time

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published