InstaContract/contracts/Migrations.sol

28 lines
608 B
Solidity
Raw Permalink Normal View History

2019-02-22 17:00:57 +00:00
pragma solidity 0.5.0;
2018-10-23 07:52:31 +00:00
/* solium-disable mixedcase */
contract Migrations {
2018-10-24 17:22:58 +00:00
address public owner;
uint public last_completed_migration;
2018-10-23 07:52:31 +00:00
2018-10-24 17:22:58 +00:00
modifier restricted() {
if (msg.sender == owner) _;
2018-10-24 17:22:58 +00:00
}
2018-10-23 07:52:31 +00:00
constructor() public {
2018-10-24 17:22:58 +00:00
owner = msg.sender;
}
2018-10-23 07:52:31 +00:00
2018-10-24 17:22:58 +00:00
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
2018-10-23 07:52:31 +00:00
2018-10-24 17:22:58 +00:00
function upgrade(address _newAddress) public restricted {
Migrations upgraded = Migrations(_newAddress);
upgraded.setCompleted(last_completed_migration);
}
2018-10-23 07:52:31 +00:00
}
/* solium-enable mixedcase */