Skip to content

Instantly share code, notes, and snippets.

@alerdenisov
Created October 4, 2020 18:52
Show Gist options
  • Save alerdenisov/fdb3921003afafc497ba0e43506ebe67 to your computer and use it in GitHub Desktop.
Save alerdenisov/fdb3921003afafc497ba0e43506ebe67 to your computer and use it in GitHub Desktop.
Proxy all calls
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