Skip to content

Commit

Permalink
fix: ignore plugins if is null
Browse files Browse the repository at this point in the history
  • Loading branch information
logicalangel committed Apr 5, 2024
1 parent cf691b5 commit 2538aba
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions internal/scheduler/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ type EvmLog struct {
}

func (e *EvmLog) Run() {
if config.App.Plugins.EthLog == nil {
return
}

log.Logger.With("Chain", e.chain).Info("Run evm log task")

for _, conf := range config.App.Plugins.EthLog.Events {
Expand Down
2 changes: 0 additions & 2 deletions internal/scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ func WithEthLogs(
persistence *persistence.BadgerRepository,
) func(s *Scheduler) {
return func(s *Scheduler) {

if config.App.Plugins.EthLog == nil {
return
}
Expand All @@ -67,7 +66,6 @@ func WithUniswapEvents(
ethRPC *ethereum.Repository,
) func(s *Scheduler) {
return func(s *Scheduler) {

if config.App.Plugins.Uniswap == nil {
return
}
Expand Down
4 changes: 4 additions & 0 deletions internal/scheduler/uniswap/uniswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ type Uniswap struct {
}

func (u *Uniswap) Run() {
if config.App.Plugins.Uniswap == nil {
return
}

log.Logger.With("Chain", u.chain).Info("Run Uniswap task")

currBlockNumber, err := u.uniswapService.GetBlockNumber(u.chain)
Expand Down
10 changes: 6 additions & 4 deletions internal/service/uniswap/uniswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,11 +573,13 @@ func New(ethRPC *ethereum.Repository, pos *pos.Repository) *Service {
PriceCache: map[string]*lru.Cache[uint64, big.Int]{},
}

for _, t := range config.App.Plugins.Uniswap.Tokens {
token := datasets.NewTokenFromCfg(t)
if config.App.Plugins.Uniswap != nil {
for _, t := range config.App.Plugins.Uniswap.Tokens {
token := datasets.NewTokenFromCfg(t)

key := u.TokenKey(token)
u.SupportedTokens[*key] = true
key := u.TokenKey(token)
u.SupportedTokens[*key] = true
}
}

u.twoOneNineTwo.Exp(big.NewInt(2), big.NewInt(192), nil)
Expand Down

0 comments on commit 2538aba

Please sign in to comment.