diff --git a/core/services/relay/evm/chain_reader.go b/core/services/relay/evm/chain_reader.go index dd068de9096..af940754b92 100644 --- a/core/services/relay/evm/chain_reader.go +++ b/core/services/relay/evm/chain_reader.go @@ -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 for _, filter := range filters { binding, address, err := cr.bindings.GetReader(filter.Contract.ReadIdentifier(filter.KeyFilter.Key)) @@ -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)