Skip to content

Instantly share code, notes, and snippets.

@yakkomajuri
Created February 23, 2019 21:42
Show Gist options
  • Save yakkomajuri/9c91afcb8af70dcf0b5ace1d9f5bb734 to your computer and use it in GitHub Desktop.
Save yakkomajuri/9c91afcb8af70dcf0b5ace1d9f5bb734 to your computer and use it in GitHub Desktop.
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