Skip to content

Instantly share code, notes, and snippets.

@0xdewy
Last active June 17, 2019 07:51
Show Gist options
  • Save 0xdewy/557253586ed3f109c94f3593b4ad43c9 to your computer and use it in GitHub Desktop.
Save 0xdewy/557253586ed3f109c94f3593b4ad43c9 to your computer and use it in GitHub Desktop.
Fallback function of Proxy contraact
function ()
payable
external {
address implementation = Resolver(resolver()).getUserVersion(msg.sender);
require(implementation != address(0), "INVALID IMPLEMENTATION");
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize) // Copy incoming calldata
let result := delegatecall(gas, implementation, ptr, calldatasize, 0, 0)
let size := returndatasize
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment