A sophisticated, Maximum Extractable Value (MEV) bot designed for multi-chain arbitrage, front-running, advanced DeFi strategies - utilizing Flashloans via Aave V3. Built with enterprise-grade architecture, comprehensive safety mechanisms, and real-time market analysis.
├── src/on1builder/
│ ├── core/ # Core orchestration and chain management
│ │ ├── main_orchestrator.py # Main application controller
│ │ ├── multi_chain_orchestrator.py # Cross-chain coordination
│ │ ├── chain_worker.py # Per-chain operation handler
│ │ ├── transaction_manager.py # Transaction execution
│ │ └── balance_manager.py # Portfolio management
│ ├── engines/ # Strategy execution engines
│ │ ├── strategy_executor.py # MEV strategy implementation
│ │ └── safety_guard.py # Risk management
│ ├── monitoring/ # Market data and transaction monitoring
│ │ ├── market_data_feed.py # Price feeds and market analysis
│ │ └── txpool_scanner.py # Mempool monitoring
│ ├── integrations/ # External service integrations
│ │ ├── external_apis.py # API managers (CoinGecko, etc.)
│ │ └── abi_registry.py # Smart contract interfaces
│ ├── utils/ # Utilities and helpers
│ │ ├── gas_optimizer.py # Gas price optimization
│ │ ├── profit_calculator.py # P&L calculation
│ │ └── notification_service.py # Alert system
│ ├── config/ # Configuration management
│ └── persistence/ # Data storage layer
git clone https://github.com/yourusername/ON1Builder.git
cd ON1Builder
python -m venv .venv
source .venv/bin/activate
# On Windows: .venv\Scripts\activate
pip install -r requirements.txt
# Copy example configuration
cp .env.example .env
# Edit configuration file
nano .env # Or use your favorite text editor
Create a .env
file in the project root with the following configuration:
# Wallet Configuration
WALLET_KEY=0xYourPrivateKeyHere
WALLET_ADDRESS=0xYourWalletAddressHere
PROFIT_RECEIVER_ADDRESS=0xOptionalSeparateProfitAddress
# Blockchain Configuration
CHAINS=1,137,42161 # Ethereum, Polygon, Arbitrum
POA_CHAINS=137 # Proof of Authority chains
# RPC Endpoints (replace with your node endpoint(s)
RPC_URL_1=127.0.0.1:8545
RPC_URL_137=127.0.0.1:8546
RPC_URL_42161=127.0.0.1:8547
# WebSocket Endpoints (optional, for real-time data)
WEBSOCKET_URL_1=wss://127.0.0.1:8545
# Strategy Configuration (Adjust as needed)
MIN_PROFIT_ETH=0.005
MIN_PROFIT_PERCENTAGE=0.1
SLIPPAGE_TOLERANCE=0.5
MAX_GAS_PRICE_GWEI=200
# Flash Loan Settings (AAVE V3, optional)
FLASHLOAN_ENABLED=true
FLASHLOAN_MAX_AMOUNT_ETH=1000.0
FLASHLOAN_BUFFER_PERCENTAGE=0.1
# Risk Management
MAX_POSITION_SIZE_PERCENT=20.0
DAILY_LOSS_LIMIT_PERCENT=5.0
EMERGENCY_BALANCE_THRESHOLD=0.01
# API Keys (optional)
ETHERSCAN_API_KEY=your_etherscan_api_key
COINGECKO_API_KEY=your_coingecko_api_key
COINMARKETCAP_API_KEY=your_coinmarketcap_api_key
CRYPTOCOMPARE_API_KEY=your_cryptocompare_api_key
BINANCE_API_KEY=your_binance_api_key # Optional for additional market data
INFURA_PROJECT_ID=your_infura_project_id
# Notifications (optional)
NOTIFICATION_CHANNELS=slack,telegram
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
# Database
DATABASE_URL=sqlite+aiosqlite:///on1builder_data.db
Configure DEX router addresses in your .env
:
# Uniswap V2 Router addresses per chain
UNISWAP_V2_ROUTER_ADDRESSES={"1":"0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D","137":"0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff"}
# Sushiswap Router addresses
SUSHISWAP_ROUTER_ADDRESSES={"1":"0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F","137":"0x1b02dA8Cb0d097eB8D57A175b88c7D8b47997506"}
# Aave V3 Pool addresses for flash loans
AAVE_V3_POOL_ADDRESSES={"1":"0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2","137":"0x794a61358D6845594F94dc1DB02A252b5b4814aD"}
# Start the MEV bot
python -m on1builder
# Or using the main module
python src/on1builder/__main__.py
# Run with debug logging
DEBUG=true python -m on1builder
# Run specific strategies only
MEV_STRATEGIES_ENABLED=true FRONT_RUNNING_ENABLED=false python -m on1builder
# Run in dry-run mode (no actual transactions)
DRY_RUN=true python -m on1builder
# Check configuration
python -m on1builder config check
# Monitor current status
python -m on1builder status
# View recent performance
python -m on1builder status --detailed
# Run all tests
python -m pytest tests/
# Run with coverage
python -m pytest tests/ --cov=on1builder
# Run specific test categories
python -m pytest tests/test_core/ -v
# Format code
black src/ tests/
# Type checking
mypy src/
# Linting
flake8 src/ tests/
# Install development dependencies
pip install -r requirements-dev.txt
# Install pre-commit hooks
pre-commit install
# Run pre-commit checks
pre-commit run --all-files
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
git checkout -b feature/amazing-feature
)python -m pytest
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)Important Legal and Financial Disclaimers:
This project is licensed under the MIT License - see the LICENSE file for details.
For enterprise deployments and custom development:
IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You should always do your own research and understand the risks involved in trading and using MEV bots. This software is provided “as is” without any warranties or guarantees of any kind.
Built with ❤️ by the ON1Builder team