Skip to content

Commit 38bfe90

Browse files
committed
format
1 parent f4264fa commit 38bfe90

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
run:
22
tests: false
3+
skip-dirs:
4+
- .*/
5+
- vendor/
6+
skip-dirs-use-default: true
37
# timeout for analysis, e.g. 30s, 5m, default is 1m
48
# timeout: 5m
59

handler/logFilter.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package handler
22

33
import (
44
"context"
5+
"github.com/spf13/cast"
56
"math/big"
67
"strings"
78

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

63-
blockTime := blockTimes[int64(vlog.BlockNumber)]
64+
blockTime := blockTimes[cast.ToInt64(vlog.BlockNumber)]
6465
if blockTime == 0 {
65-
block, err := ctx.L2RPC.BlockByNumber(context.Background(), big.NewInt(int64(vlog.BlockNumber)))
66+
block, err := ctx.L2RPC.BlockByNumber(context.Background(), big.NewInt(cast.ToInt64(vlog.BlockNumber)))
6667
if err != nil {
6768
return nil, errors.WithStack(err)
6869
}
69-
blockTime = int64(block.Time())
70+
blockTime = cast.ToInt64(block.Time())
7071
}
7172
data, err := Event.Data(vlog)
7273
if err != nil {
@@ -79,10 +80,10 @@ func LogsToEvents(ctx *svc.ServiceContext, logs []types.Log, syncBlockId int64)
7980
Blockchain: ctx.Config.Blockchain,
8081
SyncBlockID: syncBlockId,
8182
BlockTime: blockTime,
82-
BlockNumber: int64(vlog.BlockNumber),
83+
BlockNumber: cast.ToInt64(vlog.BlockNumber),
8384
BlockHash: vlog.BlockHash.Hex(),
84-
BlockLogIndexed: int64(vlog.Index),
85-
TxIndex: int64(vlog.TxIndex),
85+
BlockLogIndexed: cast.ToInt64(vlog.Index),
86+
TxIndex: cast.ToInt64(vlog.TxIndex),
8687
TxHash: vlog.TxHash.Hex(),
8788
EventName: Event.Name(),
8889
EventHash: eventHash.Hex(),

0 commit comments

Comments
 (0)