(fieldName string)
| 54 | } |
| 55 | |
| 56 | func (c *ContractReader) readSlot(fieldName string) ([]byte, error) { |
| 57 | h := crypto.Keccak256Hash([]byte(fieldName + "()")) |
| 58 | msg := ethereum.CallMsg{ |
| 59 | To: &c.contract, |
| 60 | Data: h[0:4], |
| 61 | } |
| 62 | bs, err := c.client.CallContract(c.ctx, msg, nil) |
| 63 | if err != nil { |
| 64 | return nil, fmt.Errorf("failed to get %s from contract: %v", fieldName, err) |
| 65 | } |
| 66 | return bs, nil |
| 67 | } |
| 68 | |
| 69 | func (c *ContractReader) readUint(fieldName string) (uint64, error) { |
| 70 | bs, err := c.readSlot(fieldName) |