Back to Skills

simulating-flash-loans

verified

Simulate flash loan strategies with profitability calculations and risk assessment across Aave, dYdX, and Balancer. Use when simulating flash loans, analyzing arbitrage profitability, evaluating liquidation opportunities, or comparing flash loan providers. Trigger with phrases like "simulate flash loan", "flash loan arbitrage", "liquidation profit", "compare Aave dYdX", "flash loan strategy", or "DeFi arbitrage simulation".

View on GitHub

Marketplace

claude-code-plugins-plus

jeremylongshore/claude-code-plugins-plus-skills

Plugin

flash-loan-simulator

crypto

Repository

jeremylongshore/claude-code-plugins-plus-skills
1.1kstars

plugins/crypto/flash-loan-simulator/skills/simulating-flash-loans/SKILL.md

Last Verified

January 22, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/main/plugins/crypto/flash-loan-simulator/skills/simulating-flash-loans/SKILL.md -a claude-code --skill simulating-flash-loans

Installation paths:

Claude
.claude/skills/simulating-flash-loans/
Powered by add-skill CLI

Instructions

# Simulating Flash Loans

## Overview

This skill simulates flash loan strategies across major DeFi protocols (Aave V3, dYdX, Balancer) with profitability calculations, gas cost estimation, and risk assessment. It enables developers and researchers to evaluate flash loan opportunities without executing real transactions.

## Prerequisites

Before using this skill, ensure you have:
- Python 3.9+ with `web3`, `httpx`, and `rich` packages
- RPC endpoint access (free public RPCs work fine)
- Understanding of flash loan mechanics and DeFi protocols
- Optional: Etherscan API key for better gas estimates

## Instructions

### Step 1: Configure RPC Endpoint

Configure your RPC in `{baseDir}/config/settings.yaml`:

```yaml
# Free public RPCs (no signup required)
rpc_endpoints:
  ethereum: "https://rpc.ankr.com/eth"
  polygon: "https://rpc.ankr.com/polygon"
  arbitrum: "https://rpc.ankr.com/arbitrum"
```

Or use environment variable:
```bash
export ETH_RPC_URL="https://rpc.ankr.com/eth"
```

### Step 2: Simple Arbitrage Simulation

Simulate a basic two-DEX arbitrage:
```bash
python {baseDir}/scripts/flash_simulator.py arbitrage ETH USDC 100 \
  --dex-buy uniswap --dex-sell sushiswap
```

This calculates:
- Gross profit from price difference
- Flash loan fee (provider-specific)
- Gas costs
- Net profit/loss

### Step 3: Compare Flash Loan Providers

Find the cheapest provider for your strategy:
```bash
python {baseDir}/scripts/flash_simulator.py arbitrage ETH USDC 100 --compare-providers
```

Output shows:
| Provider | Fee | Net Profit |
|----------|-----|------------|
| dYdX | 0% | $245.30 |
| Balancer | 0.01% | $242.80 |
| Aave V3 | 0.09% | $225.50 |

### Step 4: Liquidation Profitability

Analyze liquidation opportunities:
```bash
python {baseDir}/scripts/flash_simulator.py liquidation \
  --protocol aave --health-factor 0.95
```

Shows positions below health factor threshold with:
- Collateral value
- Debt value
- Liquidation bonus
- Net profit after costs

### Step 5: Tri

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
5272 chars