简体   繁体   English

执行truffle.migrate时发生错误,“ undefined”的参数数量无效

[英]An error when executing truffle.migrate, Invalid number of parameters for “undefined”

I'am trying to deploy a smart contract : 我正在尝试部署智能合约:

` `
pragma solidity >=0.4.21; 语用强度> = 0.4.21;

contract SimpleStorage {
uint public storedData;

constructor(uint initVal) public {
storedData = initVal;
}

function set(uint x) public {
storedData = x;
}

function get() view public returns (uint retVal) {
return storedData;
}
}`

I have created 2_deploy.js 我已经创建了2_deploy.js

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

module.exports = function(deployer) {
// Pass 42 to the contract as the first constructor parameter
deployer.deploy(SimpleStorage, 42, {privateFor: 
["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]})
};

but when I execute truffle.migration I obtain this error: 但是当我执行truffle.migration时,出现以下错误:

 'Error encountered, bailing. Network state unknown. Review 
 successful transactions manually.
  Error: Invalid number of parameters for "undefined". Got 2 
  expected 1!
at Object.InvalidNumberOfParams 
 (/usr/lib/node_modules/truffle/build/webpack:/~/web3-eth- 
contract/~/web3-core-helpers/src/errors.js:32:1)
at Object._createTxObject 
(/usr/lib/node_modules/truffle/build/webpack:/~/web3-eth- 
contract/src/index.js:699:1)
 at Contract.deploy 
(/usr/lib/node_modules/truffle/build/webpack:/~/web3-eth- 
contract/src/index.js:504:1)
at Function.deploy 
(/usr/lib/node_modules/truffle/build/webpack:/packages/truffle- 
contract/lib/execute.js:214:1)
at constructor.detectNetwork.then.network 
(/usr/lib/node_modules/truffle/build/webpack:/packages/truffle- 
contract/lib/contract/constructorMethods.js:56:1)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)        
Truffle v5.0.13 (core: 5.0.13)
Node v8.9.4''

do anyone knows how to deal with the problem? 有谁知道如何处理这个问题?

Truffle has only recently added support for quorum private transactions. Truffle直到最近才增加了对法定私人交易的支持。 So you need Truffle version 5.0.14. 因此,您需要Truffle 5.0.14版。 I hope that helps. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM