Created
October 4, 2020 18:52
-
-
Save alerdenisov/fdb3921003afafc497ba0e43506ebe67 to your computer and use it in GitHub Desktop.
Proxy all calls
This file contains hidden or 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 Proxy { | |
fallback() external payable { | |
assembly { | |
let len := calldatasize() | |
calldatacopy(0, 0, len) | |
let addr := mload(0x0) | |
let result := delegatecall(gas(), addr, 0x20, sub(len, 0x20), 0, 0) | |
returndatacopy(0, 0, returndatasize()) | |
switch result | |
case 0 { revert(0, returndatasize()) } | |
default { return(0, returndatasize()) } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment