Rename UpgradeableProxy to ERC1967Proxy (#2547)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
This commit is contained in:
13
test/proxy/ERC1967/ERC1967Proxy.test.js
Normal file
13
test/proxy/ERC1967/ERC1967Proxy.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const shouldBehaveLikeProxy = require('../Proxy.behaviour');
|
||||
|
||||
const ERC1967Proxy = artifacts.require('ERC1967Proxy');
|
||||
|
||||
contract('ERC1967Proxy', function (accounts) {
|
||||
const [proxyAdminOwner] = accounts;
|
||||
|
||||
const createProxy = async function (implementation, _admin, initData, opts) {
|
||||
return ERC1967Proxy.new(implementation, initData, opts);
|
||||
};
|
||||
|
||||
shouldBehaveLikeProxy(createProxy, undefined, proxyAdminOwner);
|
||||
});
|
||||
@ -11,7 +11,7 @@ function toChecksumAddress (address) {
|
||||
return ethereumjsUtil.toChecksumAddress('0x' + address.replace(/^0x/, '').padStart(40, '0'));
|
||||
}
|
||||
|
||||
module.exports = function shouldBehaveLikeUpgradeableProxy (createProxy, proxyAdminAddress, proxyCreator) {
|
||||
module.exports = function shouldBehaveLikeProxy (createProxy, proxyAdminAddress, proxyCreator) {
|
||||
it('cannot be initialized with a non-contract address', async function () {
|
||||
const nonContractAddress = proxyCreator;
|
||||
const initializeData = Buffer.from('');
|
||||
@ -1,13 +0,0 @@
|
||||
const shouldBehaveLikeUpgradeableProxy = require('./UpgradeableProxy.behaviour');
|
||||
|
||||
const UpgradeableProxy = artifacts.require('UpgradeableProxy');
|
||||
|
||||
contract('UpgradeableProxy', function (accounts) {
|
||||
const [proxyAdminOwner] = accounts;
|
||||
|
||||
const createProxy = async function (implementation, _admin, initData, opts) {
|
||||
return UpgradeableProxy.new(implementation, initData, opts);
|
||||
};
|
||||
|
||||
shouldBehaveLikeUpgradeableProxy(createProxy, undefined, proxyAdminOwner);
|
||||
});
|
||||
@ -80,7 +80,7 @@ module.exports = function shouldBehaveLikeTransparentUpgradeableProxy (createPro
|
||||
it('reverts', async function () {
|
||||
await expectRevert(
|
||||
this.proxy.upgradeTo(ZERO_ADDRESS, { from }),
|
||||
'UpgradeableProxy: new implementation is not a contract',
|
||||
'ERC1967Proxy: new implementation is not a contract',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const shouldBehaveLikeUpgradeableProxy = require('../UpgradeableProxy.behaviour');
|
||||
const shouldBehaveLikeProxy = require('../Proxy.behaviour');
|
||||
const shouldBehaveLikeTransparentUpgradeableProxy = require('./TransparentUpgradeableProxy.behaviour');
|
||||
|
||||
const TransparentUpgradeableProxy = artifacts.require('TransparentUpgradeableProxy');
|
||||
@ -10,6 +10,6 @@ contract('TransparentUpgradeableProxy', function (accounts) {
|
||||
return TransparentUpgradeableProxy.new(logic, admin, initData, opts);
|
||||
};
|
||||
|
||||
shouldBehaveLikeUpgradeableProxy(createProxy, proxyAdminAddress, proxyAdminOwner);
|
||||
shouldBehaveLikeProxy(createProxy, proxyAdminAddress, proxyAdminOwner);
|
||||
shouldBehaveLikeTransparentUpgradeableProxy(createProxy, accounts);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user