Migrations.sol 514 B

123456789101112131415161718192021222324
  1. pragma solidity ^0.4.2;
  2. contract Migrations {
  3. address public owner;
  4. uint public last_completed_migration;
  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. last_completed_migration = completed;
  13. }
  14. function upgrade(address new_address) public restricted {
  15. Migrations upgraded = Migrations(new_address);
  16. upgraded.setCompleted(last_completed_migration);
  17. }
  18. }