From abe7e8882f10271a975ec5b5747ffc8ec137ebd7 Mon Sep 17 00:00:00 2001 From: it4rb Date: Mon, 28 Oct 2024 14:35:36 +0700 Subject: [PATCH] univ3 to support always using ticklens instead of subgraph (#558) --- pkg/source/uniswapv3/config.go | 2 ++ pkg/source/uniswapv3/pool_tracker.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/source/uniswapv3/config.go b/pkg/source/uniswapv3/config.go index b89d1548c..f20683252 100644 --- a/pkg/source/uniswapv3/config.go +++ b/pkg/source/uniswapv3/config.go @@ -10,6 +10,8 @@ type Config struct { PreGenesisPoolPath string `json:"preGenesisPoolPath"` AllowSubgraphError bool `json:"allowSubgraphError"` preGenesisPoolIDs []string + + AlwaysUseTickLens bool // instead of fetching from subgraph } func (c *Config) IsAllowSubgraphError() bool { diff --git a/pkg/source/uniswapv3/pool_tracker.go b/pkg/source/uniswapv3/pool_tracker.go index da7d6c097..8c2e204fe 100644 --- a/pkg/source/uniswapv3/pool_tracker.go +++ b/pkg/source/uniswapv3/pool_tracker.go @@ -119,7 +119,7 @@ func (d *PoolTracker) GetNewPoolState( // Link to issue: https://www.notion.so/kybernetwork/Aggregator-1-20-defect-1caec6062f9d4da0918fc3443e6e1963#0810d1462cc14f0a9465f935c9e641fe // TLDR: Optimism has some pre-genesis Uniswap V3 pool. Subgraph does not have data for these pools // So we have to fetch ticks data from the TickLens smart contract (which is slower). - if lo.Contains[string](d.config.preGenesisPoolIDs, p.Address) { + if d.config.AlwaysUseTickLens || lo.Contains[string](d.config.preGenesisPoolIDs, p.Address) { poolTicks, err = d.getPoolTicksFromSC(ctx, p) if err != nil { l.WithFields(logger.Fields{