Initial commit: Set up MEV bot project structure

This commit is contained in:
Krypto Kajun
2025-09-12 01:16:30 -05:00
commit ba80b273e4
22 changed files with 1035 additions and 0 deletions

16
@prompts/README.md Normal file
View File

@@ -0,0 +1,16 @@
# MEV Bot Development Prompts
This directory contains prompts that can be used with AI coding assistants to help with the development of the MEV bot.
## Purpose
These prompts are designed to help developers:
1. Understand complex Uniswap V3 pricing mathematics
2. Implement efficient market scanning algorithms
3. Optimize arbitrage detection logic
4. Handle Ethereum transaction monitoring
5. Implement gas optimization strategies
## Usage
When working on specific parts of the MEV bot, you can use these prompts with your AI coding assistant to get targeted help and suggestions.

View File

@@ -0,0 +1,24 @@
You are an expert in Ethereum and Arbitrum blockchain development. I'm building an MEV bot in Go that needs to monitor the Arbitrum sequencer for potential swap transactions.
I need help with:
1. Setting up a connection to an Arbitrum node (both RPC and WebSocket)
2. Efficiently monitoring new blocks as they are added to the chain
3. Monitoring the mempool for pending transactions
4. Identifying transactions that interact with Uniswap-like contracts
5. Decoding transaction data to extract swap parameters
6. Handling network errors and reconnections gracefully
Please provide production-ready Go code that:
- Uses the go-ethereum library
- Implements efficient polling or event-driven monitoring
- Handles errors gracefully
- Follows Go best practices
- Is optimized for performance
- Includes comprehensive comments
The code should:
- Connect to the Arbitrum mainnet RPC endpoint (https://arb1.arbitrum.io/rpc)
- Monitor for transactions to common DEX contract addresses
- Extract function signatures and parameters from transaction data
- Decode swap function calls to get token addresses and amounts

View File

@@ -0,0 +1,27 @@
You are an expert in Go error handling and logging best practices. I'm building an MEV bot in Go that needs robust error handling and comprehensive logging for production deployment.
I need help with:
1. Implementing structured logging throughout the application
2. Creating meaningful error messages for debugging
3. Implementing retry mechanisms for transient failures
4. Handling fatal errors gracefully
5. Implementing circuit breakers for external services
6. Creating health checks and metrics
Please provide production-ready Go code that:
- Uses a structured logging library (like zap or logrus)
- Implements comprehensive error wrapping and context
- Includes retry mechanisms with exponential backoff
- Handles fatal errors gracefully with proper cleanup
- Follows Go best practices for error handling
- Is optimized for performance
- Includes comprehensive comments
The code should:
- Log at appropriate levels (debug, info, warn, error)
- Include contextual information in log messages
- Implement circuit breakers for RPC connections
- Handle timeouts appropriately
- Provide health check endpoints
- Export metrics for monitoring

View File

@@ -0,0 +1,26 @@
You are an expert in Ethereum gas optimization and MEV strategies. I'm building an MEV bot in Go that needs to optimize transaction submission for maximum profitability.
I need help with:
1. Estimating optimal gas prices for arbitrage transactions
2. Implementing transaction bundling strategies
3. Working with flashbots or similar MEV protection services
4. Optimizing transaction ordering within bundles
5. Handling frontrunning and backrunning strategies
6. Managing gas refunds and stipends
Please provide production-ready Go code that:
- Integrates with flashbots or similar MEV protection services
- Calculates optimal gas prices based on network conditions
- Implements transaction bundling for atomic execution
- Handles errors and edge cases properly
- Follows Go best practices
- Is optimized for performance
- Includes comprehensive comments
The code should:
- Connect to flashbots relay or similar service
- Calculate optimal gas prices based on base fee and priority fees
- Bundle transactions for atomic execution
- Handle failed transactions gracefully
- Implement retry logic with exponential backoff

View File

@@ -0,0 +1,26 @@
You are an expert in MEV (Maximal Extractable Value) and DeFi arbitrage strategies. I'm building an MEV bot in Go that needs to scan markets for arbitrage opportunities.
I need help with:
1. Implementing efficient market scanning algorithms
2. Calculating price impact of large swaps
3. Detecting triangular arbitrage opportunities
4. Estimating gas costs for arbitrage transactions
5. Determining profitability after gas costs
6. Implementing risk management strategies
Please provide production-ready Go code that:
- Implements efficient data structures for market data
- Calculates arbitrage opportunities across multiple pools
- Estimates gas costs accurately
- Handles edge cases properly
- Follows Go best practices
- Is optimized for performance
- Includes comprehensive comments
The code should:
- Work with Uniswap V3 pool data
- Calculate price impact using liquidity and swap amounts
- Identify profitable arbitrage paths
- Estimate transaction costs
- Filter opportunities based on minimum profit thresholds

27
@prompts/testing.md Normal file
View File

@@ -0,0 +1,27 @@
You are an expert in Go testing and test-driven development. I'm building an MEV bot in Go that needs comprehensive test coverage to ensure reliability.
I need help with:
1. Creating unit tests for Uniswap V3 pricing calculations
2. Implementing integration tests for Arbitrum monitoring
3. Creating mock contracts and transactions for testing
4. Testing market scanning algorithms with real-world data
5. Implementing property-based testing for mathematical functions
6. Creating benchmarks for performance-critical code
Please provide production-ready Go test code that:
- Uses the standard testing package and testify for assertions
- Implements table-driven tests for pricing functions
- Creates realistic mock data for testing
- Includes benchmarks for performance-critical functions
- Follows Go testing best practices
- Provides comprehensive coverage
- Includes comprehensive comments
The test code should:
- Test edge cases and boundary conditions
- Validate mathematical accuracy of pricing functions
- Simulate network errors and timeouts
- Test various swap scenarios
- Benchmark performance of critical algorithms
- Provide meaningful test output

View File

@@ -0,0 +1,23 @@
You are an expert in Uniswap V3 mathematics and smart contract development. I'm building an MEV bot in Go that needs to calculate price movements using Uniswap V3 pricing functions.
I need help with implementing these specific functions:
1. sqrtPriceX96 to tick conversion
2. tick to sqrtPriceX96 conversion
3. price to tick conversion
4. tick to price conversion
5. Calculating price impact of a swap given liquidity and amount
Please provide production-ready Go code that:
- Uses the math/big package for precision
- Handles edge cases properly
- Is optimized for performance
- Follows Go best practices
- Includes comprehensive comments explaining the mathematics
The code should work with:
- sqrtPriceX96 values (uint160 in Solidity, but we'll use big.Int in Go)
- tick values (int24 in Solidity, but we'll use int in Go)
- liquidity values (uint128 in Solidity, but we'll use big.Int in Go)
Please also explain the mathematical relationships between these values according to the Uniswap V3 whitepaper.