Created
June 1, 2017 23:21
-
-
Save joeykrug/8e3766acf6d20d885723f63f02c26a7e 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
contract Dispatcher is Upgradeable { | |
function Dispatcher(address target) { | |
replace(target); | |
} | |
function initialize() { | |
// Should only be called by on target contracts, not on the dispatcher | |
throw; | |
} | |
function() { | |
bytes4 sig; | |
assembly { sig := calldataload(0) } | |
var len = _sizes[sig]; | |
var target = _dest; | |
assembly { | |
// return _dest.delegatecall(msg.data) | |
calldatacopy(0x0, 0x0, calldatasize) | |
delegatecall(sub(gas, 10000), target, 0x0, calldatasize, 0, len) | |
return(0, len) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment