fix(compilation): resolve type system and interface errors
- Add GetPoolsByToken method to cache interface and implementation - Fix interface pointer types (use interface not *interface) - Fix SwapEvent.TokenIn/TokenOut usage to use GetInputToken/GetOutputToken methods - Fix ethereum.CallMsg import and usage - Fix parser factory and validator initialization in main.go - Remove unused variables and imports WIP: Still fixing main.go config struct field mismatches 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@ package sequencer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"math/big"
|
||||
@@ -66,9 +65,9 @@ type Reader struct {
|
||||
logger *slog.Logger
|
||||
|
||||
// Components
|
||||
parsers *parsers.Factory
|
||||
validator *validation.Validator
|
||||
poolCache *cache.PoolCache
|
||||
parsers parsers.Factory
|
||||
validator validation.Validator
|
||||
poolCache cache.PoolCache
|
||||
detector *arbitrage.Detector
|
||||
executor *execution.Executor
|
||||
|
||||
@@ -104,9 +103,9 @@ type Reader struct {
|
||||
// NewReader creates a new sequencer reader
|
||||
func NewReader(
|
||||
config *ReaderConfig,
|
||||
parsers *parsers.Factory,
|
||||
validator *validation.Validator,
|
||||
poolCache *cache.PoolCache,
|
||||
parsers parsers.Factory,
|
||||
validator validation.Validator,
|
||||
poolCache cache.PoolCache,
|
||||
detector *arbitrage.Detector,
|
||||
executor *execution.Executor,
|
||||
logger *slog.Logger,
|
||||
@@ -333,8 +332,8 @@ func (r *Reader) processTxHash(ctx context.Context, txHash string) error {
|
||||
|
||||
parseStart := time.Now()
|
||||
|
||||
// Parse transaction events
|
||||
events, err := r.parsers.ParseTransaction(tx)
|
||||
// Parse transaction events (no receipt for pending transactions)
|
||||
events, err := r.parsers.ParseTransaction(procCtx, tx, nil)
|
||||
if err != nil {
|
||||
r.parseErrors++
|
||||
return fmt.Errorf("parse failed: %w", err)
|
||||
@@ -347,7 +346,7 @@ func (r *Reader) processTxHash(ctx context.Context, txHash string) error {
|
||||
r.avgParseLatency = time.Since(parseStart)
|
||||
|
||||
// Validate events
|
||||
validEvents := r.validator.FilterValid(events)
|
||||
validEvents := r.validator.FilterValid(procCtx, events)
|
||||
if len(validEvents) == 0 {
|
||||
r.validationErrors++
|
||||
return nil
|
||||
@@ -358,7 +357,7 @@ func (r *Reader) processTxHash(ctx context.Context, txHash string) error {
|
||||
// Detect arbitrage opportunities for each swap
|
||||
for _, event := range validEvents {
|
||||
// Get input token from the swap
|
||||
inputToken := event.GetInputToken()
|
||||
inputToken, _ := event.GetInputToken()
|
||||
|
||||
// Detect opportunities starting with this token
|
||||
opportunities, err := r.detector.DetectOpportunities(procCtx, inputToken)
|
||||
|
||||
Reference in New Issue
Block a user