Skip to content

Commit

Permalink
ref res
Browse files Browse the repository at this point in the history
  • Loading branch information
ettec committed Sep 18, 2024
1 parent ebf809a commit f753e47
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion core/services/relay/evm/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,28 @@ func (cr *chainReader) GetLatestValue(ctx context.Context, readName string, conf
return err
}

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

contractType, err := cr.CreateContractType(readName, false)
if err != nil {
return err
}

if err = cr.GetLatestValue(ctx, readName, confidenceLevel, params, contractType); err != nil {
return err
}

wrapped, err := values.Wrap(contractType)
if err != nil {
return err
}

*ptrToVal = wrapped

return nil
}

func (cr *chainReader) GetLatestWrappedValue(ctx context.Context, readName string, confidenceLevel primitives.ConfidenceLevel, params any) (values.Value, error) {
Expand Down

0 comments on commit f753e47

Please sign in to comment.