jeremylongshore/tons-of-skills-marketplace / plugins/crypto/flash-loan-simulator/skills/simulating-flash-loans
simulating-flash-loans
VerifiedSimulate 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".
| File | Kind | Size |
|---|---|---|
| ARD.md | markdown | 21.4 KB |
| PRD.md | markdown | 8.7 KB |
| SKILL.md | skill md | 4.5 KB |
| config/settings.yaml | config | 9.4 KB |
| references/errors.md | markdown | 6.5 KB |
| references/examples.md | markdown | 15.0 KB |
| references/implementation.md | markdown | 2.9 KB |
| scripts/flash_simulator.py | script | 14.6 KB |
| scripts/formatters.py | script | 17.4 KB |
| scripts/profit_calculator.py | script | 9.1 KB |
| scripts/protocol_adapters.py | script | 11.9 KB |
| scripts/risk_assessor.py | script | 12.9 KB |
| scripts/strategy_engine.py | script | 18.8 KB |
config/settings.yaml
View on GitHub# Flash Loan Simulator Configuration
# ===================================
# Configure RPC endpoints, providers, and simulation parameters.
# All settings can be overridden via command-line arguments.
# ─────────────────────────────────────────────────────────────────
# RPC Endpoints
# ─────────────────────────────────────────────────────────────────
# Free public RPC endpoints (no signup required).
# For production use, consider private RPCs (Infura, Alchemy, QuickNode).
rpc_endpoints:
ethereum:
primary: "https://rpc.ankr.com/eth"
backup:
- "https://eth.llamarpc.com"
- "https://ethereum-rpc.publicnode.com"
- "https://1rpc.io/eth"
polygon:
primary: "https://rpc.ankr.com/polygon"
backup:
- "https://polygon-rpc.com"
arbitrum:
primary: "https://rpc.ankr.com/arbitrum"
backup:
- "https://arb1.arbitrum.io/rpc"
optimism:
primary: "https://rpc.ankr.com/optimism"
backup:
- "https://mainnet.optimism.io"
avalanche:
primary: "https://rpc.ankr.com/avalanche"
backup:
- "https://api.avax.network/ext/bc/C/rpc"
# ─────────────────────────────────────────────────────────────────
# Flash Loan Providers
# ─────────────────────────────────────────────────────────────────
# Provider configuration with fee rates and contract addresses.
providers:
aave:
name: "Aave V3"
fee_rate: 0.0009 # 0.09%
gas_overhead: 100000
contracts:
ethereum: "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2"
polygon: "0x794a61358D6845594F94dc1DB02A252b5b4814aD"
arbitrum: "0x794a61358D6845594F94dc1DB02A252b5b4814aD"
optimism: "0x794a61358D6845594F94dc1DB02A252b5b4814aD"
avalanche: "0x794a61358D6845594F94dc1DB02A252b5b4814aD"
dydx:
name: "dYdX"
fee_rate: 0.0 # FREE!
gas_overhead: 150000
contracts:
ethereum: "0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e"
notes: "Ethereum mainnet only, limited asset support"
balancer:
name: "Balancer"
fee_rate: 0.0001 # 0.01%
gas_overhead: 80000
contracts:
ethereum: "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
polygon: "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
arbitrum: "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
uniswap:
name: "Uniswap V3"
fee_rate: 0.003 # 0.3% (varies by pool)
gas_overhead: 120000
contracts:
ethereum: "0xE592427A0AEce92De3Edee1F18E0157C05861564"
polygon: "0xE592427A0AEce92De3Edee1F18E0157C05861564"
arbitrum: "0xE592427A0AEce92De3Edee1F18E0157C05861564"
optimism: "0xE592427A0AEce92De3Edee1F18E0157C05861564"
notes: "Flash swap (not flash loan) - fee is pool-dependent"
# ─────────────────────────────────────────────────────────────────
# DEX Configuration
# ─────────────────────────────────────────────────────────────────
# Supported DEXes for arbitrage simulations.
dexes:
uniswap:
name: "Uniswap V3"
fee_tiers: [0.0001, 0.0005, 0.003, 0.01] # 0.01%, 0.05%, 0.3%, 1%
router:
ethereum: "0xE592427A0AEce92De3Edee1F18E0157C05861564"
polygon: "0xE592427A0AEce92De3Edee1F18E0157C05861564"
arbitrum: "0xE592427A0AEce92De3Edee1F18E0157C05861564"
sushiswap:
name: "SushiSwap"
fee_rate: 0.003 # 0.3%
router:
ethereum: "0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F"
polygon: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"
arbitrum: "0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"
curve:
name: "Curve Finance"
fee_rate: 0.0004 # 0.04% (for stable pools)
router:
ethereum: "0x99a58482BD75cbab83b27EC03CA68fF489b5788f"
balancer:
name: "Balancer V2"
fee_rate: 0.001 # Varies by pool (0.01% - 10%)
vault:
ethereum: "0xBA12222222228d8Ba445958a75a0704d566BF2C8"
# ─────────────────────────────────────────────────────────────────
# Simulation Parameters
# ─────────────────────────────────────────────────────────────────
# Default parameters for flash loan simulations.
simulation:
# Default market prices (for offline simulation)
eth_price_usd: 2500.0
btc_price_usd: 68000.0
# Default gas settings
gas_price_gwei: 30.0
gas_limit_multiplier: 1.2 # Safety margin
# Slippage settings
default_slippage_percent: 0.5
max_slippage_percent: 3.0
# Request timeout
rpc_timeout_ms: 30000
request_delay_ms: 500 # Between API calls to avoid rate limits
# ─────────────────────────────────────────────────────────────────
# Risk Assessment Parameters
# ─────────────────────────────────────────────────────────────────
# Weights and thresholds for risk scoring.
risk_assessment:
# Factor weights (must sum to 1.0)
weights:
mev_competition: 0.30
execution_risk: 0.25
protocol_risk: 0.15
liquidity_risk: 0.15
profit_margin: 0.15
# Risk thresholds
thresholds:
low: 30
medium: 50
high: 70
# Above 70 = CRITICAL
# Viability mapping
viability:
go_threshold: 30 # Score <= 30 = GO
caution_threshold: 70 # Score <= 70 = CAUTION
# Score > 70 = NO-GO
# ─────────────────────────────────────────────────────────────────
# MEV Protection
# ─────────────────────────────────────────────────────────────────
# Configuration for MEV protection in production.
mev_protection:
flashbots:
enabled: false # Enable for production
relay_url: "https://relay.flashbots.net"
bundle_simulation: true
private_transaction:
enabled: false
providers:
- "flashbots_protect"
- "eden_network"
- "bloxroute"
# ─────────────────────────────────────────────────────────────────
# Output Settings
# ─────────────────────────────────────────────────────────────────
# Configure output format and verbosity.
output:
default_format: "console" # console, json, markdown
console_width: 70
show_warnings: true
show_recommendations: true
verbose: false
# ─────────────────────────────────────────────────────────────────
# Supported Tokens
# ─────────────────────────────────────────────────────────────────
# Token addresses for common assets (Ethereum mainnet).
tokens:
ETH:
symbol: "ETH"
decimals: 18
addresses:
ethereum: "native"
WETH:
symbol: "WETH"
decimals: 18
addresses:
ethereum: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
USDC:
symbol: "USDC"
decimals: 6
addresses:
ethereum: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
USDT:
symbol: "USDT"
decimals: 6
addresses:
ethereum: "0xdAC17F958D2ee523a2206206994597C13D831ec7"
DAI:
symbol: "DAI"
decimals: 18
addresses:
ethereum: "0x6B175474E89094C44Da98b954EescdeCB5AF3696dF"
WBTC:
symbol: "WBTC"
decimals: 8
addresses:
ethereum: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599"
# ─────────────────────────────────────────────────────────────────
# Educational Disclaimer
# ─────────────────────────────────────────────────────────────────
# This configuration is for educational simulation only.
# Flash loan strategies carry significant risks:
# - Smart contract bugs can cause total loss
# - MEV bots compete for the same opportunities
# - Gas costs can exceed profits
# - Protocol exploits may have legal implications
#
# Never deploy unaudited code. Start with testnets.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |