[英]I am having error : "Inbox" -- Invalid number of parameters for "undefined". Got 0 expected 1
我正在編寫一個簡單的智能合約,即“inbox.sol”。 我正在使用 truffle 框架進行測試並將其部署到使用 Infura API 的 rinkeby 網絡。 我有這個錯誤。 請幫忙。 我是初學者。
你的合約有一個構造函數並且需要一個參數。
constructor(string memory initialMessage) public {
message = initialMessage;
}
因此,當您部署它時,您必須傳遞一個參數。
const Inbox = artifacts.require("Inbox");
module.exports = function (deployer) {
// passing an argument
deployer.deploy(Inbox, "myInitialMessage");
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.