Search code examples
solidityweb3js

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)

ganache-cli@6.1.8


Solution

  • 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.