Skip to content

Repository files navigation

Aave V3 Whale Liquidation Monitor

🐋 Track whale positions and liquidations on Aave V3 across Ethereum Mainnet and Sepolia.

Features

  • Multi-chain Indexing: Ethereum Mainnet + Sepolia testnet
  • Whale Detection: 100 ETH threshold (~$300k+)
  • Webhook Alerts: Discord/Slack integration for real-time notifications
  • Events Tracked:
    • 🟢 Supply (deposits)
    • 🟡 Withdraw
    • 🟠 Borrow
    • 🔵 Repay
    • 🔴 Liquidations (always alerted!)

Quick Start

1. Install Dependencies

pnpm install
envio codegen

2. Local Development

# Start PostgreSQL + Hasura
envio local docker up

# Start indexer in dev mode
envio dev

3. Configure Alerts (Optional)

# Copy environment template
cp .env.example .env

# Add your webhook URL
echo 'ALERT_WEBHOOK_URL=https://discord.com/api/webhooks/...' >> .env

4. Access GraphQL API

Local: http://localhost:8080/v1/graphql

Deployment to Envio Hosted Service

Prerequisites

  1. GitHub account
  2. Project pushed to GitHub repository
  3. Envio account at https://envio.dev

Deployment Steps

  1. Push to GitHub

    git init
    git add .
    git commit -m "Initial commit: Aave Whale Liquidation Monitor"
    git remote add origin git@github.com:YOUR_USERNAME/aave-whale-monitor.git
    git push -u origin main
  2. Connect to Envio

  3. Configure Deployment

    • Envio auto-detects config.yaml
    • Set environment variables:
      • ALERT_WEBHOOK_URL (optional)
    • Click "Deploy"
  4. Monitor Deployment

    • View logs in Envio dashboard
    • GraphQL endpoint provided after deployment
    • Automatic sync with HyperSync (2000x faster than RPC!)

GraphQL Queries

Get Whale Positions

query WhalePositions {
  WhalePosition(where: {isWhale: {_eq: true}}) {
    id
    user
    reserve
    totalSupplied
    totalBorrowed
    lastUpdated
  }
}

Get Recent Liquidations

query RecentLiquidations {
  LiquidationEvent(order_by: {timestamp: desc}, limit: 20) {
    id
    user
    liquidator
    debtToCover
    liquidatedCollateralAmount
    collateralAsset
    debtAsset
    isWhale
    txHash
    timestamp
  }
}

Protocol Stats

query Stats {
  ProtocolStats(where: {id: {_eq: "global"}}) {
    totalSupplyEvents
    totalBorrowEvents
    totalLiquidations
  }
}

Architecture

Blockchain Events (Aave V3 Pool)
        │
        ▼
   HyperSync (2000x faster)
        │
        ▼
   Envio Indexer
   ├── EventHandlers.ts
   │   ├── Track positions
   │   ├── Detect whales
   │   └── Send alerts
        │
        ▼
   PostgreSQL + Hasura
        │
        ▼
   GraphQL API → Your App/Dashboard

Contract Addresses

Network Chain ID Aave V3 Pool Address
Mainnet 1 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2
Sepolia 11155111 0x6Ae43d3271ff6888e7Fc43Fd7321a503ff738951

Alert Colors

Event Color Meaning
🟢 Supply Green Whale depositing
🟡 Withdraw Yellow Whale withdrawing
🟠 Borrow Orange Whale borrowing
🔴 Liquidation Red Position liquidated

License

MIT \n< Deployed via Envio HyperIndex -->

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages