[英]Blockchain truffle Migration Error
truffle migrate 使用网络“开发”。
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)
移除构造函数参数“Migrations”,该参数在任何地方都不使用。 当我删除“迁移”参数时它正在工作。 使用如下:
constructor() public {
owner = msg.sender;
}
如果在 Ganache 上更改为 Instabul 或更改您所在的 CHAIN
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.