Skip to content

Instantly share code, notes, and snippets.

@zmitton
Created December 7, 2016 22:14
Show Gist options
  • Save zmitton/dca7bb5e4ede7c9c50ff7aaa7d51577c to your computer and use it in GitHub Desktop.
Save zmitton/dca7bb5e4ede7c9c50ff7aaa7d51577c to your computer and use it in GitHub Desktop.
contract ContractProxy {
address public owner;
address public destination;
modifier onlyOwner(){ if (msg.sender == owner) _; }
function ProxyDapp(){ owner = msg.sender; }
//main function called by all users
function forward(bytes data) {
if (!destination.delegatecall(data)) { throw; }
}
//upgrade by deploying a new contract and simply updating this address
function upgradeDestinationAddress(address _destination) onlyOwner {
destination = _destination;
}
//pass 0x0 to reliquish superhuman ownership powers
function transferOwner(address _owner) onlyOwner { owner = _owner; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment