Skip to content

Instantly share code, notes, and snippets.

@Arachnid
Created May 13, 2019 21:54
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/bdd420401c1589ec6c21b3c60b8338dd to your computer and use it in GitHub Desktop.
Save Arachnid/bdd420401c1589ec6c21b3c60b8338dd 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