1.5 KiB
1.5 KiB
Monitoring System Documentation
This document explains how the MEV bot monitors the Arbitrum sequencer for potential swap transactions.
Overview
The monitoring system connects to an Arbitrum RPC endpoint and continuously monitors for new blocks and transactions. It identifies potential swap transactions and forwards them to the market scanner for analysis.
Components
ArbitrumMonitor
The main monitoring component that handles:
- Connecting to the Arbitrum RPC endpoint
- Polling for new blocks
- Processing transactions in new blocks
- Identifying potential swap transactions
Transaction Processing
Each transaction is analyzed to determine if it's a potential swap:
- Check if the transaction is calling a known DEX contract
- Decode the transaction data to extract swap parameters
- Extract token addresses and amounts
- Calculate potential price impact
Configuration
The monitoring system is configured through config/config.yaml:
arbitrum.rpc_endpoint: The RPC endpoint to connect tobot.polling_interval: How often to check for new blocksarbitrum.chain_id: The chain ID to ensure we're on the correct network
Implementation Details
The monitor uses the go-ethereum library to interact with the Arbitrum network. It implements efficient polling to minimize RPC calls while ensuring timely detection of new blocks.
Key features:
- Graceful error handling and reconnection
- Configurable polling intervals
- Transaction sender identification
- Support for both RPC and WebSocket endpoints