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

Function getPayment

integration_tests/node_mine_test.go:244–259  ·  view source on GitHub ↗
(l1Client *eth.PollingClient, contract common.Address, batch uint64)

Source from the content-addressed store, hash-verified

242}
243
244func getPayment(l1Client *eth.PollingClient, contract common.Address, batch uint64) (*big.Int, error) {
245 uint256Type, _ := abi.NewType("uint256", "", nil)
246 dataField, _ := abi.Arguments{{Type: uint256Type}}.Pack(new(big.Int).SetUint64(batch))
247 h := crypto.Keccak256Hash([]byte(`upfrontPaymentInBatch(uint256)`))
248 calldata := append(h[0:4], dataField...)
249 msg := ethereum.CallMsg{
250 To: &contract,
251 Data: calldata,
252 }
253 bs, err := l1Client.CallContract(context.Background(), msg, nil)
254 if err != nil {
255 lg.Error("Failed to call contract", "error", err.Error())
256 return nil, err
257 }
258 return new(big.Int).SetBytes(bs), nil
259}
260
261func prepareData(t *testing.T, l1Client *eth.PollingClient, storageMgr *ethstorage.StorageManager) {
262 // fill contract with almost 2 shards of blobs

Callers 1

prepareDataFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected