Vindberg
Vindberg

Reputation: 1542

Error: insufficient data for uint128 type calling smart contract variable

Calling a variable on the smart contract I get this error:

Error: insufficient data for uint128 type (arg="", coderType="uint128", value="0x00")

from javascript in browser:

    myContract.methods.grantSize().call(function (err, res) {
    if (err) {
        console.log(err.toString());
    } else {
    }

Solidity contract:

uint128 public grantSize;

A couple of test shows that the grantSize should be 0.003 ether. Any ideas are most helpful.

Web3.js 1.0 beta 36

Truffle v4.1.14 (core: 4.1.14)

Solidity v0.4.24 (solc-js)

[email protected]

Upvotes: 1

Views: 2088

Answers (2)

Richard.Lai
Richard.Lai

Reputation: 1

I had this issue too, I got a inspiration from your answer. my error was caused because my mContract instance created asynchronously did not exist.

Upvotes: 0

Vindberg
Vindberg

Reputation: 1542

I can answer this myself now :) Its because the contract address was wrongly specified (earlier in the code) it makes sense that this variable has insufficient data then. However, it could also say "variable not found" or event better, "No contract found on that address: [address]". This could be considered for a push on web3js.

Upvotes: 1

Related Questions