繁体   English   中英

在 Solidity 中为智能合约编写迁移

[英]Writing migration for Smart Contract in Solidity

我正在尝试为一些智能合约编写迁移,编译器中出现了这个错误。

Error:   Deployment Failed 

"MasterChefV2" -- Invalid number of parameters for "undefined". Got 2 expected 5!.

这是我的迁移 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);
  };

这是 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;
    }

这仅仅是因为在部署期间您只提供了 2 个参数。 显然需要 5 个。

迁移文件仅找到以下 2 个参数:

  • EGGToken.sol
  • 您的开发地址(从您调用部署的地方)

您需要手动添加其他 3 个:

  • 开始块
  • 收费地址
  • 每块 EGG

暂无
暂无

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

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