【问题标题】:Blockchain truffle Migration Error区块链松露迁移错误
【发布时间】:2018-06-08 08:32:49
【问题描述】:

松露迁移 使用网络“开发”。

Running migration: 1_initial_migration.js   Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful
transactions manually. Error: Migrations contract constructor expected
1 arguments, received 0
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-contract/contract.js:390:1

我的 Solidity 文件(Migration.sol)

pragma solidity ^0.4.17;

contract Migrations {
  address public owner;
  uint public last_completed_migration;

  modifier restricted() {
    if (msg.sender == owner) _;
  }

  constructor(Migrations) public {
    owner = msg.sender;
  }

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
  }

  function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);
    upgraded.setCompleted(last_completed_migration);
  }
}

我的迁移文件 1_initial_migration.js

var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

松露版 松露 v4.1.11(核心:4.1.11) Solidity v0.4.24 (solc-js)

【问题讨论】:

    标签: blockchain truffle consensys-truffle


    【解决方案1】:

    删除构造函数参数“Migrations”,它在任何地方都没有使用。当我删除“迁移”参数时它正在工作。如下使用:

    constructor() public {
        owner = msg.sender;
      }
    

    【讨论】:

      【解决方案2】:

      如果在 Ganache 上更改为 Instabul 或更改您所在的 CHAIN

      【讨论】:

        猜你喜欢
        • 2022-08-05
        • 1970-01-01
        • 2021-03-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-17
        • 1970-01-01
        相关资源
        最近更新 更多