(fieldName string, blockNumber *big.Int)
| 351 | } |
| 352 | |
| 353 | func (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 | |
| 366 | func (w *PollingClient) GetContractVersion() (string, error) { |
| 367 | bs, err := w.ReadContractField("version", nil) |
no outgoing calls