Created
February 23, 2019 21:42
-
-
Save yakkomajuri/9c91afcb8af70dcf0b5ace1d9f5bb734 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity^0.5.0; | |
contract Registry { | |
address owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
mapping(address => bool) hasUpdated; | |
address[] implementations; | |
function update() public { | |
hasUpdated[msg.sender] = true; | |
} | |
function addImplementation(address _impl) public { | |
require(msg.sender == owner); | |
implementations.push(_impl); | |
} | |
function getImplementation(address _user) public view returns (address) { | |
if (hasUpdated[_user]) { | |
return implementations[1]; | |
} | |
else { | |
return implementations[0]; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment