diff --git a/go.mod b/go.mod index c2b78d056..66c8f511c 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.20 require ( github.com/KyberNetwork/blockchain-toolkit v0.2.0 github.com/KyberNetwork/elastic-go-sdk/v2 v2.0.2 - github.com/KyberNetwork/ethrpc v0.3.0 + github.com/KyberNetwork/ethrpc v0.4.0 github.com/KyberNetwork/logger v0.1.0 github.com/KyberNetwork/pancake-v3-sdk v0.1.0 github.com/daoleno/uniswap-sdk-core v0.1.7 diff --git a/go.sum b/go.sum index 0fce97966..945d5d5ce 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ github.com/KyberNetwork/elastic-go-sdk/v2 v2.0.2 h1:kN7ez6MPJEaFbacmvR+22PRa5pJk github.com/KyberNetwork/elastic-go-sdk/v2 v2.0.2/go.mod h1:3DThBH6zHAYSWUVmtj9deQO1XuiwbawdKxj5yV4SuMo= github.com/KyberNetwork/ethrpc v0.3.0 h1:LoqtmSR4ABgsCvSc+qPUbPibPhVZpd12YQLbMGAyVWk= github.com/KyberNetwork/ethrpc v0.3.0/go.mod h1:QOlJ7bWKIVlo3ZfJt3cmyc5oke9uU+4hl9Vth5IHK/Y= +github.com/KyberNetwork/ethrpc v0.4.0 h1:ghG8s8D/V9fWAQMnTicIDUv0I6VFDSqN3T6kbE9No6c= +github.com/KyberNetwork/ethrpc v0.4.0/go.mod h1:QOlJ7bWKIVlo3ZfJt3cmyc5oke9uU+4hl9Vth5IHK/Y= github.com/KyberNetwork/logger v0.1.0 h1:Iibu9Ls+tipjR+C0iXhzUYM1VtRgmmR1HHWGufPYcbs= github.com/KyberNetwork/logger v0.1.0/go.mod h1:zBqHbtJ3nJn6HQnp6UW8pbQkR+U6tSRFd5CzfiKL3Kw= github.com/KyberNetwork/pancake-v3-sdk v0.1.0 h1:HVUD13Qbwl4kiU1uSprQVpkis6fYYp3A32mVuK+f1Iw= @@ -114,6 +116,7 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= diff --git a/pkg/source/algebrav1/pool_tracker.go b/pkg/source/algebrav1/pool_tracker.go index 98764a6c0..3f23f1d8b 100644 --- a/pkg/source/algebrav1/pool_tracker.go +++ b/pkg/source/algebrav1/pool_tracker.go @@ -15,6 +15,7 @@ import ( "github.com/sourcegraph/conc/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/bignumber" graphqlPkg "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/graphql" ) @@ -38,7 +39,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ sourcePool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[%v] Start getting new state of pool: %v", d.config.DexID, p.Address) var ( diff --git a/pkg/source/balancer-composable-stable/pool_tracker.go b/pkg/source/balancer-composable-stable/pool_tracker.go index 3441e0e21..38af95bec 100644 --- a/pkg/source/balancer-composable-stable/pool_tracker.go +++ b/pkg/source/balancer-composable-stable/pool_tracker.go @@ -13,6 +13,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/valueobject" ) @@ -28,7 +29,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "poolAddress": p.Address, }).Infof("[Balancer-Composable-Stable] Start updating state ...") diff --git a/pkg/source/balancer/pool_tracker.go b/pkg/source/balancer/pool_tracker.go index 9b2a866a2..7f968f8fa 100644 --- a/pkg/source/balancer/pool_tracker.go +++ b/pkg/source/balancer/pool_tracker.go @@ -13,6 +13,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -27,7 +28,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "poolAddress": p.Address, }).Infof("[Balancer] Start updating state ...") diff --git a/pkg/source/biswap/pool_tracker.go b/pkg/source/biswap/pool_tracker.go index 6ccfc3729..c71126f40 100644 --- a/pkg/source/biswap/pool_tracker.go +++ b/pkg/source/biswap/pool_tracker.go @@ -8,6 +8,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -25,7 +26,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "poolAddress": p.Address, }).Infof("[%s] Start getting new state of pool", d.config.DexID) diff --git a/pkg/source/camelot/pool_tracker.go b/pkg/source/camelot/pool_tracker.go index 7e4007c75..53b24dd25 100644 --- a/pkg/source/camelot/pool_tracker.go +++ b/pkg/source/camelot/pool_tracker.go @@ -11,6 +11,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/timer" ) @@ -26,7 +27,11 @@ func NewPoolTracker(cfg *Config, ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { finish := timer.Start(fmt.Sprintf("[%s] get new pool state", d.cfg.DexID)) defer finish() diff --git a/pkg/source/curve/pool_tracker.go b/pkg/source/curve/pool_tracker.go index 23a53bd61..285fa18ec 100644 --- a/pkg/source/curve/pool_tracker.go +++ b/pkg/source/curve/pool_tracker.go @@ -8,6 +8,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -34,6 +35,7 @@ func NewPoolTracker( func (d *PoolTracker) GetNewPoolState( ctx context.Context, p entity.Pool, + _ pool.GetNewPoolStateParams, ) (entity.Pool, error) { switch p.Type { case poolTypeBase: diff --git a/pkg/source/dmm/pool_tracker.go b/pkg/source/dmm/pool_tracker.go index f9ef41f94..dfb59b61b 100644 --- a/pkg/source/dmm/pool_tracker.go +++ b/pkg/source/dmm/pool_tracker.go @@ -9,6 +9,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -23,7 +24,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "poolAddress": p.Address, }).Infof("[DMM] Start getting new state of pool") diff --git a/pkg/source/dodo/pool_tracker.go b/pkg/source/dodo/pool_tracker.go index 13e8b0123..80fe6e31c 100644 --- a/pkg/source/dodo/pool_tracker.go +++ b/pkg/source/dodo/pool_tracker.go @@ -15,6 +15,7 @@ import ( cmap "github.com/orcaman/concurrent-map" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -39,7 +40,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { var staticExtraData = struct { Type string `json:"type"` }{} diff --git a/pkg/source/dystopia/pool_tracker.go b/pkg/source/dystopia/pool_tracker.go index da5b98633..71b27b19c 100644 --- a/pkg/source/dystopia/pool_tracker.go +++ b/pkg/source/dystopia/pool_tracker.go @@ -8,6 +8,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -20,7 +21,11 @@ func NewPoolTracker(ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "poolAddress": p.Address, }) diff --git a/pkg/source/elastic/pool_tracker.go b/pkg/source/elastic/pool_tracker.go index 493ac4d87..7599dce58 100644 --- a/pkg/source/elastic/pool_tracker.go +++ b/pkg/source/elastic/pool_tracker.go @@ -13,6 +13,7 @@ import ( "github.com/sourcegraph/conc/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" graphqlPkg "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/graphql" ) @@ -35,7 +36,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ sourcePool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[Elastic] Start getting new state of pool: %v", p.Address) var ( diff --git a/pkg/source/fraxswap/pool_tracker.go b/pkg/source/fraxswap/pool_tracker.go index b76c2b160..2038c5d4d 100644 --- a/pkg/source/fraxswap/pool_tracker.go +++ b/pkg/source/fraxswap/pool_tracker.go @@ -10,6 +10,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -22,7 +23,11 @@ func NewPoolTracker(ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "poolAddress": p.Address, }) diff --git a/pkg/source/gmx/pool_tracker.go b/pkg/source/gmx/pool_tracker.go index ebd36fa75..cafaab690 100644 --- a/pkg/source/gmx/pool_tracker.go +++ b/pkg/source/gmx/pool_tracker.go @@ -10,6 +10,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -27,7 +28,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "liquiditySource": DexTypeGmx, "poolAddress": p.Address, diff --git a/pkg/source/ironstable/pool_tracker.go b/pkg/source/ironstable/pool_tracker.go index 1d900f341..f94cd74c6 100644 --- a/pkg/source/ironstable/pool_tracker.go +++ b/pkg/source/ironstable/pool_tracker.go @@ -11,6 +11,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/timer" ) @@ -26,7 +27,11 @@ func NewPoolTracker(cfg *Config, ethrpcClient *ethrpc.Client) (*PoolTracker, err }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { finish := timer.Start(fmt.Sprintf("[%s] get new pool state", d.cfg.DexID)) defer finish() diff --git a/pkg/source/iziswap/pool_tracker.go b/pkg/source/iziswap/pool_tracker.go index a855e980e..1189335c1 100644 --- a/pkg/source/iziswap/pool_tracker.go +++ b/pkg/source/iziswap/pool_tracker.go @@ -7,6 +7,7 @@ import ( "github.com/KyberNetwork/ethrpc" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/logger" "github.com/ethereum/go-ethereum/common" "github.com/izumiFinance/iZiSwap-SDK-go/swap" @@ -31,7 +32,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ sourcePool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[iZiSwap] Start getting new state of pool: %v", p.Address) g := pool.New().WithContext(ctx) diff --git a/pkg/source/kyber-pmm/pool_tracker.go b/pkg/source/kyber-pmm/pool_tracker.go index c9192d1d7..91a008a17 100644 --- a/pkg/source/kyber-pmm/pool_tracker.go +++ b/pkg/source/kyber-pmm/pool_tracker.go @@ -10,6 +10,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -24,7 +25,11 @@ func NewPoolTracker(cfg *Config, client IClient) *PoolTracker { } } -func (t *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (t *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[Kyber PMM] Start getting new states for pool %v", p.Address) if len(p.Tokens) != 2 { diff --git a/pkg/source/lido-steth/pool_tracker.go b/pkg/source/lido-steth/pool_tracker.go index cfe968f78..3bf47543b 100644 --- a/pkg/source/lido-steth/pool_tracker.go +++ b/pkg/source/lido-steth/pool_tracker.go @@ -9,6 +9,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -21,7 +22,11 @@ func NewPoolTracker(ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "poolAddress": p.Address, }) diff --git a/pkg/source/lido/pool_tracker.go b/pkg/source/lido/pool_tracker.go index 804648648..1f86bf6c0 100644 --- a/pkg/source/lido/pool_tracker.go +++ b/pkg/source/lido/pool_tracker.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -23,7 +24,11 @@ func NewPoolTracker(ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "poolAddress": p.Address, }) diff --git a/pkg/source/limitorder/pool_tracker.go b/pkg/source/limitorder/pool_tracker.go index 512af7e47..ac66e8ad6 100644 --- a/pkg/source/limitorder/pool_tracker.go +++ b/pkg/source/limitorder/pool_tracker.go @@ -11,6 +11,7 @@ import ( "golang.org/x/sync/errgroup" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -27,7 +28,11 @@ func NewPoolTracker(cfg *Config) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[LimitOrder] Start getting new states for pool %v", p.Address) if len(p.Tokens) < 2 { err := errors.New("number of token should be greater than or equal 2") diff --git a/pkg/source/madmex/pool_tracker.go b/pkg/source/madmex/pool_tracker.go index 1e20e61ef..3e9582454 100644 --- a/pkg/source/madmex/pool_tracker.go +++ b/pkg/source/madmex/pool_tracker.go @@ -10,6 +10,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -27,7 +28,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "liquiditySource": DexTypeMadmex, "poolAddress": p.Address, diff --git a/pkg/source/makerpsm/pool_tracker.go b/pkg/source/makerpsm/pool_tracker.go index eb9ab6063..17de1f529 100644 --- a/pkg/source/makerpsm/pool_tracker.go +++ b/pkg/source/makerpsm/pool_tracker.go @@ -10,6 +10,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -26,7 +27,11 @@ func NewPoolTracker(cfg *Config, ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, pool entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + pool entity.Pool, + _ sourcePool.GetNewPoolStateParams, +) (entity.Pool, error) { defer func(startTime time.Time) { logger. WithFields(logger.Fields{ diff --git a/pkg/source/maverickv1/pool_tracker.go b/pkg/source/maverickv1/pool_tracker.go index 95a8f85a7..34771230b 100644 --- a/pkg/source/maverickv1/pool_tracker.go +++ b/pkg/source/maverickv1/pool_tracker.go @@ -3,12 +3,14 @@ package maverickv1 import ( "context" "encoding/json" - "github.com/KyberNetwork/ethrpc" - "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" - "github.com/KyberNetwork/logger" "math/big" "strconv" "time" + + "github.com/KyberNetwork/ethrpc" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" + "github.com/KyberNetwork/logger" ) type PoolTracker struct { @@ -26,7 +28,11 @@ func NewPoolTracker( } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "address": p.Address, }).Infof("[%s] Start getting new state of pool", p.Type) diff --git a/pkg/source/metavault/pool_tracker.go b/pkg/source/metavault/pool_tracker.go index 490bda8b3..29684ddbe 100644 --- a/pkg/source/metavault/pool_tracker.go +++ b/pkg/source/metavault/pool_tracker.go @@ -10,6 +10,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -27,7 +28,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "liquiditySource": DexTypeMetavault, "poolAddress": p.Address, diff --git a/pkg/source/muteswitch/pool_tracker.go b/pkg/source/muteswitch/pool_tracker.go index eee32c25e..e774112f6 100644 --- a/pkg/source/muteswitch/pool_tracker.go +++ b/pkg/source/muteswitch/pool_tracker.go @@ -9,6 +9,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -26,7 +27,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "address": p.Address, }).Infof("[%s] Start getting new state of pool", p.Type) diff --git a/pkg/source/nerve/pool_tracker.go b/pkg/source/nerve/pool_tracker.go index b6e9d4405..4d87fd5df 100644 --- a/pkg/source/nerve/pool_tracker.go +++ b/pkg/source/nerve/pool_tracker.go @@ -11,6 +11,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -28,7 +29,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "liquiditySource": DexTypeNerve, "poolAddress": p.Address, diff --git a/pkg/source/oneswap/pool_tracker.go b/pkg/source/oneswap/pool_tracker.go index eb4660e4a..8b40ee3e9 100644 --- a/pkg/source/oneswap/pool_tracker.go +++ b/pkg/source/oneswap/pool_tracker.go @@ -11,6 +11,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -23,7 +24,11 @@ func NewPoolTracker(ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[Oneswap] Start getting new state of pool %v", p.Address) var ( diff --git a/pkg/source/pancakev3/pool_tracker.go b/pkg/source/pancakev3/pool_tracker.go index d0201f0af..1e1489df6 100644 --- a/pkg/source/pancakev3/pool_tracker.go +++ b/pkg/source/pancakev3/pool_tracker.go @@ -13,6 +13,7 @@ import ( "github.com/sourcegraph/conc/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" graphqlPkg "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/graphql" ) @@ -35,7 +36,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ sourcePool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[Pancake V3] Start getting new state of pool: %v", p.Address) var ( diff --git a/pkg/source/pearl/pool_tracker.go b/pkg/source/pearl/pool_tracker.go index c0811741c..8cc1dc253 100644 --- a/pkg/source/pearl/pool_tracker.go +++ b/pkg/source/pearl/pool_tracker.go @@ -9,6 +9,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -26,7 +27,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "address": p.Address, }).Infof("[%s] Start getting new state of pool", p.Type) diff --git a/pkg/source/platypus/pool_tracker.go b/pkg/source/platypus/pool_tracker.go index becf94748..9bc51cd84 100644 --- a/pkg/source/platypus/pool_tracker.go +++ b/pkg/source/platypus/pool_tracker.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -24,7 +25,11 @@ func NewPoolTracker(ethClient *ethrpc.Client) *PoolTracker { } } -func (t *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (t *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "address": p.Address, }).Infof("[Platypus] Start getting new pool's state") diff --git a/pkg/source/polydex/pool_tracker.go b/pkg/source/polydex/pool_tracker.go index 49f461e7b..a2eb58a63 100644 --- a/pkg/source/polydex/pool_tracker.go +++ b/pkg/source/polydex/pool_tracker.go @@ -8,6 +8,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -22,7 +23,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { log := logger.WithFields(logger.Fields{ "liquiditySource": DexTypePolydex, "poolAddress": p.Address, diff --git a/pkg/source/pool/iface.go b/pkg/source/pool/iface.go index 13b503a21..eaccd101f 100644 --- a/pkg/source/pool/iface.go +++ b/pkg/source/pool/iface.go @@ -5,6 +5,7 @@ import ( "math/big" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/ethereum/go-ethereum/core/types" ) type IPoolsListUpdater interface { @@ -17,8 +18,12 @@ type IPoolsListUpdater interface { GetNewPools(ctx context.Context, metadataBytes []byte) ([]entity.Pool, []byte, error) } +type GetNewPoolStateParams struct { + Logs []types.Log +} + type IPoolTracker interface { - GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) + GetNewPoolState(ctx context.Context, p entity.Pool, params GetNewPoolStateParams) (entity.Pool, error) } type IPoolSimulator interface { diff --git a/pkg/source/ramses/pool_tracker.go b/pkg/source/ramses/pool_tracker.go index 9339e593c..3e350ef27 100644 --- a/pkg/source/ramses/pool_tracker.go +++ b/pkg/source/ramses/pool_tracker.go @@ -12,6 +12,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -29,7 +30,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { var ( reserve Reserves stableFee, volatileFee, pairFee *big.Int diff --git a/pkg/source/saddle/pool_tracker.go b/pkg/source/saddle/pool_tracker.go index 18f75310c..c5ef4b2d3 100644 --- a/pkg/source/saddle/pool_tracker.go +++ b/pkg/source/saddle/pool_tracker.go @@ -10,6 +10,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -24,7 +25,11 @@ func NewPoolTracker(cfg *Config, ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[%s] Start getting new state of pool: %v", d.config.DexID, p.Address) var ( diff --git a/pkg/source/syncswap/pool_tracker.go b/pkg/source/syncswap/pool_tracker.go index ed709d9b5..73495f8c6 100644 --- a/pkg/source/syncswap/pool_tracker.go +++ b/pkg/source/syncswap/pool_tracker.go @@ -12,6 +12,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -29,7 +30,11 @@ func NewPoolTracker( } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { switch p.Type { case poolTypeSyncSwapClassic: return d.getClassicPoolState(ctx, p) diff --git a/pkg/source/synthetix/pool_tracker.go b/pkg/source/synthetix/pool_tracker.go index ea162bf79..31fc9816f 100644 --- a/pkg/source/synthetix/pool_tracker.go +++ b/pkg/source/synthetix/pool_tracker.go @@ -13,6 +13,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/timer" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/valueobject" ) @@ -51,7 +52,11 @@ func NewPoolTracker(cfg *Config, ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, pool entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + pool entity.Pool, + _ sourcePool.GetNewPoolStateParams, +) (entity.Pool, error) { finish := timer.Start(fmt.Sprintf("[%s] get new pool state", d.cfg.DexID)) defer finish() diff --git a/pkg/source/traderjoev20/pool_test.go b/pkg/source/traderjoev20/pool_test.go index cf82b5ca1..5c5a167a6 100644 --- a/pkg/source/traderjoev20/pool_test.go +++ b/pkg/source/traderjoev20/pool_test.go @@ -12,6 +12,7 @@ import ( "github.com/KyberNetwork/ethrpc" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/traderjoecommon" ) @@ -68,7 +69,7 @@ func TestGetPoolState(t *testing.T) { }) require.NoError(t, err) - pool, err := tracker.GetNewPoolState(context.Background(), entity.Pool{Address: usdceUSDCPool}) + pool, err := tracker.GetNewPoolState(context.Background(), entity.Pool{Address: usdceUSDCPool}, sourcePool.GetNewPoolStateParams{}) require.NoError(t, err) spew.Dump(pool) diff --git a/pkg/source/traderjoev20/pool_tracker.go b/pkg/source/traderjoev20/pool_tracker.go index ace16c994..80918ed8b 100644 --- a/pkg/source/traderjoev20/pool_tracker.go +++ b/pkg/source/traderjoev20/pool_tracker.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/traderjoecommon" ) @@ -29,7 +30,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[TraderJoe v2.0] Start getting new state of pool: %v", p.Address) rpcRequest := d.EthrpcClient.NewRequest() diff --git a/pkg/source/traderjoev21/pool_test.go b/pkg/source/traderjoev21/pool_test.go index d5fe7fa5a..173f5d97d 100644 --- a/pkg/source/traderjoev21/pool_test.go +++ b/pkg/source/traderjoev21/pool_test.go @@ -12,6 +12,7 @@ import ( "github.com/KyberNetwork/ethrpc" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/traderjoecommon" ) @@ -65,7 +66,7 @@ func TestGetPoolState(t *testing.T) { tracker, err := NewPoolTracker(client) require.NoError(t, err) - pool, err := tracker.GetNewPoolState(context.Background(), entity.Pool{Address: btcbUSDCPool}) + pool, err := tracker.GetNewPoolState(context.Background(), entity.Pool{Address: btcbUSDCPool}, sourcePool.GetNewPoolStateParams{}) require.NoError(t, err) spew.Dump(pool) diff --git a/pkg/source/traderjoev21/pool_tracker.go b/pkg/source/traderjoev21/pool_tracker.go index a551d002b..e63e68dff 100644 --- a/pkg/source/traderjoev21/pool_tracker.go +++ b/pkg/source/traderjoev21/pool_tracker.go @@ -10,6 +10,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/traderjoecommon" ) @@ -25,7 +26,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[TraderJoe v2.0] Start getting new state of pool: %v", p.Address) rpcRequest := d.EthrpcClient.NewRequest() diff --git a/pkg/source/uniswap/pool_tracker.go b/pkg/source/uniswap/pool_tracker.go index 422af0608..1e84592a8 100644 --- a/pkg/source/uniswap/pool_tracker.go +++ b/pkg/source/uniswap/pool_tracker.go @@ -8,6 +8,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -22,7 +23,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[Uniswap V2] Start getting new state of pool: %v", p.Address) rpcRequest := d.ethrpcClient.NewRequest() diff --git a/pkg/source/uniswapv3/pool_tracker.go b/pkg/source/uniswapv3/pool_tracker.go index b8a5bb8e2..39f4da9d1 100644 --- a/pkg/source/uniswapv3/pool_tracker.go +++ b/pkg/source/uniswapv3/pool_tracker.go @@ -15,6 +15,7 @@ import ( "github.com/sourcegraph/conc/pool" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + sourcePool "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" graphqlPkg "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/graphql" ) @@ -70,7 +71,11 @@ func initializeConfig(cfg *Config) (*Config, error) { return cfg, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ sourcePool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.Infof("[%s] Start getting new state of pool: %v", d.config.DexID, p.Address) var ( diff --git a/pkg/source/velocimeter/pool_tracker.go b/pkg/source/velocimeter/pool_tracker.go index 60cca988a..7c06d1ea8 100644 --- a/pkg/source/velocimeter/pool_tracker.go +++ b/pkg/source/velocimeter/pool_tracker.go @@ -11,6 +11,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -28,14 +29,18 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "address": p.Address, }).Infof("[%s] Start getting new state of pool", p.Type) var ( - reserve Reserves - poolFee *big.Int + reserve Reserves + poolFee *big.Int ) calls := d.ethrpcClient.NewRequest().SetContext(ctx) diff --git a/pkg/source/velodrome/pool_tracker.go b/pkg/source/velodrome/pool_tracker.go index c72e01f81..778d908b1 100644 --- a/pkg/source/velodrome/pool_tracker.go +++ b/pkg/source/velodrome/pool_tracker.go @@ -9,6 +9,7 @@ import ( "github.com/KyberNetwork/logger" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -26,7 +27,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "address": p.Address, }).Infof("[%s] Start getting new state of pool", p.Type) diff --git a/pkg/source/velodromev2/pool_tracker.go b/pkg/source/velodromev2/pool_tracker.go index 466ba8839..639183fb4 100644 --- a/pkg/source/velodromev2/pool_tracker.go +++ b/pkg/source/velodromev2/pool_tracker.go @@ -2,14 +2,15 @@ package velodromev2 import ( "context" - "github.com/ethereum/go-ethereum/common" "math/big" "time" "github.com/KyberNetwork/ethrpc" "github.com/KyberNetwork/logger" + "github.com/ethereum/go-ethereum/common" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" ) type PoolTracker struct { @@ -27,7 +28,11 @@ func NewPoolTracker( }, nil } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "address": p.Address, }).Infof("[%s] Start getting new state of pool", p.Type) diff --git a/pkg/source/wombat/pool_tracker.go b/pkg/source/wombat/pool_tracker.go index ad6c6ee87..9230b4348 100644 --- a/pkg/source/wombat/pool_tracker.go +++ b/pkg/source/wombat/pool_tracker.go @@ -3,12 +3,14 @@ package wombat import ( "context" "encoding/json" + "math/big" + "time" + "github.com/KyberNetwork/ethrpc" "github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity" + "github.com/KyberNetwork/kyberswap-dex-lib/pkg/source/pool" "github.com/KyberNetwork/logger" "github.com/ethereum/go-ethereum/common" - "math/big" - "time" ) type PoolTracker struct { @@ -23,7 +25,11 @@ func NewPoolTracker(cfg *Config, ethrpcClient *ethrpc.Client) *PoolTracker { } } -func (d *PoolTracker) GetNewPoolState(ctx context.Context, p entity.Pool) (entity.Pool, error) { +func (d *PoolTracker) GetNewPoolState( + ctx context.Context, + p entity.Pool, + _ pool.GetNewPoolStateParams, +) (entity.Pool, error) { logger.WithFields(logger.Fields{ "address": p.Address, }).Infof("[%s] Start getting new states of pool", p.Type)