Files
mev-beta/bin
Gemini Agent 94f241b9aa feat(execution): flash loan arbitrage - ZERO CAPITAL REQUIRED!
GAME CHANGER: Uses Aave V3 flash loans - no capital needed!

## Flash Loan Execution System

### Go Implementation:
- FlashLoanExecutor with Aave V3 integration
- Simulation mode for profitability testing
- Profit calculation after flash loan fees (0.05%)
- Gas cost estimation and limits
- Statistics tracking

### Solidity Contract:
- ArbitrageExecutor using Aave V3 FlashLoanSimpleReceiverBase
- 2-hop arbitrage execution in single transaction
- Emergency withdraw for stuck tokens
- Profit goes to contract owner
- Comprehensive events and error handling

### Main Application:
- Complete MEV bot (cmd/mev-flashloan/main.go)
- Pool discovery -> Arbitrage detection -> Flash loan execution
- Real-time opportunity scanning
- Simulation before execution
- Graceful shutdown with stats

### Documentation:
- README_FLASHLOAN.md: Complete user guide
- contracts/DEPLOY.md: Step-by-step deployment
- Example profitability calculations
- Safety features and risks

## Why Flash Loans?

- **$0 capital required**: Borrow -> Trade -> Repay in ONE transaction
- **0.05% Aave fee**: Much cheaper than holding capital
- **Atomic execution**: Fails = auto-revert, only lose gas
- **Infinite scale**: Trade size limited only by pool liquidity

## Example Trade:
1. Borrow 10 WETH from Aave ($30,000)
2. Swap 10 WETH -> 30,300 USDC (Pool A)
3. Swap 30,300 USDC -> 10.1 WETH (Pool B)
4. Repay 10.005 WETH to Aave (0.05% fee)
5. Profit: 0.095 WETH = $285

Gas cost on Arbitrum: ~$0.05
Net profit: $284.95 per trade
NO CAPITAL NEEDED!

Task: Fast MVP Complete (1 day!)
Files: 3 Go files, 1 Solidity contract, 2 docs
Build: ✓ Compiles successfully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:00:41 -06:00
..
...
2025-11-17 20:45:05 +01:00
...
2025-11-17 20:45:05 +01:00
...
2025-11-17 20:45:05 +01:00
...
2025-11-17 20:45:05 +01:00
...
2025-11-17 20:45:05 +01:00

Foundry Container Wrappers

All Foundry tools MUST run through Podman containers, not bare processes.

Usage

From the /docker/mev-beta directory:

# Cast (RPC calls)
./bin/cast block-number --rpc-url http://localhost:8545
./bin/cast balance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --rpc-url http://localhost:8545

# Forge (build, test, deploy)
./bin/forge build
./bin/forge test
./bin/forge script <script>

# Anvil (runs as persistent container)
# DO NOT run ./bin/anvil directly!
# Anvil runs as: mev-bot-anvil container
podman logs mev-bot-anvil        # View logs
podman restart mev-bot-anvil     # Restart
podman stop mev-bot-anvil        # Stop

Why Container-Only?

Problems with bare processes:

  • No process isolation
  • No automatic restart on failure
  • No resource limits
  • Manual cleanup required
  • Inconsistent with infrastructure

Container benefits:

  • Automatic restart policies
  • Resource limits and quotas
  • Clean shutdown and cleanup
  • Integrated with container stack
  • Version management through image tags

Implementation

  • cast: Runs ephemeral container for each command
  • forge: Runs ephemeral container with workspace volume mount
  • anvil: Runs as persistent container (mev-bot-anvil)

Do NOT Use

/home/administrator/.foundry/bin/anvil /home/administrator/.foundry/bin/cast /home/administrator/.foundry/bin/forge

/docker/mev-beta/bin/cast (Podman wrapper) /docker/mev-beta/bin/forge (Podman wrapper) podman logs mev-bot-anvil (Container management)