0

Does anybody know how to solve this? I've try to compile and deploy my contract to get the address, why obtained this error

Error:

1_initial_migration.js
======================

   Deploying 'towater'
   -------------------------
Error: Error: Error:  *** Deployment Failed ***

"towater" -- Invalid number of parameters for "undefined". Got 0 expected 2!.

    at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-migrate/index.js:92:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.0.24 (core: 5.0.24)
Node v10.16.0

that's image of error that I obtained

1_initial_migrations.js file:

var towater = artifacts.require("towater");

module.exports = function(deployer) {
  deployer.deploy(towater);
};

enter image description here

  • Check in the migration file if you are specifying the constructor arguments of towater. – alberto Jun 26 at 18:54
  • How I do this? Check my migration file – MrAbade Jun 26 at 19:07
  • The constructor of towater have 2 params, string[] and bytes16[] – MrAbade Jun 26 at 19:09
0

To solve the error you need to pass the arguments of the constructor in your migration file.

Based on your two params:

// Untested
// Deploy a single contract with constructor arguments
deployer.deploy(towater, ["string_1", "string_2"], ["0x15458ef540ade6068dfe2f44e8fa733c", "0x15458ef540ade6068dfe2f44e8fa734c"] );

Check the Truffle docs.

  • Thank you so muchhhhh, you helped me a lot! – MrAbade Jun 26 at 21:48

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.