Migrations.sol 507 B

123456789101112131415161718192021222324
  1. pragma solidity ^0.4.23;
  2. contract Migrations {
  3. address public owner;
  4. uint public last_completed_migration;
  5. constructor() public {
  6. owner = msg.sender;
  7. }
  8. modifier restricted() {
  9. if (msg.sender == owner) _;
  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. }