Zoha Akram
Zoha Akram

Reputation: 45

I am having error : "Inbox" -- Invalid number of parameters for "undefined". Got 0 expected 1

I am writing a simple smart contract namely 'inbox.sol'. I am using truffle framework to test and deploy it to the rinkeby network using Infura API. I am having this error. Please help. I'm a beginner.

This is deployed contract in migration

This is my smart contract code

error i got

Upvotes: 1

Views: 291

Answers (1)

Yilmaz
Yilmaz

Reputation: 49291

Your contract has a constructor and expects an argument.

constructor(string memory initialMessage) public {
        message = initialMessage;
    }

So when you deploy it you have to pass an argument.

const Inbox = artifacts.require("Inbox");

module.exports = function (deployer) {
  // passing an argument 
  deployer.deploy(Inbox, "myInitialMessage");
};

Upvotes: 1

Related Questions