mirror of
https://github.com/grassrootseconomics/cic-chain-events.git
synced 2024-11-22 07:46:46 +01:00
fix: deepsource suggestions
This commit is contained in:
parent
e2f7d1860d
commit
f1e74961b0
@ -16,8 +16,3 @@ func initTransferFilter() filter.Filter {
|
||||
})
|
||||
}
|
||||
|
||||
func initNoopFilter() filter.Filter {
|
||||
return filter.NewNoopFilter(filter.NoopFilterOpts{
|
||||
Logg: lo,
|
||||
})
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ func main() {
|
||||
SweepInterval: time.Second * time.Duration(ko.MustInt64("syncer.sweep_interval")),
|
||||
})
|
||||
|
||||
apiServer.GET("/stats", api.StatsHandler(syncerStats, workerPool, lo))
|
||||
apiServer.GET("/stats", api.StatsHandler(syncerStats, workerPool))
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
|
2
go.mod
2
go.mod
@ -6,6 +6,7 @@ require (
|
||||
github.com/VictoriaMetrics/metrics v1.23.0
|
||||
github.com/alitto/pond v1.8.2
|
||||
github.com/celo-org/celo-blockchain v1.6.1
|
||||
github.com/goccy/go-json v0.10.0
|
||||
github.com/jackc/pgx/v5 v5.2.0
|
||||
github.com/knadh/goyesql/v2 v2.2.0
|
||||
github.com/knadh/koanf v1.4.5
|
||||
@ -23,7 +24,6 @@ require (
|
||||
github.com/fsnotify/fsnotify v1.4.9 // indirect
|
||||
github.com/go-ole/go-ole v1.2.5 // indirect
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/goccy/go-json v0.10.0 // indirect
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"github.com/alitto/pond"
|
||||
"github.com/grassrootseconomics/cic-chain-events/internal/syncer"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/zerodha/logf"
|
||||
)
|
||||
|
||||
type statsResponse struct {
|
||||
@ -22,7 +21,6 @@ type statsResponse struct {
|
||||
func StatsHandler(
|
||||
syncerStats *syncer.Stats,
|
||||
poolStats *pond.WorkerPool,
|
||||
logg logf.Logger,
|
||||
) func(echo.Context) error {
|
||||
return func(ctx echo.Context) error {
|
||||
headCursor := syncerStats.GetHeadCursor()
|
||||
|
@ -8,8 +8,3 @@ type okResp struct {
|
||||
Ok bool `json:"ok"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type errResp struct {
|
||||
Ok bool `json:"ok"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ func NewAddressFilter(o AddressFilterOpts) Filter {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *AddressFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) {
|
||||
func (*AddressFilter) Execute(_ context.Context, transaction fetch.Transaction) (bool, error) {
|
||||
if transaction.To.Address == cUSD {
|
||||
return true, nil
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ func NewNoopFilter(o NoopFilterOpts) Filter {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *NoopFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) {
|
||||
func (f *NoopFilter) Execute(_ context.Context, transaction fetch.Transaction) (bool, error) {
|
||||
f.logg.Debug("noop filter", "block", transaction.Block.Number, "index", transaction.Index)
|
||||
return true, nil
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ func NewTransferFilter(o TransferFilterOpts) Filter {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *TransferFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) {
|
||||
func (f *TransferFilter) Execute(_ context.Context, transaction fetch.Transaction) (bool, error) {
|
||||
switch transaction.InputData[:10] {
|
||||
case "0xa9059cbb":
|
||||
f.logg.Info("cUSD transfer", "block", transaction.Block.Number, "index", transaction.Index)
|
||||
|
@ -33,7 +33,7 @@ func newErrorFilter() filter.Filter {
|
||||
return &errorFilter{}
|
||||
}
|
||||
|
||||
func (f *errorFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) {
|
||||
func (*errorFilter) Execute(_ context.Context, _ fetch.Transaction) (bool, error) {
|
||||
return false, errors.New("crash")
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ func newEarlyExitFilter() filter.Filter {
|
||||
return &earlyExitFilter{}
|
||||
}
|
||||
|
||||
func (f *earlyExitFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) {
|
||||
func (*earlyExitFilter) Execute(_ context.Context, _ fetch.Transaction) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user