[英]Writing migration for Smart Contract in Solidity
I'm trying to write a migration for some smart contracts and this error comes up in the compiler.我正在尝试为一些智能合约编写迁移,编译器中出现了这个错误。
Error: Deployment Failed
"MasterChefV2" -- Invalid number of parameters for "undefined". Got 2 expected 5!.
Here is my migration js:这是我的迁移 js:
const Masterchef = artifacts.require('MasterChefV2.sol');
const EGG = artifacts.require('EggToken.sol');
const Timelock = artifacts.require('Timelock.sol');
module.exports = function (deployer) {
deployer.deploy(Masterchef, EGG, Timelock);
};
and this is the MasterChefV2 constructor这是 MasterChefV2 构造函数
constructor(
EggToken _egg,
address _devaddr,
address _feeAddress,
uint256 _eggPerBlock,
uint256 _startBlock
) public {
egg = _egg;
`enter code here` devaddr = _devaddr;
feeAddress = _feeAddress;
eggPerBlock = _eggPerBlock;
startBlock = _startBlock;
}
It's simply because during the deployement you give only 2 parameters.这仅仅是因为在部署期间您只提供了 2 个参数。 And obviously 5 are needed.
显然需要 5 个。
Migration file only find the 2 follow parameters:迁移文件仅找到以下 2 个参数:
You need to add manually the 3 others:您需要手动添加其他 3 个:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.