[英]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'.我正在编写一个简单的智能合约,即“inbox.sol”。 I am using truffle framework to test and deploy it to the rinkeby network using Infura API.
我正在使用 truffle 框架进行测试并将其部署到使用 Infura API 的 rinkeby 网络。 I am having this error.
我有这个错误。 Please help.
请帮忙。 I'm a beginner.
我是初学者。
This is deployed contract in migration这是在迁移中部署的合同
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");
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.