Use Prettier for JS files (#3913)

Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
Francisco
2023-01-04 11:03:40 -03:00
committed by GitHub
parent 88754d0b36
commit a28aafdc85
135 changed files with 2737 additions and 3121 deletions

View File

@ -15,25 +15,17 @@ contract('BeaconProxy', function (accounts) {
describe('bad beacon is not accepted', async function () {
it('non-contract beacon', async function () {
await expectRevert(
BeaconProxy.new(anotherAccount, '0x'),
'ERC1967: new beacon is not a contract',
);
await expectRevert(BeaconProxy.new(anotherAccount, '0x'), 'ERC1967: new beacon is not a contract');
});
it('non-compliant beacon', async function () {
const beacon = await BadBeaconNoImpl.new();
await expectRevert.unspecified(
BeaconProxy.new(beacon.address, '0x'),
);
await expectRevert.unspecified(BeaconProxy.new(beacon.address, '0x'));
});
it('non-contract implementation', async function () {
const beacon = await BadBeaconNotContract.new();
await expectRevert(
BeaconProxy.new(beacon.address, '0x'),
'ERC1967: beacon implementation is not a contract',
);
await expectRevert(BeaconProxy.new(beacon.address, '0x'), 'ERC1967: beacon implementation is not a contract');
});
});
@ -69,18 +61,14 @@ contract('BeaconProxy', function (accounts) {
it('non-payable initialization', async function () {
const value = '55';
const data = this.implementationV0.contract.methods
.initializeNonPayableWithValue(value)
.encodeABI();
const data = this.implementationV0.contract.methods.initializeNonPayableWithValue(value).encodeABI();
this.proxy = await BeaconProxy.new(this.beacon.address, data);
await this.assertInitialized({ value, balance: '0' });
});
it('payable initialization', async function () {
const value = '55';
const data = this.implementationV0.contract.methods
.initializePayableWithValue(value)
.encodeABI();
const data = this.implementationV0.contract.methods.initializePayableWithValue(value).encodeABI();
const balance = '100';
this.proxy = await BeaconProxy.new(this.beacon.address, data, { value: balance });
await this.assertInitialized({ value, balance });
@ -88,10 +76,7 @@ contract('BeaconProxy', function (accounts) {
it('reverting initialization', async function () {
const data = this.implementationV0.contract.methods.reverts().encodeABI();
await expectRevert(
BeaconProxy.new(this.beacon.address, data),
'DummyImplementation reverted',
);
await expectRevert(BeaconProxy.new(this.beacon.address, data), 'DummyImplementation reverted');
});
});
@ -99,9 +84,7 @@ contract('BeaconProxy', function (accounts) {
const beacon = await UpgradeableBeacon.new(this.implementationV0.address);
const value = '10';
const data = this.implementationV0.contract.methods
.initializeNonPayableWithValue(value)
.encodeABI();
const data = this.implementationV0.contract.methods.initializeNonPayableWithValue(value).encodeABI();
const proxy = await BeaconProxy.new(beacon.address, data);
const dummy = new DummyImplementation(proxy.address);

View File

@ -9,10 +9,7 @@ contract('UpgradeableBeacon', function (accounts) {
const [owner, other] = accounts;
it('cannot be created with non-contract implementation', async function () {
await expectRevert(
UpgradeableBeacon.new(accounts[0]),
'UpgradeableBeacon: implementation is not a contract',
);
await expectRevert(UpgradeableBeacon.new(accounts[0]), 'UpgradeableBeacon: implementation is not a contract');
});
context('once deployed', async function () {
@ -41,10 +38,7 @@ contract('UpgradeableBeacon', function (accounts) {
it('cannot be upgraded by other account', async function () {
const v2 = await Implementation2.new();
await expectRevert(
this.beacon.upgradeTo(v2.address, { from: other }),
'Ownable: caller is not the owner',
);
await expectRevert(this.beacon.upgradeTo(v2.address, { from: other }), 'Ownable: caller is not the owner');
});
});
});