From e9c24a65e51ffa94ed8a09acf2022195a2423598 Mon Sep 17 00:00:00 2001 From: Administrator Date: Mon, 10 Nov 2025 18:56:15 +0100 Subject: [PATCH] fix(pools): correct CallContract API usage in pool discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update go.mod to Go 1.21 (from invalid 1.25) - Add missing dependencies: gorilla/websocket, stretchr/testify - Fix CallContract calls to use ethereum.CallMsg instead of map - Import ethereum package for CallMsg type These fixes resolve compilation errors in the pool discovery service that would prevent the application from building. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- go.mod | 5 +++-- pkg/pools/discovery.go | 27 ++++++++++++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 6f3b3f6..5c81377 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,12 @@ module github.com/your-org/mev-bot -go 1.25 +go 1.21 require ( github.com/ethereum/go-ethereum v1.13.15 + github.com/gorilla/websocket v1.5.3 github.com/prometheus/client_golang v1.20.5 + github.com/stretchr/testify v1.8.4 ) require ( @@ -14,7 +16,6 @@ require ( github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/go-stack/stack v1.8.1 // indirect - github.com/gorilla/websocket v1.5.3 // indirect github.com/holiman/uint256 v1.3.1 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect diff --git a/pkg/pools/discovery.go b/pkg/pools/discovery.go index 5d1167b..8035081 100644 --- a/pkg/pools/discovery.go +++ b/pkg/pools/discovery.go @@ -7,7 +7,7 @@ import ( "math/big" "sync" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" @@ -202,9 +202,9 @@ func (d *Discovery) getUniswapV2Pool(ctx context.Context, factory common.Address calldata := append([]byte{0xe6, 0xa4, 0x39, 0x05}, // getPair selector append(padLeft(token0.Bytes(), 32), padLeft(token1.Bytes(), 32)...)...) - result, err := d.client.CallContract(ctx, map[string]interface{}{ - "to": factory, - "data": common.Bytes2Hex(calldata), + result, err := d.client.CallContract(ctx, ethereum.CallMsg{ + To: &factory, + Data: calldata, }, nil) if err != nil { return common.Address{}, err @@ -223,9 +223,9 @@ func (d *Discovery) fetchUniswapV2PoolInfo(ctx context.Context, poolAddr, token0 // Simplified - in production use generated bindings calldata := []byte{0x09, 0x02, 0xf1, 0xac} // getReserves selector - result, err := d.client.CallContract(ctx, map[string]interface{}{ - "to": poolAddr, - "data": common.Bytes2Hex(calldata), + result, err := d.client.CallContract(ctx, ethereum.CallMsg{ + To: &poolAddr, + Data: calldata, }, nil) if err != nil { return nil, err @@ -328,9 +328,10 @@ func (d *Discovery) getUniswapV3Pool(ctx context.Context, token0, token1 common. calldata := append([]byte{0x17, 0x79, 0x05, 0x7a}, // getPool selector append(append(padLeft(token0.Bytes(), 32), padLeft(token1.Bytes(), 32)...), feeBytes...)...) - result, err := d.client.CallContract(ctx, map[string]interface{}{ - "to": UniswapV3FactoryAddress, - "data": common.Bytes2Hex(calldata), + factoryAddr := UniswapV3FactoryAddress + result, err := d.client.CallContract(ctx, ethereum.CallMsg{ + To: &factoryAddr, + Data: calldata, }, nil) if err != nil { return common.Address{}, err @@ -349,9 +350,9 @@ func (d *Discovery) fetchUniswapV3PoolInfo(ctx context.Context, poolAddr, token0 // Simplified - in production use generated bindings calldata := []byte{0x1a, 0x68, 0x65, 0x02} // liquidity selector - result, err := d.client.CallContract(ctx, map[string]interface{}{ - "to": poolAddr, - "data": common.Bytes2Hex(calldata), + result, err := d.client.CallContract(ctx, ethereum.CallMsg{ + To: &poolAddr, + Data: calldata, }, nil) if err != nil { return nil, err