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:
15
pkg/cache/pool_cache.go
vendored
15
pkg/cache/pool_cache.go
vendored
@@ -112,6 +112,21 @@ func (c *poolCache) GetByLiquidity(ctx context.Context, minLiquidity *big.Int, l
|
||||
return pools, nil
|
||||
}
|
||||
|
||||
// GetPoolsByToken retrieves all pools containing a specific token
|
||||
func (c *poolCache) GetPoolsByToken(ctx context.Context, token common.Address) ([]*types.PoolInfo, error) {
|
||||
c.mu.RLock()
|
||||
defer c.mu.RUnlock()
|
||||
|
||||
var pools []*types.PoolInfo
|
||||
for _, pool := range c.byAddress {
|
||||
if pool.Token0 == token || pool.Token1 == token {
|
||||
pools = append(pools, pool)
|
||||
}
|
||||
}
|
||||
|
||||
return pools, nil
|
||||
}
|
||||
|
||||
// Add adds or updates a pool in the cache
|
||||
func (c *poolCache) Add(ctx context.Context, pool *types.PoolInfo) error {
|
||||
if pool == nil {
|
||||
|
||||
Reference in New Issue
Block a user