Skip to content

vola-trebla/predator-liquidator

Repository files navigation

Predator — Aave V3 Liquidator Bot

Network support: Arbitrum (main), Polygon (soon), Base, Optimism, others planned.

Core idea: This bot monitors Aave V3 for liquidatable users (Health Factor < 1), initiates flash loans, repays debt, collects collateral, swaps it via DEX (e.g. Uniswap), repays the loan + fee, and keeps the profit. All done in a single atomic transaction.


🗂️ Project Structure

predator/
├── contracts/              # Solidity smart contracts (e.g. FlashLoanLiquidator.sol)
├── scripts/                # TypeScript bot & deploy scripts
│   ├── bot.ts              # Main liquidation monitoring logic
│   ├── deploy.ts           # Deployment script for the contract
│   └── testBot.ts          # Manual bot test script
├── test/                   # Hardhat test files
│   └── test.ts             # Basic smart contract tests
├── artifacts/              # Build output (ignored)
├── cache/                  # Hardhat cache (ignored)
├── typechain-types/        # Auto-generated TypeScript types from ABI
├── .env                    # Environment variables (ignored)
├── hardhat.config.ts       # Hardhat configuration (with networks & plugins)
├── tsconfig.json           # TypeScript config
├── package.json            # Dependencies and scripts
└── README.md               # This file

⚙️ Scripts

# Compile contracts
npx hardhat compile

# Deploy to selected network (e.g., Arbitrum)
npx hardhat run scripts/deploy.ts --network arbitrum

# Run bot manually (e.g., on Arbitrum)
npx tsx scripts/bot.ts

🌐 ENV Variables (.env)

# RPC & Network
CHAIN=arbitrum
RPC_URL_ARBITRUM=https://...
RPC_URL_POLYGON=https://...

# Contracts
POOL_ADDRESSES_PROVIDER_ARBITRUM=0x...
POOL_ADDRESSES_PROVIDER_POLYGON=0x...
POOL_ADDRESS_ARBITRUM=0x...
FLASH_LIQUIDATOR_CONTRACT=0x...

# Subgraph
SUBGRAPH_URL_ARBITRUM=https://api.thegraph.com/subgraphs/name/...  
SUBGRAPH_URL_POLYGON=https://api.thegraph.com/subgraphs/name/...

# Dex router (e.g. Uniswap V3)
DEX_ROUTER_ARBITRUM=0x...
DEX_ROUTER_POLYGON=0x...

# Wallet
PRIVATE_KEY=your_wallet_key

# Bot config
MIN_PROFIT=1000000000000000   # 0.001 ETH
SLIPPAGE_TOLERANCE=0.005      # 0.5%

🧪 Testing

npx hardhat test

🛠 Tech Stack

  • Solidity ^0.8.20
  • Hardhat
  • ethers.js v6
  • graphql-request
  • TypeScript + tsx

🚧 TODO

  • Add support for Base, Optimism
  • Integrate MEV (Flashbots)
  • Create dashboard
  • Swap aggregator (e.g., 1inch)
  • Profit analytics

Made with 🦎 by a predator

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published