How fuzzland/sui-mev works
Main Components
• Arbitrage Bot Service: Represented by the bin/arb package. This is the core module that collects, analyzes, and executes arbitrage strategies. The source files indicate components such as collectors, various protocol-specific modules (under src/defi), configuration management, strategy modules, execution logic, and pool identification.
• Relay Service: The bin/relay package. This service acts as an intermediary: it accepts mempool transactions pushed by validators and forwards them to the bot.
• Dex Indexer: A separate crate (crates/dex-indexer) that aggregates data about DEX pool data from various supported protocols. It also preprocesses and stores pool data and protocol-specific information that the arbitrage bot uses.
• Shared Libraries: Crates like arb-common, logger, object-pool, shio, simulator, utils, and version provide common functionality for logging, performance, connections, simulations, and utility functions.
• External Sui Network Components:
• Sui Nodes: External nodes of the Sui blockchain are key to obtaining mempool information, blockchain state, and submitting transactions.
Relationships and Interactions
• The Arbitrage Bot (bin/arb) communicates internally with its strategy, executor, and collector modules to gather market data, analyze arbitrage opportunities, and send transaction requests.
• Simultaneously, it relies on the DEX Indexer to fetch and update pool states across multiple protocols, ensuring it always has up-to-date data.
• The Relay Service (bin/relay) connects externally with validators or Sui nodes. Validators push mempool transactions to this component, which then routes the transaction information to the Arbitrage Bot for further action.
• Underpinning all these modules, shared libraries (e.g., arb-common, logger, utils) provide cross-cutting concerns such as logging, configuration, and utility functions.
• Most importantly—the connection to Sui Nodes should be explicitly represented. This connection is shown as a bidirectional (or directional) link between the external Sui network (nodes and validators) and both the Relay Service and the Arbitrage Bot. This indicates that the system is actively monitoring the network (i.e., mempool data or contract state) via Sui nodes for opportunities and eventually sending transactions back to the network.
Architectural Patterns & Design Principles
• Modular and Layered Architecture: Separation into distinct binaries and shared crates supports modularity.
• Data Flow Driven by External Events: The mempool transaction flow starts at Sui nodes (via validators) then to the Relay Service and finally integrated within the arbitrage bot’s decision engine.