松露迁移 使用网络'发展'。
Person
我的Solidity文件(Migration.sol)
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
我的迁移文件 1_initial_migration.js
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);
}
}
松露版 Truffle v4.1.11(核心:4.1.11) Solidity v0.4.24(solc-js)
答案 0 :(得分:2)
删除构造函数参数“Migrations”,它不会在任何地方使用。当我删除“迁移”参数时,它正在工作。使用方法如下:
constructor() public {
owner = msg.sender;
}
答案 1 :(得分:-1)
如果在 Ganache 上更改为 Instabul 或更改您所在的 CHAIN