Rename CREATE2 argument from bytecodeHash to bytecode and add new method for precomputed bytecode hash (#2087)

* Rename CREATE2 argument from bytecodeHash to bytecode and add new method for precomputed bytecode hash

* Remove only from test

* Fix linter error
This commit is contained in:
Anton Bukov
2020-02-14 17:29:38 +03:00
committed by GitHub
parent 5dfe7215a9
commit 19417c7cd5
3 changed files with 25 additions and 4 deletions

View File

@ -30,7 +30,17 @@ describe('Create2', function () {
it('should compute the correct contract address with deployer', async function () {
const onChainComputed = await this.factory
.computeAddress(saltHex, constructorByteCode, deployerAccount);
.methods['computeAddress(bytes32,bytes,address)'](saltHex, constructorByteCode, deployerAccount);
const offChainComputed =
computeCreate2Address(saltHex, constructorByteCode, deployerAccount);
expect(onChainComputed).to.equal(offChainComputed);
});
it('should compute the correct contract address with deployer and bytecode hash', async function () {
const onChainComputed = await this.factory
.methods['computeAddress(bytes32,bytes32,address)'](
saltHex, web3.utils.keccak256(constructorByteCode), deployerAccount
);
const offChainComputed =
computeCreate2Address(saltHex, constructorByteCode, deployerAccount);
expect(onChainComputed).to.equal(offChainComputed);