Skip to content

Instantly share code, notes, and snippets.

@scottt
Created November 12, 2019 14:39
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 scottt/d0d2201ef9d144be0b5e73c360c8d648 to your computer and use it in GitHub Desktop.
Save scottt/d0d2201ef9d144be0b5e73c360c8d648 to your computer and use it in GitHub Desktop.
pragma solidity >=0.4.21 <0.6.0;
contract Migrations {
address public owner;
uint public last_completed_migration;
constructor() public {
owner = msg.sender;
}
modifier restricted() {
if (msg.sender == owner) _;
}
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