1

I have the function below which doesn't take any arguments when i call it from truffle console i get the below error, any idea on how i can fix this:

uint ownerCounter = 0;

function getNumberOfTokenOwners() public view onlyOwner returns ( uint ) {
    return ownerCounter;
}

Thrown: Error: Invalid number of parameters for "getNumberOfTokenOwners". Got 0 expected 2! at Object._createTxObject (/home/linuxbrew/.linuxbrew/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:699:1) at Object.InvalidNumberOfParams (/home/linuxbrew/.linuxbrew/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-helpers/src/errors.js:32:1)

i am using

Truffle v5.0.19 (core: 5.0.19) Solidity - 0.5.2 (solc-js) Node v12.3.1 Web3.js v1.0.0-beta.37

  • 2
    Try remove build folder and then compile it again. This solution work for me – haxerl May 29 at 9:31
3

As @haxerl suggested, deleting the build folder and recompiling again fixed the issue.

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.