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
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.
โ
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
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
In DeFi, by the time you "notice" risk, it is already too late.
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.
Users just:
- Enter their treasury address
- Click "Scan"
- Instantly get:
- Risk score
- Exposure breakdown
- AI-generated protection advice
โ "Your treasury is 78% exposed to one asset."
โ "Liquidity risk detected."
โ
"Diversification recommended."
โ
"Reduce exposure to prevent cascade failure."
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
User โ Web Dashboard โ API โ AI Agents โ Risk Analysis โ Protection Advice โ User
| 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 |
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 |
- Watcher โ Fetches treasury data from blockchain
- Risk Agent โ Analyzes exposure & detects patterns
- Planner โ Generates protection recommendations
- Governance โ Validates against user policies
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.
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();
}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 TreasurySnapshot2. 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 assets4. 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 reasoningFY 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);ADK-TS agents leverage custom tools:
export const treasuryTools = {
analyzeConcentration: (snapshot) => {...},
analyzeSizeExposure: (totalValue) => {...},
generateBaseRisk: (snapshot) => {...}
};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 };
}- โ 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
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.
- Next.js 15 - React framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- React Hooks - State management
- Fastify - HTTP server
- TypeScript - Type safety
- Node.js - Runtime
- ADK-TS - Agent framework
- Vector Store - Memory & learning
- JSON Schemas - Data validation
- Web3.js / ethers.js - RPC calls
- Multi-chain - Support for major chains
- Real-time indexing - Live data feeds
- pnpm - Package manager
- Monorepo - Workspace structure
- TypeScript - Global type safety
- GitHub Actions - CI/CD
- 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
- 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
- Node.js 18+
- pnpm 8+
- An Ethereum RPC endpoint
- An API key (for price feeds if needed)
-
Clone the repository
git clone https://github.com/dkwhitedevil/FyClub.git cd FyClub -
Install dependencies
pnpm install
-
Set up environment variables
cp .env.example .env.local # Edit .env.local with your RPC URLs and API keys -
Build the project
pnpm run build
cd apps/api
pnpm run devThe API will start on http://localhost:3001
cd apps/web
pnpm run devThe dashboard will be available at http://localhost:3000
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
}
]
}See docs/API-DOCS.md for detailed endpoint documentation.
- ๐ฌ GitHub Discussion: https://github.com/IQAIcom/adk-ts/discussions/
- ๐ฆ Discord Channel: https://discord.gg/UbQaZkznwr
- ๐บ YouTube Channel: https://www.youtube.com/@iqtoken
- ๐ ADK-TS GitHub Repo: https://github.com/IQAIcom/adk-ts
- ๐ ADK-TS Docs: https://adk.iqai.com/
- ๐ง ADK-TS Project Samples: https://github.com/IQAIcom/adk-ts-samples
- ๐ ADK-TS Starter Templates: https://github.com/IQAIcom/adk-ts/tree/main/apps/starter-templates
- ๐ฌ ADK-TS Intro Playlist: https://www.youtube.com/playlist?list=PLAohU1RSbOGWsYlQAiQKUQ9AktdlPbfp7
- ๐น Previous Workshops: https://youtube.com/playlist?list=PLAohU1RSbOGXm4aoA7XNkXN9JDHDT_nqP
- ๐ Official Website: https://iqai.com/
- ๐ ATP Launch Guide: https://learn.iq.wiki/iq/iq/agent-tokenization-platform-atp/launching-tokenized-agent-on-atp
- ๐ GitHub (OM1): https://openmind.org
- ๐ Documentation: https://docs.openmind.org/api-reference/introduction
- ๐ Tutorials: https://docs.openmind.org/examples/overview
See docs/API-DOCS.md for detailed endpoint documentation.
See docs/ARCHITECTURE.md for detailed system design and data flow diagrams.
pnpm run seed-demoThis loads example treasuries and their risk profiles.
See docs/DEMO-SCRIPT.md for the narration of how to present FY Club.
| 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.
- ๐ 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
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
Complete documentation available in the docs/ folder:
- ARCHITECTURE.md - System design & data flow
- API-DOCS.md - REST API reference
- DEMO-SCRIPT.md - Video presentation script
- ATP-DEPLOYMENT.md - How to deploy to ATP
- JUDGING-MAP.md - Hackathon evaluation mapping
- ROADMAP.md - Future development plan
Run tests:
pnpm run testRun linting:
pnpm run lintBuild all packages:
pnpm run buildWe welcome contributions! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see LICENSE file for details.
FY Club is built with โค๏ธ for DeFi security and submitted to the AGENT ARENA โ AI Agent Hackathon.
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.
- ๐พ Frax Finance - Leader in stablecoin technology
- ๐ฐ๐ท KRWQ - First digital Korean Won
FY Club provides risk assessment and recommendations. Always conduct your own due diligence. AI predictions are not financial advice. Use at your own risk.
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. ๐