Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ettec committed Nov 26, 2024
1 parent 33c9076 commit c39a054
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions core/services/relay/evm/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ func (cr *chainReader) QueryKey(

func (cr *chainReader) QueryKeys(ctx context.Context, filters []commontypes.ContractKeyFilter,
limitAndSort query.LimitAndSort) ([]commontypes.SequenceWithKey, error) {

var eventQueries []read.EventQuery

Check failure on line 303 in core/services/relay/evm/chain_reader.go

View workflow job for this annotation

GitHub Actions / lint

Consider pre-allocating `eventQueries` (prealloc)
for _, filter := range filters {
binding, address, err := cr.bindings.GetReader(filter.Contract.ReadIdentifier(filter.KeyFilter.Key))
Expand All @@ -317,17 +316,18 @@ func (cr *chainReader) QueryKeys(ctx context.Context, filters []commontypes.Cont
}
}

if eventBinding, ok := binding.(*read.EventBinding); ok {
eventQueries = append(eventQueries, read.EventQuery{
Filter: filter.KeyFilter,
SequenceDataType: sequenceDataType,
IsValuePtr: isValuePtr,
EventBinding: eventBinding,
Address: common.HexToAddress(address),
})
} else {
eventBinding, ok := binding.(*read.EventBinding)
if !ok {
return nil, fmt.Errorf("query key %s is not an event", filter.KeyFilter.Key)
}

eventQueries = append(eventQueries, read.EventQuery{
Filter: filter.KeyFilter,
SequenceDataType: sequenceDataType,
IsValuePtr: isValuePtr,
EventBinding: eventBinding,
Address: common.HexToAddress(address),
})
}

return read.MultiEventTypeQuery(ctx, cr.lp, eventQueries, limitAndSort)
Expand Down

0 comments on commit c39a054

Please sign in to comment.