Skip to content

Instantly share code, notes, and snippets.

@Arachnid
Created March 12, 2019 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arachnid/d3907ce944d5a93694ac707f60f08a83 to your computer and use it in GitHub Desktop.
Save Arachnid/d3907ce944d5a93694ac707f60f08a83 to your computer and use it in GitHub Desktop.
object "Create2Proxy" {
code {
let size := datasize("runtime")
datacopy(0, dataoffset("runtime"), size)
return(0, size)
}
object "runtime" {
code {
let salt := calldataload(0)
let size := sub(calldatasize(), 32)
calldatacopy(0, 32, size)
let addr := create2(callvalue(), 0, size, salt)
mstore(0, addr)
return(0, 32)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment