tessl install github:jeremylongshore/claude-code-plugins-plus-skills --skill simulating-flash-loansSimulate 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".
Review Score
85%
Validation Score
13/16
Implementation Score
73%
Activation Score
100%
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.
Before using this skill, ensure you have:
web3, httpx, and rich packagesConfigure your RPC in {baseDir}/config/settings.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:
export ETH_RPC_URL="https://rpc.ankr.com/eth"Simulate a basic two-DEX arbitrage:
python {baseDir}/scripts/flash_simulator.py arbitrage ETH USDC 100 \
--dex-buy uniswap --dex-sell sushiswapThis calculates:
Find the cheapest provider for your strategy:
python {baseDir}/scripts/flash_simulator.py arbitrage ETH USDC 100 --compare-providersOutput shows:
| Provider | Fee | Net Profit |
|---|---|---|
| dYdX | 0% | $245.30 |
| Balancer | 0.01% | $242.80 |
| Aave V3 | 0.09% | $225.50 |
Analyze liquidation opportunities:
python {baseDir}/scripts/flash_simulator.py liquidation \
--protocol aave --health-factor 0.95Shows positions below health factor threshold with:
Simulate multi-hop circular arbitrage:
python {baseDir}/scripts/flash_simulator.py triangular \
ETH USDC WBTC ETH --amount 50Analyzes path profitability:
Path: ETH → USDC → WBTC → ETH
Gross: +0.15 ETH
Fees: -0.045 ETH (3 swaps)
Loan: -0.045 ETH (Aave fee)
Gas: -0.02 ETH
─────────────────────
Net: +0.04 ETH ($101.73)Add risk analysis to any simulation:
python {baseDir}/scripts/flash_simulator.py arbitrage ETH USDC 100 --risk-analysisRisk factors scored:
Run complete analysis with all features:
python {baseDir}/scripts/flash_simulator.py arbitrage ETH USDC 100 \
--full --output json > simulation.jsonThe simulator provides:
Quick Mode:
Breakdown Mode:
Comparison Mode:
Risk Analysis:
| Provider | Fee | Best For | Chains |
|---|---|---|---|
| dYdX | 0% | Maximum profit | Ethereum |
| Balancer | 0.01% | Pool tokens | ETH, Polygon, Arbitrum |
| Aave V3 | 0.09% | Any token | ETH, Polygon, Arbitrum, Optimism |
| Uniswap V3 | ~0.3% | Specific pairs | ETH, Polygon, Arbitrum |
See {baseDir}/references/errors.md for comprehensive error handling.
Common issues:
See {baseDir}/references/examples.md for detailed examples including:
FOR EDUCATIONAL PURPOSES ONLY
Flash loan strategies involve significant risks:
Never deploy unaudited code. Start with testnets. Consult legal counsel.