Created
February 28, 2019 22:37
-
-
Save axic/77abd49f70ffb5944f04178ae5308d6c to your computer and use it in GitHub Desktop.
CREATE2 proxy for constantinople/petersburg
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
// CREATE2 proxy for constantinople/petersburg which allows easy deploying of | |
// contracts using the same address on multiple chains. | |
// | |
// Idea by @Arachnid. Some code by @axic. | |
pragma solidity ^0.5.0; | |
contract Create2Proxy { | |
function() external payable { | |
assembly { | |
let payload_length := sub(calldatasize(), 32) | |
calldatacopy(0, 32, payload_length) | |
mstore(0, create2(callvalue(), 0, payload_length, calldataload(0))) | |
return(0, 32) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment