starter-kit-gsn
starter-kit-gsn copied to clipboard
Error: Invalid number of parameters for "initialize". Got 2 expected 0!

Please correct me if I am wrong. As below shows, This error was caused by there's two initialize() functions and the test case was calling the one with 0 parameters.

And it can be fixed by renaming it e.g. rename initialize to initialise.

Hi @leckylao! I’m sorry that you had this issue.
We have been able to reproduce this issue by following these steps: With truffle installed run the tests
$ npx truffle test
Using network 'development'.
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Contract: counter
Error: Invalid number of parameters for "initialize". Got 2 expected 0!
Error: Invalid number of parameters for "initialize". Got 2 expected 0!
Thanks so much for reporting it! The workaround is to change the call to initialize to specify the function being called:
//counter.initialize(value, { from: owner });
counter.methods['initialize(uint256)'](value, { from: owner });
Thank you @abcoathup, that works.