- Added comprehensive bounds checking to prevent buffer overruns in multicall parsing - Implemented graduated validation system (Strict/Moderate/Permissive) to reduce false positives - Added LRU caching system for address validation with 10-minute TTL - Enhanced ABI decoder with missing Universal Router and Arbitrum-specific DEX signatures - Fixed duplicate function declarations and import conflicts across multiple files - Added error recovery mechanisms with multiple fallback strategies - Updated tests to handle new validation behavior for suspicious addresses - Fixed parser test expectations for improved validation system - Applied gofmt formatting fixes to ensure code style compliance - Fixed mutex copying issues in monitoring package by introducing MetricsSnapshot - Resolved critical security vulnerabilities in heuristic address extraction - Progress: Updated TODO audit from 10% to 35% complete 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package scanner
|
|
|
|
import (
|
|
"github.com/fraktal/mev-beta/internal/config"
|
|
"github.com/fraktal/mev-beta/internal/logger"
|
|
"github.com/fraktal/mev-beta/pkg/contracts"
|
|
"github.com/fraktal/mev-beta/pkg/database"
|
|
)
|
|
|
|
// NewMarketScanner provides a backwards-compatible constructor that accepts
|
|
// optional dependencies in the order (contract executor, database, ...).
|
|
// It falls back to sane defaults when values are omitted so legacy tests and
|
|
// tooling can continue to compile against the public API while more advanced
|
|
// callers should use NewScanner directly for full control.
|
|
func NewMarketScanner(
|
|
cfg *config.BotConfig,
|
|
log *logger.Logger,
|
|
extras ...interface{},
|
|
) *Scanner {
|
|
var contractExecutor *contracts.ContractExecutor
|
|
var db *database.Database
|
|
|
|
if len(extras) > 0 {
|
|
if v, ok := extras[0].(*contracts.ContractExecutor); ok {
|
|
contractExecutor = v
|
|
}
|
|
}
|
|
|
|
if len(extras) > 1 {
|
|
if v, ok := extras[1].(*database.Database); ok {
|
|
db = v
|
|
}
|
|
}
|
|
|
|
// Additional parameters beyond the database are currently ignored but
|
|
// accepted to keep existing call sites compiling during the migration.
|
|
|
|
return NewScanner(cfg, log, contractExecutor, db)
|
|
}
|