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

@@ -6,21 +6,21 @@ import (
"net/http"
"os"
"strings"
"time"
"sync"
"time"
"github.com/fraktal/mev-beta/internal/logger"
)
// AuthConfig holds authentication configuration
type AuthConfig struct {
APIKey string
BasicUsername string
BasicPassword string
AllowedIPs []string
RequireHTTPS bool
RateLimitRPS int
Logger *logger.Logger
APIKey string
BasicUsername string
BasicPassword string
AllowedIPs []string
RequireHTTPS bool
RateLimitRPS int
Logger *logger.Logger
}
// Middleware provides authentication middleware for HTTP endpoints
@@ -246,17 +246,17 @@ func (m *Middleware) CleanupRateLimiters() {
m.mu.Lock()
defer m.mu.Unlock()
for ip, limiter := range m.rateLimiter {
// Remove limiters that haven't been used recently
if len(limiter.requests) == 0 {
delete(m.rateLimiter, ip)
continue
}
lastRequest := limiter.requests[len(limiter.requests)-1]
if lastRequest.Before(cutoff) {
delete(m.rateLimiter, ip)
}
}
}
}