Revert unwanted breaking change in the Clones library (#3456)

Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
Hadrien Croubois
2022-06-06 22:41:48 +02:00
committed by GitHub
parent 54ce38c2e5
commit 051cc9e446
5 changed files with 43 additions and 26 deletions

View File

@ -1,4 +1,6 @@
const { expectEvent, expectRevert } = require('@openzeppelin/test-helpers');
const { computeCreate2Address } = require('../helpers/create2');
const { expect } = require('chai');
const shouldBehaveLikeClone = require('./Clones.behaviour');
@ -44,6 +46,19 @@ contract('Clones', function (accounts) {
const salt = web3.utils.randomHex(32);
const factory = await ClonesMock.new();
const predicted = await factory.predictDeterministicAddress(implementation, salt);
const creationCode = [
'0x3d602d80600a3d3981f3363d3d373d3d3d363d73',
implementation.replace(/0x/, '').toLowerCase(),
'5af43d82803e903d91602b57fd5bf3',
].join('');
expect(computeCreate2Address(
salt,
creationCode,
factory.address,
)).to.be.equal(predicted);
expectEvent(
await factory.cloneDeterministic(implementation, salt, '0x'),
'NewInstance',