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

Method readSlot

cmd/es-node/utils.go:56–67  ·  view source on GitHub ↗
(fieldName string)

Source from the content-addressed store, hash-verified

54}
55
56func (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
69func (c *ContractReader) readUint(fieldName string) (uint64, error) {
70 bs, err := c.readSlot(fieldName)

Callers 2

readUintMethod · 0.95
readBigMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected