Migrate to Hardhat (#2397)
This commit is contained in:
@ -1,13 +1,11 @@
|
||||
const { contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { expectRevert } = require('@openzeppelin/test-helpers');
|
||||
|
||||
const { assert } = require('chai');
|
||||
|
||||
const InitializableMock = contract.fromArtifact('InitializableMock');
|
||||
const SampleChild = contract.fromArtifact('SampleChild');
|
||||
const InitializableMock = artifacts.require('InitializableMock');
|
||||
const SampleChild = artifacts.require('SampleChild');
|
||||
|
||||
describe('Initializable', function () {
|
||||
contract('Initializable', function (accounts) {
|
||||
describe('basic testing without inheritance', function () {
|
||||
beforeEach('deploying', async function () {
|
||||
this.contract = await InitializableMock.new();
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { expectRevert } = require('@openzeppelin/test-helpers');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const ImplV1 = contract.fromArtifact('DummyImplementation');
|
||||
const ImplV2 = contract.fromArtifact('DummyImplementationV2');
|
||||
const ProxyAdmin = contract.fromArtifact('ProxyAdmin');
|
||||
const TransparentUpgradeableProxy = contract.fromArtifact('TransparentUpgradeableProxy');
|
||||
const ImplV1 = artifacts.require('DummyImplementation');
|
||||
const ImplV2 = artifacts.require('DummyImplementationV2');
|
||||
const ProxyAdmin = artifacts.require('ProxyAdmin');
|
||||
const TransparentUpgradeableProxy = artifacts.require('TransparentUpgradeableProxy');
|
||||
|
||||
describe('ProxyAdmin', function () {
|
||||
contract('ProxyAdmin', function (accounts) {
|
||||
const [proxyAdminOwner, newAdmin, anotherAccount] = accounts;
|
||||
|
||||
before('set implementations', async function () {
|
||||
|
||||
@ -1,22 +1,20 @@
|
||||
const { contract, web3 } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { BN, expectRevert, expectEvent, constants } = require('@openzeppelin/test-helpers');
|
||||
const { ZERO_ADDRESS } = constants;
|
||||
const { toChecksumAddress, keccak256 } = require('ethereumjs-util');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const Proxy = contract.fromArtifact('Proxy');
|
||||
const Implementation1 = contract.fromArtifact('Implementation1');
|
||||
const Implementation2 = contract.fromArtifact('Implementation2');
|
||||
const Implementation3 = contract.fromArtifact('Implementation3');
|
||||
const Implementation4 = contract.fromArtifact('Implementation4');
|
||||
const MigratableMockV1 = contract.fromArtifact('MigratableMockV1');
|
||||
const MigratableMockV2 = contract.fromArtifact('MigratableMockV2');
|
||||
const MigratableMockV3 = contract.fromArtifact('MigratableMockV3');
|
||||
const InitializableMock = contract.fromArtifact('InitializableMock');
|
||||
const DummyImplementation = contract.fromArtifact('DummyImplementation');
|
||||
const ClashingImplementation = contract.fromArtifact('ClashingImplementation');
|
||||
const Proxy = artifacts.require('Proxy');
|
||||
const Implementation1 = artifacts.require('Implementation1');
|
||||
const Implementation2 = artifacts.require('Implementation2');
|
||||
const Implementation3 = artifacts.require('Implementation3');
|
||||
const Implementation4 = artifacts.require('Implementation4');
|
||||
const MigratableMockV1 = artifacts.require('MigratableMockV1');
|
||||
const MigratableMockV2 = artifacts.require('MigratableMockV2');
|
||||
const MigratableMockV3 = artifacts.require('MigratableMockV3');
|
||||
const InitializableMock = artifacts.require('InitializableMock');
|
||||
const DummyImplementation = artifacts.require('DummyImplementation');
|
||||
const ClashingImplementation = artifacts.require('ClashingImplementation');
|
||||
|
||||
const IMPLEMENTATION_LABEL = 'eip1967.proxy.implementation';
|
||||
const ADMIN_LABEL = 'eip1967.proxy.admin';
|
||||
@ -409,7 +407,7 @@ module.exports = function shouldBehaveLikeTransparentUpgradeableProxy (createPro
|
||||
await proxy.upgradeTo(instance4.address, { from: proxyAdminAddress });
|
||||
const proxyInstance4 = new Implementation4(proxy.address);
|
||||
|
||||
const data = '';
|
||||
const data = '0x';
|
||||
await web3.eth.sendTransaction({ to: proxy.address, from: anotherAccount, data });
|
||||
|
||||
const res = await proxyInstance4.getValue();
|
||||
@ -423,7 +421,7 @@ module.exports = function shouldBehaveLikeTransparentUpgradeableProxy (createPro
|
||||
const instance2 = await Implementation2.new();
|
||||
await proxy.upgradeTo(instance2.address, { from: proxyAdminAddress });
|
||||
|
||||
const data = '';
|
||||
const data = '0x';
|
||||
await expectRevert.unspecified(
|
||||
web3.eth.sendTransaction({ to: proxy.address, from: anotherAccount, data }),
|
||||
);
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const shouldBehaveLikeUpgradeableProxy = require('./UpgradeableProxy.behaviour');
|
||||
const shouldBehaveLikeTransparentUpgradeableProxy = require('./TransparentUpgradeableProxy.behaviour');
|
||||
|
||||
const TransparentUpgradeableProxy = contract.fromArtifact('TransparentUpgradeableProxy');
|
||||
const TransparentUpgradeableProxy = artifacts.require('TransparentUpgradeableProxy');
|
||||
|
||||
describe('TransparentUpgradeableProxy', function () {
|
||||
contract('TransparentUpgradeableProxy', function (accounts) {
|
||||
const [proxyAdminAddress, proxyAdminOwner] = accounts;
|
||||
|
||||
const createProxy = async function (logic, admin, initData, opts) {
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
const { contract, web3 } = require('@openzeppelin/test-environment');
|
||||
|
||||
const { BN, expectRevert } = require('@openzeppelin/test-helpers');
|
||||
const { toChecksumAddress, keccak256 } = require('ethereumjs-util');
|
||||
|
||||
const { expect } = require('chai');
|
||||
|
||||
const DummyImplementation = contract.fromArtifact('DummyImplementation');
|
||||
const DummyImplementation = artifacts.require('DummyImplementation');
|
||||
|
||||
const IMPLEMENTATION_LABEL = 'eip1967.proxy.implementation';
|
||||
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
const { accounts, contract } = require('@openzeppelin/test-environment');
|
||||
|
||||
const shouldBehaveLikeUpgradeableProxy = require('./UpgradeableProxy.behaviour');
|
||||
|
||||
const UpgradeableProxy = contract.fromArtifact('UpgradeableProxy');
|
||||
const UpgradeableProxy = artifacts.require('UpgradeableProxy');
|
||||
|
||||
describe('UpgradeableProxy', function () {
|
||||
contract('UpgradeableProxy', function (accounts) {
|
||||
const [proxyAdminOwner] = accounts;
|
||||
|
||||
const createProxy = async function (implementation, _admin, initData, opts) {
|
||||
|
||||
Reference in New Issue
Block a user