Skip to content

Instantly share code, notes, and snippets.

@timbeiko
Created August 26, 2018 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timbeiko/c60e384c6a2c0644106c37a66a0f28a6 to your computer and use it in GitHub Desktop.
Save timbeiko/c60e384c6a2c0644106c37a66a0f28a6 to your computer and use it in GitHub Desktop.
pragma solidity 0.4.24;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
constructor() public {
owner = msg.sender;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment