Skip to content

Commit 182102f

Browse files
authored
ignore zero registry/factory for curve pools (#37)
* ignore zero registry/factory for curve pools * ignore zero for platypus --------- Co-authored-by: le.cao <[email protected]>
1 parent f7e4936 commit 182102f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/source/curve/pools_list_updater.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"errors"
77
"math/big"
8+
"strings"
89

910
"github.com/KyberNetwork/ethrpc"
1011
"github.com/KyberNetwork/logger"
@@ -65,6 +66,10 @@ func (d *PoolsListUpdater) GetNewPools(ctx context.Context, metadataBytes []byte
6566

6667
var newPoolLimitLeft = d.config.NewPoolLimit
6768
for i := 0; i < len(registryOrFactoryList); i++ {
69+
if strings.EqualFold(registryOrFactoryList[i].Address, addressZero) {
70+
logger.Debugf("skip zero factory %v", i)
71+
continue
72+
}
6873
poolAddresses, poolTypes, nextOffset, err := d.getNewPoolAddressesFromRegistryOrFactory(
6974
ctx,
7075
registryOrFactoryList[i].ABI,

pkg/source/platypus/pools_list_updater.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/KyberNetwork/logger"
1313
"github.com/ethereum/go-ethereum/common"
1414
"github.com/machinebox/graphql"
15+
"github.com/samber/lo"
1516

1617
"github.com/KyberNetwork/kyberswap-dex-lib/pkg/entity"
1718
graphqlpkg "github.com/KyberNetwork/kyberswap-dex-lib/pkg/util/graphql"
@@ -118,7 +119,8 @@ func (p *PoolsListUpdater) getPoolAddresses(
118119
return nil, err
119120
}
120121

121-
return response.Pools, nil
122+
validPools := lo.Filter(response.Pools, func(p SubgraphPool, _ int) bool { return !strings.EqualFold(p.ID, addressZero) })
123+
return validPools, nil
122124
}
123125

124126
func (p *PoolsListUpdater) getPools(

0 commit comments

Comments
 (0)