feat(core): implement core MEV bot functionality with market scanning and Uniswap V3 pricing

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Krypto Kajun
2025-09-14 10:16:29 -05:00
parent 5db7587923
commit c16182d80c
1364 changed files with 473970 additions and 1202 deletions

View File

@@ -5,10 +5,10 @@ import (
"testing"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/fraktal/mev-beta/internal/logger"
"github.com/fraktal/mev-beta/pkg/arbitrum"
"github.com/fraktal/mev-beta/test/mocks"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -57,7 +57,7 @@ func TestL2MessageParsingAccuracy(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
// Create mock transaction with DEX interaction
poolAddress := common.HexToAddress("0xE592427A0AEce92De3Edee1F18E0157C05861564") // Uniswap V3 Router
// Create mock transaction data for swap
swapData := createMockSwapData(tc.expectedTokens[0], tc.expectedTokens[1], tc.expectedFee)
tx := mocks.CreateMockTransaction(poolAddress, swapData)
@@ -93,16 +93,16 @@ func TestL2MessageLatency(t *testing.T) {
for i := 0; i < numMessages; i++ {
// Create L2 message
l2Message := mocks.CreateMockL2Message()
// Measure parsing time
startTime := time.Now()
if l2Message.ParsedTx != nil {
_, err := parser.ParseDEXInteraction(l2Message.ParsedTx)
// Error is expected for mock data, just measure timing
_ = err
}
latency := time.Since(startTime)
latencyMs := latency.Nanoseconds() / 1000000
@@ -118,7 +118,7 @@ func TestMultiProtocolDetection(t *testing.T) {
parser := arbitrum.NewL2MessageParser(log)
protocols := []string{"UniswapV3", "SushiSwap", "Camelot", "Balancer", "Curve"}
for _, protocol := range protocols {
t.Run(protocol, func(t *testing.T) {
// Create mock transaction for each protocol