# 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 ProductionArbitrageExecutor ./scripts/verify-contracts.sh FlashLoanReceiver ``` --- ## ๐Ÿ†˜ Troubleshooting ### "insufficient funds for gas" ```bash # Check deployer balance cast balance --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 "grantRole(bytes32,address)" \ $(cast keccak "EXECUTOR_ROLE") \ \ --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).