CRITICAL BUG FIX: - MultiHopScanner.updateTokenGraph() was EMPTY - adding no pools! - Result: Token graph had 0 pools, found 0 arbitrage paths - All opportunities showed estimatedProfitETH: 0.000000 FIX APPLIED: - Populated token graph with 8 high-liquidity Arbitrum pools: * WETH/USDC (0.05% and 0.3% fees) * USDC/USDC.e (0.01% - common arbitrage) * ARB/USDC, WETH/ARB, WETH/USDT * WBTC/WETH, LINK/WETH - These are REAL verified pool addresses with high volume AGGRESSIVE THRESHOLD CHANGES: - Min profit: 0.0001 ETH → 0.00001 ETH (10x lower, ~$0.02) - Min ROI: 0.05% → 0.01% (5x lower) - Gas multiplier: 5x → 1.5x (3.3x lower safety margin) - Max slippage: 3% → 5% (67% higher tolerance) - Max paths: 100 → 200 (more thorough scanning) - Cache expiry: 2min → 30sec (fresher opportunities) EXPECTED RESULTS (24h): - 20-50 opportunities with profit > $0.02 (was 0) - 5-15 execution attempts (was 0) - 1-2 successful executions (was 0) - $0.02-$0.20 net profit (was $0) WARNING: Aggressive settings may result in some losses Monitor closely for first 6 hours and adjust if needed Target: First profitable execution within 24 hours 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
228 lines
4.9 KiB
Markdown
228 lines
4.9 KiB
Markdown
# Quick Deployment Guide
|
|
|
|
**TL;DR:** Deploy MEV Bot smart contracts to Arbitrum in 5 minutes.
|
|
|
|
## 🚀 Prerequisites (2 minutes)
|
|
|
|
1. **Install Foundry:**
|
|
```bash
|
|
curl -L https://foundry.paradigm.xyz | bash
|
|
foundryup
|
|
```
|
|
|
|
2. **Get ETH on Arbitrum:**
|
|
- **Testnet:** Get free ETH from [Arbitrum Goerli Faucet](https://faucet.triangleplatform.com/arbitrum/goerli)
|
|
- **Mainnet:** Bridge ETH to Arbitrum (need ~0.01 ETH)
|
|
|
|
3. **Get RPC Endpoint** (optional, but recommended):
|
|
- Free: `https://arb1.arbitrum.io/rpc`
|
|
- Premium: [Alchemy](https://www.alchemy.com/) or [Chainstack](https://chainstack.com/)
|
|
|
|
---
|
|
|
|
## ⚡ Quick Deploy (3 minutes)
|
|
|
|
### Step 1: Configure Environment
|
|
|
|
```bash
|
|
# Copy deployment config template
|
|
cp .env.deployment.example .env.deployment
|
|
|
|
# Edit with your values
|
|
nano .env.deployment
|
|
```
|
|
|
|
**Minimum required:**
|
|
```bash
|
|
DEPLOYER_PRIVATE_KEY="0xYOUR_PRIVATE_KEY"
|
|
ARBITRUM_RPC_ENDPOINT="https://arb1.arbitrum.io/rpc"
|
|
```
|
|
|
|
### Step 2: Load Configuration
|
|
|
|
```bash
|
|
source .env.deployment
|
|
```
|
|
|
|
### Step 3: Deploy!
|
|
|
|
```bash
|
|
./scripts/deploy-contracts.sh
|
|
```
|
|
|
|
That's it! The script will:
|
|
- ✅ Validate your environment
|
|
- ✅ Compile contracts
|
|
- ✅ Deploy both contracts
|
|
- ✅ Update configuration files
|
|
- ✅ Save deployment addresses
|
|
|
|
---
|
|
|
|
## 📋 What Gets Deployed
|
|
|
|
| Contract | Purpose | Gas Cost |
|
|
|----------|---------|----------|
|
|
| **ProductionArbitrageExecutor** | Main arbitrage executor | ~0.003 ETH |
|
|
| **FlashLoanReceiver** | Balancer flash loan integration | ~0.002 ETH |
|
|
|
|
**Total deployment cost:** ~0.005 ETH (~$10-15 at current prices)
|
|
|
|
---
|
|
|
|
## ✅ Post-Deployment
|
|
|
|
After deployment completes:
|
|
|
|
1. **Verify Addresses Updated:**
|
|
```bash
|
|
grep CONTRACT_ARBITRAGE_EXECUTOR .env.production
|
|
# Should show: CONTRACT_ARBITRAGE_EXECUTOR="0x..."
|
|
```
|
|
|
|
2. **Test the Bot:**
|
|
```bash
|
|
./scripts/run.sh
|
|
```
|
|
|
|
3. **Check Logs:**
|
|
```bash
|
|
tail -f logs/mev_bot.log
|
|
# Should show: "Flash swap executor initialized with KeyManager and contract addresses"
|
|
```
|
|
|
|
---
|
|
|
|
## 🧪 Test on Testnet First (Recommended)
|
|
|
|
```bash
|
|
# Set testnet config
|
|
export NETWORK="arbitrum-goerli"
|
|
export ARBITRUM_RPC_ENDPOINT="https://goerli-rollup.arbitrum.io/rpc"
|
|
|
|
# Deploy to testnet
|
|
./scripts/deploy-contracts.sh
|
|
|
|
# Test with bot
|
|
LOG_LEVEL=debug timeout 60 ./bin/mev-beta start
|
|
```
|
|
|
|
---
|
|
|
|
## 🔍 Verify Contracts (Optional)
|
|
|
|
Enable automatic verification:
|
|
```bash
|
|
# Get API key from https://arbiscan.io/myapikey
|
|
export ARBISCAN_API_KEY="YOUR_KEY"
|
|
export VERIFY="true"
|
|
|
|
# Deploy with verification
|
|
./scripts/deploy-contracts.sh
|
|
```
|
|
|
|
Or verify manually after deployment:
|
|
```bash
|
|
./scripts/verify-contracts.sh <contract_address> ProductionArbitrageExecutor
|
|
./scripts/verify-contracts.sh <contract_address> FlashLoanReceiver
|
|
```
|
|
|
|
---
|
|
|
|
## 🆘 Troubleshooting
|
|
|
|
### "insufficient funds for gas"
|
|
```bash
|
|
# Check deployer balance
|
|
cast balance <your_deployer_address> --rpc-url "$ARBITRUM_RPC_ENDPOINT"
|
|
|
|
# Need at least 0.01 ETH
|
|
```
|
|
|
|
### "compilation failed"
|
|
```bash
|
|
# Install dependencies
|
|
forge install OpenZeppelin/openzeppelin-contracts --no-commit
|
|
|
|
# Retry deployment
|
|
./scripts/deploy-contracts.sh
|
|
```
|
|
|
|
### "RPC connection failed"
|
|
```bash
|
|
# Test RPC
|
|
cast client --rpc-url "$ARBITRUM_RPC_ENDPOINT"
|
|
|
|
# Try alternative RPC
|
|
export ARBITRUM_RPC_ENDPOINT="https://arbitrum.llamarpc.com"
|
|
```
|
|
|
|
---
|
|
|
|
## 📝 Deployment Checklist
|
|
|
|
- [ ] Foundry installed (`forge --version`)
|
|
- [ ] Deployer wallet has ETH (>0.01 ETH)
|
|
- [ ] `.env.deployment` configured
|
|
- [ ] Tested on testnet first
|
|
- [ ] Deployment script executed
|
|
- [ ] Both contracts deployed
|
|
- [ ] Addresses saved in `deployments/`
|
|
- [ ] Configuration files updated
|
|
- [ ] Bot tested with new contracts
|
|
|
|
---
|
|
|
|
## 📚 Full Documentation
|
|
|
|
For detailed deployment instructions, see:
|
|
- **[Full Deployment Guide](DEPLOYMENT_GUIDE.md)** - Comprehensive guide
|
|
- **[Deployment Logs](../logs/)** - Check deployment logs
|
|
- **[Contract Source](../contracts/)** - Review contract code
|
|
|
|
---
|
|
|
|
## 🎯 Next Steps
|
|
|
|
After successful deployment:
|
|
|
|
1. **Test Integration:**
|
|
```bash
|
|
LOG_LEVEL=debug timeout 60 ./bin/mev-beta start
|
|
grep "initialized with KeyManager" logs/mev_bot.log
|
|
```
|
|
|
|
2. **Grant Permissions:**
|
|
```bash
|
|
# Grant EXECUTOR_ROLE to your bot wallet
|
|
cast send <arbitrage_contract> "grantRole(bytes32,address)" \
|
|
$(cast keccak "EXECUTOR_ROLE") \
|
|
<bot_wallet_address> \
|
|
--rpc-url "$ARBITRUM_RPC_ENDPOINT" \
|
|
--private-key "$DEPLOYER_PRIVATE_KEY"
|
|
```
|
|
|
|
3. **Start Production Bot:**
|
|
```bash
|
|
./scripts/run.sh
|
|
```
|
|
|
|
4. **Monitor:**
|
|
```bash
|
|
tail -f logs/mev_bot.log
|
|
```
|
|
|
|
---
|
|
|
|
## 💡 Tips
|
|
|
|
- **Use Testnet First:** Always test on Arbitrum Goerli before mainnet
|
|
- **Backup Keys:** Save deployment addresses and private keys securely
|
|
- **Monitor Gas:** Deployment costs ~0.005 ETH on Arbitrum
|
|
- **Verify Contracts:** Verified contracts build trust and allow interaction on Arbiscan
|
|
- **Use Premium RPC:** Free RPCs may have rate limits
|
|
|
|
---
|
|
|
|
**Need help?** Check the [Full Deployment Guide](DEPLOYMENT_GUIDE.md) or review [Troubleshooting](DEPLOYMENT_GUIDE.md#troubleshooting).
|