I am getting a BigNumber() error from the standard token function balanceOf(). The function returns uint256, but it seems like it's returning an array of objects. Here is my javascript testing in Truffle:

      return tokFactory.createTok(100000,"tok",1,"tok",{from: accounts[0]}).then(function(txHash) { 
      tokFactory.getTokenAddress.call().then(function(tokenAddress) { 
      tok = Tok.at(tokenAddress);
      }).then(function() { 
    tok.balanceOf.call(tokFactory).then(function(balance) {
  assert.equal(balance.toNumber(), 100000, "100000 wasn't in the first   account");

Solidity function:

function balanceOf(address _owner) constant returns (uint256 balance) {
    return balances[_owner];
  • "The function returns uint256, but it seems like it's returning an array of objects". What makes you think this? Also, try replacing tok.balanceOf.call(tokFactory.address) Jan 5, 2017 at 22:56
  • Ok passing in the tokFactory address fixed it, thanks.
    – ethereal
    Jan 8, 2017 at 17:55
  • Facing the same error. i am trying this return KNTInstance.balanceOf.call(accounts[0], {from: accounts[0]}); Dec 7, 2017 at 13:03

1 Answer 1


the mistake is in


you should call


get it? you should pass the uint256 address of the contract not it's object rappresentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.