Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
ettec committed Sep 18, 2024
1 parent 7505b5a commit 8374edb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
34 changes: 15 additions & 19 deletions core/services/relay/evm/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ type ChainReaderService interface {
}

type chainReader struct {
lggr logger.Logger
ht logpoller.HeadTracker
lp logpoller.LogPoller
client evmclient.Client
parsed *codec.ParsedTypes
bindings *read.BindingsRegistry
codec commontypes.RemoteCodec
contractToABI map[string]abi.ABI
lggr logger.Logger
ht logpoller.HeadTracker
lp logpoller.LogPoller
client evmclient.Client
parsed *codec.ParsedTypes
bindings *read.BindingsRegistry
codec commontypes.RemoteCodec

commonservices.StateMachine
}
Expand All @@ -54,13 +53,12 @@ var _ commontypes.ContractTypeProvider = &chainReader{}
// Note that the ChainReaderService returned does not support anonymous events.
func NewChainReaderService(ctx context.Context, lggr logger.Logger, lp logpoller.LogPoller, ht logpoller.HeadTracker, client evmclient.Client, config types.ChainReaderConfig) (ChainReaderService, error) {
cr := &chainReader{
lggr: logger.Named(lggr, "ChainReader"),
ht: ht,
lp: lp,
client: client,
bindings: read.NewBindingsRegistry(),
parsed: &codec.ParsedTypes{EncoderDefs: map[string]types.CodecEntry{}, DecoderDefs: map[string]types.CodecEntry{}},
contractToABI: map[string]abi.ABI{},
lggr: logger.Named(lggr, "ChainReader"),
ht: ht,
lp: lp,
client: client,
bindings: read.NewBindingsRegistry(),
parsed: &codec.ParsedTypes{EncoderDefs: map[string]types.CodecEntry{}, DecoderDefs: map[string]types.CodecEntry{}},
}

var err error
Expand Down Expand Up @@ -172,8 +170,8 @@ func (cr *chainReader) GetLatestValue(ctx context.Context, readName string, conf
return err
}

ptrToVal, isValueType := returnVal.(*values.Value)
if !isValueType {
ptrToVal, isValue := returnVal.(*values.Value)
if !isValue {
return binding.GetLatestValue(ctx, common.HexToAddress(address), confidenceLevel, params, returnVal)
}

Expand Down Expand Up @@ -244,8 +242,6 @@ func (cr *chainReader) addMethod(
return fmt.Errorf("%w: method %s doesn't exist", commontypes.ErrInvalidConfig, chainReaderDefinition.ChainSpecificName)
}

cr.contractToABI[contractName] = abi

confirmations, err := ConfirmationsFromConfig(chainReaderDefinition.ConfidenceConfirmations)
if err != nil {
return err
Expand Down
5 changes: 0 additions & 5 deletions core/services/relay/evm/read/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,6 @@ func (b *EventBinding) GetLatestValue(ctx context.Context, address common.Addres
return b.getLatestValueWithFilters(ctx, address, confirmations, params, into)
}

func (b *EventBinding) GetLatestValueWithDefaultType(ctx context.Context, address common.Address, confidenceLevel primitives.ConfidenceLevel, params any) (any, error) {
// TODO
return nil, fmt.Errorf("not implemented")
}

func (b *EventBinding) QueryKey(
ctx context.Context,
address common.Address,
Expand Down
1 change: 0 additions & 1 deletion core/services/relay/evm/read/method.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func NewMethodBinding(
confs map[primitives.ConfidenceLevel]evmtypes.Confirmations,
lggr logger.Logger,
) *MethodBinding {

return &MethodBinding{
contractName: name,
method: method,
Expand Down

0 comments on commit 8374edb

Please sign in to comment.