- 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>
45 lines
1.5 KiB
Go
45 lines
1.5 KiB
Go
// Package cache defines the pool cache interface for multi-index lookups
|
|
package cache
|
|
|
|
import (
|
|
"context"
|
|
"math/big"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/your-org/mev-bot/pkg/types"
|
|
)
|
|
|
|
// PoolCache defines the interface for multi-index pool cache
|
|
type PoolCache interface {
|
|
// GetByAddress retrieves a pool by its contract address
|
|
GetByAddress(ctx context.Context, address common.Address) (*types.PoolInfo, error)
|
|
|
|
// GetByTokenPair retrieves all pools for a given token pair
|
|
GetByTokenPair(ctx context.Context, token0, token1 common.Address) ([]*types.PoolInfo, error)
|
|
|
|
// GetByProtocol retrieves all pools for a given protocol
|
|
GetByProtocol(ctx context.Context, protocol types.ProtocolType) ([]*types.PoolInfo, error)
|
|
|
|
// GetByLiquidity retrieves pools sorted by liquidity (descending)
|
|
GetByLiquidity(ctx context.Context, minLiquidity *big.Int, limit int) ([]*types.PoolInfo, error)
|
|
|
|
// GetPoolsByToken retrieves all pools containing a specific token
|
|
GetPoolsByToken(ctx context.Context, token common.Address) ([]*types.PoolInfo, error)
|
|
|
|
// Add adds or updates a pool in the cache
|
|
Add(ctx context.Context, pool *types.PoolInfo) error
|
|
|
|
// Update updates pool information
|
|
Update(ctx context.Context, address common.Address, updateFn func(*types.PoolInfo) error) error
|
|
|
|
// Remove removes a pool from the cache
|
|
Remove(ctx context.Context, address common.Address) error
|
|
|
|
// Count returns the total number of pools in the cache
|
|
Count(ctx context.Context) (int, error)
|
|
|
|
// Clear removes all pools from the cache
|
|
Clear(ctx context.Context) error
|
|
}
|