MCPcopy Create free account
hub / github.com/ethstorage/es-node / ReadContractField

Method ReadContractField

ethstorage/eth/polling_client.go:353–364  ·  view source on GitHub ↗
(fieldName string, blockNumber *big.Int)

Source from the content-addressed store, hash-verified

351}
352
353func (w *PollingClient) ReadContractField(fieldName string, blockNumber *big.Int) ([]byte, error) {
354 h := crypto.Keccak256Hash([]byte(fieldName + "()"))
355 msg := ethereum.CallMsg{
356 To: &w.esContract,
357 Data: h[0:4],
358 }
359 bs, err := w.Client.CallContract(context.Background(), msg, blockNumber)
360 if err != nil {
361 return nil, fmt.Errorf("failed to get %s from contract: %v", fieldName, err)
362 }
363 return bs, nil
364}
365
366func (w *PollingClient) GetContractVersion() (string, error) {
367 bs, err := w.ReadContractField("version", nil)

Callers 6

GetContractVersionMethod · 0.95
initStorageConfigFunction · 0.80
initMiningConfigFunction · 0.80
CheckMinerRoleMethod · 0.80
newDashboardFunction · 0.80
InitMetricsMethod · 0.80

Calls

no outgoing calls

Tested by 2

initStorageConfigFunction · 0.64
initMiningConfigFunction · 0.64