Skip to content

Instantly share code, notes, and snippets.

@bjoveski
Created August 9, 2019 20:30
Show Gist options
  • Save bjoveski/874b94ced0f68c25dcdac3decc42c01b to your computer and use it in GitHub Desktop.
Save bjoveski/874b94ced0f68c25dcdac3decc42c01b to your computer and use it in GitHub Desktop.
function buildCreate2Address(senderAddress, saltHex, bytecode) {
return web3.utils.toChecksumAddress(`0x${web3.utils.sha3(`0x${[
'ff',
senderAddress,
saltHex,
web3.utils.sha3(bytecode)
].map(x => x.replace(/0x/, ''))
.join('')}`).slice(-40)}`);
}
@itxtoledo
Copy link

can u send an example how this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment