Migrations.sol 548 B

12345678910111213141516171819202122232425
  1. pragma solidity ^0.4.21;
  2. contract Migrations {
  3. address public owner;
  4. uint public lastCompletedMigration;
  5. modifier restricted() {
  6. if (msg.sender == owner) _;
  7. }
  8. function Migrations() public {
  9. owner = msg.sender;
  10. }
  11. function setCompleted(uint completed) public restricted {
  12. lastCompletedMigration = completed;
  13. }
  14. function upgrade(address newAddress) public restricted {
  15. Migrations upgraded = Migrations(newAddress);
  16. upgraded.setCompleted(lastCompletedMigration);
  17. }
  18. }