Skip to content

Instantly share code, notes, and snippets.

@axic
Created February 28, 2019 22:37
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save axic/77abd49f70ffb5944f04178ae5308d6c to your computer and use it in GitHub Desktop.
CREATE2 proxy for constantinople/petersburg
// 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