Migrate MerkleProof tests among other testing utilities (#4689)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
const { ethers } = require('ethers');
|
||||
const { expectEvent } = require('@openzeppelin/test-helpers');
|
||||
const { expect } = require('chai');
|
||||
const { computeCreate2Address } = require('../helpers/create');
|
||||
const { expectRevertCustomError } = require('../helpers/customError');
|
||||
|
||||
const shouldBehaveLikeClone = require('./Clones.behaviour');
|
||||
@ -52,7 +52,7 @@ contract('Clones', function (accounts) {
|
||||
'5af43d82803e903d91602b57fd5bf3',
|
||||
].join('');
|
||||
|
||||
expect(computeCreate2Address(salt, creationCode, factory.address)).to.be.equal(predicted);
|
||||
expect(ethers.getCreate2Address(factory.address, salt, ethers.keccak256(creationCode))).to.be.equal(predicted);
|
||||
|
||||
expectEvent(await factory.$cloneDeterministic(implementation, salt), 'return$cloneDeterministic', {
|
||||
instance: predicted,
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
const { ethers } = require('hardhat');
|
||||
const { expectRevert } = require('@openzeppelin/test-helpers');
|
||||
const { expect } = require('chai');
|
||||
const ImplV1 = artifacts.require('DummyImplementation');
|
||||
@ -8,7 +9,6 @@ const ITransparentUpgradeableProxy = artifacts.require('ITransparentUpgradeableP
|
||||
|
||||
const { getAddressInSlot, ImplementationSlot } = require('../../helpers/erc1967');
|
||||
const { expectRevertCustomError } = require('../../helpers/customError');
|
||||
const { computeCreateAddress } = require('../../helpers/create');
|
||||
|
||||
contract('ProxyAdmin', function (accounts) {
|
||||
const [proxyAdminOwner, anotherAccount] = accounts;
|
||||
@ -23,7 +23,7 @@ contract('ProxyAdmin', function (accounts) {
|
||||
const proxy = await TransparentUpgradeableProxy.new(this.implementationV1.address, proxyAdminOwner, initializeData);
|
||||
|
||||
const proxyNonce = await web3.eth.getTransactionCount(proxy.address);
|
||||
const proxyAdminAddress = computeCreateAddress(proxy.address, proxyNonce - 1); // Nonce already used
|
||||
const proxyAdminAddress = ethers.getCreateAddress({ from: proxy.address, nonce: proxyNonce - 1 }); // Nonce already used
|
||||
this.proxyAdmin = await ProxyAdmin.at(proxyAdminAddress);
|
||||
|
||||
this.proxy = await ITransparentUpgradeableProxy.at(proxy.address);
|
||||
|
||||
@ -4,8 +4,7 @@ const { getAddressInSlot, ImplementationSlot, AdminSlot } = require('../../helpe
|
||||
const { expectRevertCustomError } = require('../../helpers/customError');
|
||||
|
||||
const { expect } = require('chai');
|
||||
const { web3 } = require('hardhat');
|
||||
const { computeCreateAddress } = require('../../helpers/create');
|
||||
const { ethers, web3 } = require('hardhat');
|
||||
const { impersonate } = require('../../helpers/account');
|
||||
|
||||
const Implementation1 = artifacts.require('Implementation1');
|
||||
@ -27,7 +26,7 @@ module.exports = function shouldBehaveLikeTransparentUpgradeableProxy(createProx
|
||||
const proxy = await createProxy(logic, initData, opts);
|
||||
|
||||
// Expect proxy admin to be the first and only contract created by the proxy
|
||||
const proxyAdminAddress = computeCreateAddress(proxy.address, 1);
|
||||
const proxyAdminAddress = ethers.getCreateAddress({ from: proxy.address, nonce: 1 });
|
||||
await impersonate(proxyAdminAddress);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user