Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouop0 committed Jan 7, 2025
1 parent f4264fa commit 38bfe90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
run:
tests: false
skip-dirs:
- .*/
- vendor/
skip-dirs-use-default: true
# timeout for analysis, e.g. 30s, 5m, default is 1m
# timeout: 5m

Expand Down
13 changes: 7 additions & 6 deletions handler/logFilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package handler

import (
"context"
"github.com/spf13/cast"

Check failure on line 5 in handler/logFilter.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

File is not properly formatted (gofumpt)
"math/big"
"strings"

Check failure on line 7 in handler/logFilter.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

File is not properly formatted (gofumpt)

Expand Down Expand Up @@ -60,13 +61,13 @@ func LogsToEvents(ctx *svc.ServiceContext, logs []types.Log, syncBlockId int64)
continue
}

blockTime := blockTimes[int64(vlog.BlockNumber)]
blockTime := blockTimes[cast.ToInt64(vlog.BlockNumber)]
if blockTime == 0 {
block, err := ctx.L2RPC.BlockByNumber(context.Background(), big.NewInt(int64(vlog.BlockNumber)))
block, err := ctx.L2RPC.BlockByNumber(context.Background(), big.NewInt(cast.ToInt64(vlog.BlockNumber)))
if err != nil {
return nil, errors.WithStack(err)
}
blockTime = int64(block.Time())
blockTime = cast.ToInt64(block.Time())
}
data, err := Event.Data(vlog)
if err != nil {
Expand All @@ -79,10 +80,10 @@ func LogsToEvents(ctx *svc.ServiceContext, logs []types.Log, syncBlockId int64)
Blockchain: ctx.Config.Blockchain,
SyncBlockID: syncBlockId,
BlockTime: blockTime,
BlockNumber: int64(vlog.BlockNumber),
BlockNumber: cast.ToInt64(vlog.BlockNumber),
BlockHash: vlog.BlockHash.Hex(),
BlockLogIndexed: int64(vlog.Index),
TxIndex: int64(vlog.TxIndex),
BlockLogIndexed: cast.ToInt64(vlog.Index),
TxIndex: cast.ToInt64(vlog.TxIndex),
TxHash: vlog.TxHash.Hex(),
EventName: Event.Name(),
EventHash: eventHash.Hex(),
Expand Down

0 comments on commit 38bfe90

Please sign in to comment.