-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Benjamin Cosman
committed
Apr 24, 2018
1 parent
1aebb74
commit c19bb7e
Showing
1 changed file
with
14 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
pragma solidity ^0.4.21; | ||
|
||
contract Migrations { | ||
address public owner; | ||
uint public last_completed_migration; | ||
import "zeppelin-solidity/contracts/ownership/Ownable.sol"; | ||
|
||
modifier restricted() { | ||
if (msg.sender == owner) _; | ||
} | ||
// This is a truffle contract, needed for truffle integration. | ||
contract Migrations is Ownable { | ||
uint256 public lastCompletedMigration; | ||
|
||
function Migrations() public { | ||
owner = msg.sender; | ||
} | ||
function Migrations() public { | ||
owner = msg.sender; | ||
} | ||
|
||
function setCompleted(uint completed) public restricted { | ||
last_completed_migration = completed; | ||
} | ||
function setCompleted(uint _completed) public onlyOwner { | ||
lastCompletedMigration = _completed; | ||
} | ||
|
||
function upgrade(address new_address) public restricted { | ||
Migrations upgraded = Migrations(new_address); | ||
upgraded.setCompleted(last_completed_migration); | ||
} | ||
function upgrade(address _newAddress) public onlyOwner { | ||
Migrations upgraded = Migrations(_newAddress); | ||
upgraded.setCompleted(lastCompletedMigration); | ||
} | ||
} |