简体   繁体   English

我遇到错误:“收件箱”——“未定义”的参数数量无效。 得到 0 预期 1

[英]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这是在迁移中部署的合同

This is my smart contract code这是我的智能合约代码

error i got我得到的错误

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.

相关问题 错误:“未定义”的参数数量无效。 得到 0 预期 1 - Error: Invalid number of parameters for "undefined". Got 0 expected 1 "Solidity 错误 :: ParserError: Expected ',' but got 'Number'" - Solidity Error :: ParserError: Expected ',' but got 'Number' " 预期 '(' 但得到标识符 " & " 解析错误:不匹配的输入 '{' 期望 {';', '='} [未定义] " - " Expected '(' but got identifier " & " Parse error: mismatched input '{' expecting {';', '='} [undefined] " 大家好,我收到一条错误消息 - ParserError: Expected ';' 但是得到了“合同”合同令牌。如果有人可以帮助我,那将非常有帮助。谢谢 - Hi All, I am getting an error says - ParserError: Expected ';' but got 'contract' contract Token.If someone can help me that'd be very helpful.Thanks 无法解决 Solidity 错误 - ParserError: Expected ';' 但得到了“数字”-> first.sol:2:17: | 2 | Pragma 坚固性 0.8.7; | ^^^ - Unable to solve solidity error- ParserError: Expected ';' but got 'Number' --> first.sol:2:17: | 2 | Pragma solidity 0.8.7; | ^^^ Solidity 错误:: ParserError: Expected '(' but got 'public' - Solidity Error :: ParserError: Expected '(' but got 'public' 预期的 ';' 但是得到了','但是在a.sol文件中没有出现同样的错误 - Expected ';' but got ',' but below that same error doesn't appear in a .sol file 坚固性:ParserError:预期';' 但得到'(' - solidity: ParserError: Expected ';' but got '(' 在下面的代码中得到一个解析错误,上面写着“预期的'('但有一个标识符” - Getting a parse error in the following code which says "expected '(' but got an identifier" 当我传递智能合约函数的数组时,它给我的错误是:“实体函数的参数数量无效”,为什么? - When I am passing array of my smart contract function it is giving me errors saying “invalid number of arguments to solidity function” Why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM