Skip to content

Commit 60ea358

Browse files
authored
chore: adapt contracts and bump version (#79)
1 parent 78b5d72 commit 60ea358

File tree

7 files changed

+82
-288
lines changed

7 files changed

+82
-288
lines changed

contracts/package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
"name": "@aragon/osx-commons-contracts",
33
"license": "AGPL-3.0-or-later",
44
"description": "The Aragon OSx contracts package containing common utilities",
5-
"version": "1.4.0-alpha.4",
5+
"version": "1.4.0-alpha.5",
66
"author": {
77
"name": "aragon",
88
"url": "https://github.com/aragon"
99
},
1010
"devDependencies": {
11-
"@aragon/osx-commons-sdk": "0.0.1-alpha.5",
11+
"@aragon/osx-commons-sdk": "0.0.1-alpha.11",
1212
"@aragon/osx-commons-configs": "0.4.0",
1313
"@aragon/osx-ethers-v1.0.0": "npm:@aragon/[email protected]",
1414
"@aragon/osx-ethers-v1.3.0": "npm:@aragon/[email protected]",
15-
"@ethersproject/abi": "^5.7.0",
16-
"@ethersproject/abstract-signer": "^5.7.0",
17-
"@ethersproject/bignumber": "^5.7.0",
18-
"@ethersproject/bytes": "^5.7.0",
19-
"@ethersproject/constants": "^5.7.0",
20-
"@ethersproject/providers": "^5.7.2",
15+
"@ethersproject/abi": "5.7.0",
16+
"@ethersproject/abstract-signer": "5.7.0",
17+
"@ethersproject/bignumber": "5.7.0",
18+
"@ethersproject/bytes": "5.7.0",
19+
"@ethersproject/constants": "5.7.0",
20+
"@ethersproject/providers": "5.7.2",
2121
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
2222
"@nomicfoundation/hardhat-network-helpers": "^1.0.10",
2323
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
@@ -32,7 +32,7 @@
3232
"chai": "^4.3.7",
3333
"cross-env": "^7.0.3",
3434
"dotenv": "^16.3.1",
35-
"ethers": "^5.7.2",
35+
"ethers": "5.7.2",
3636
"hardhat": "^2.13.1",
3737
"hardhat-deploy": "^0.11.26",
3838
"hardhat-gas-reporter": "^1.0.9",

contracts/test/plugin/extensions/proposal.ts

+6-11
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ import {
1111
} from '../../../typechain';
1212
import {ExecutedEvent} from '../../../typechain/src/dao/IDAO';
1313
import {erc165ComplianceTests} from '../../helpers';
14-
import {
15-
IDAO_EVENTS,
16-
IPROPOSAL_EVENTS,
17-
findEventTopicLog,
18-
getInterfaceId,
19-
} from '@aragon/osx-commons-sdk';
14+
import {findEventTopicLog, getInterfaceId} from '@aragon/osx-commons-sdk';
2015
import {IProposal__factory as IProposal_V1_0_0__factory} from '@aragon/osx-ethers-v1.0.0';
2116
import {loadFixture, time} from '@nomicfoundation/hardhat-network-helpers';
2217
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
@@ -117,7 +112,7 @@ function proposalBaseTests(fixture: () => Promise<FixtureResult>) {
117112
exampleData.allowFailureMap
118113
)
119114
)
120-
.to.emit(proposalMock, IPROPOSAL_EVENTS.ProposalCreated)
115+
.to.emit(proposalMock, 'ProposalCreated')
121116
.withArgs(
122117
expectedProposalId,
123118
creator.address,
@@ -168,7 +163,7 @@ function proposalBaseTests(fixture: () => Promise<FixtureResult>) {
168163
exampleData.allowFailureMap
169164
)
170165
)
171-
.to.emit(proposalMock, IPROPOSAL_EVENTS.ProposalExecuted)
166+
.to.emit(proposalMock, 'ProposalExecuted')
172167
.withArgs(proposalId);
173168
});
174169

@@ -195,10 +190,10 @@ function proposalBaseTests(fixture: () => Promise<FixtureResult>) {
195190
exampleData.actions,
196191
exampleData.allowFailureMap
197192
);
198-
const event = await findEventTopicLog<ExecutedEvent>(
199-
tx,
193+
const event = findEventTopicLog<ExecutedEvent>(
194+
await tx.wait(),
200195
IDAO__factory.createInterface(),
201-
IDAO_EVENTS.Executed
196+
'Executed'
202197
);
203198

204199
expect(event.args.actor).to.equal(expectedActor);

contracts/test/plugin/plugin-clonable.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ import {
1414
} from '../../typechain/src/utils/deployment/ProxyFactory';
1515
import {erc165ComplianceTests, getOzInitializedSlotValue} from '../helpers';
1616
import {osxCommonsContractsVersion} from '../utils/versioning/protocol-version';
17-
import {
18-
findEvent,
19-
getInterfaceId,
20-
PluginType,
21-
PROXY_FACTORY_EVENTS,
22-
} from '@aragon/osx-commons-sdk';
17+
import {PluginType, findEvent, getInterfaceId} from '@aragon/osx-commons-sdk';
2318
import {loadFixture} from '@nomicfoundation/hardhat-network-helpers';
2419
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
2520
import {expect} from 'chai';
@@ -32,9 +27,9 @@ describe('PluginCloneable', function () {
3227

3328
// Deploy an uninitialized clone
3429
const tx = await proxyFactory.deployMinimalProxy([]);
35-
const event = await findEvent<ProxyCreatedEvent>(
36-
tx,
37-
PROXY_FACTORY_EVENTS.ProxyCreated
30+
const event = findEvent<ProxyCreatedEvent>(
31+
await tx.wait(),
32+
'ProxyCreated'
3833
);
3934
const clone = Build1Factory.attach(event.args.proxy);
4035

contracts/test/plugin/plugin-uups-upgradeable.ts

+15-16
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
getInterfaceId,
2222
PLUGIN_UUPS_UPGRADEABLE_PERMISSIONS,
2323
PluginType,
24-
PROXY_FACTORY_EVENTS,
2524
} from '@aragon/osx-commons-sdk';
2625
import {loadFixture} from '@nomicfoundation/hardhat-network-helpers';
2726
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
@@ -35,9 +34,9 @@ describe('PluginUUPSUpgradeable', function () {
3534

3635
// Deploy an uninitialized proxy
3736
const tx = await proxyFactory.deployUUPSProxy([]);
38-
const event = await findEvent<ProxyCreatedEvent>(
39-
tx,
40-
PROXY_FACTORY_EVENTS.ProxyCreated
37+
const event = findEvent<ProxyCreatedEvent>(
38+
await tx.wait(),
39+
'ProxyCreated'
4140
);
4241
const proxy = Build1Factory.attach(event.args.proxy);
4342

@@ -145,9 +144,9 @@ describe('PluginUUPSUpgradeable', function () {
145144

146145
// Deploy an uninitialized build 1 proxy
147146
const tx = await proxyFactory.deployUUPSProxy([]);
148-
const event = await findEvent<ProxyCreatedEvent>(
149-
tx,
150-
PROXY_FACTORY_EVENTS.ProxyCreated
147+
const event = findEvent<ProxyCreatedEvent>(
148+
await tx.wait(),
149+
'ProxyCreated'
151150
);
152151
const proxy = Build1Factory.attach(event.args.proxy);
153152

@@ -166,9 +165,9 @@ describe('PluginUUPSUpgradeable', function () {
166165

167166
// Deploy an initialized build 1 proxy
168167
const tx = await proxyFactory.deployUUPSProxy(initCalldata);
169-
const event = await findEvent<ProxyCreatedEvent>(
170-
tx,
171-
PROXY_FACTORY_EVENTS.ProxyCreated
168+
const event = findEvent<ProxyCreatedEvent>(
169+
await tx.wait(),
170+
'ProxyCreated'
172171
);
173172
const proxy = Build1Factory.attach(event.args.proxy);
174173

@@ -200,9 +199,9 @@ describe('PluginUUPSUpgradeable', function () {
200199

201200
// Create an initialized build 1 proxy
202201
const tx = await proxyFactory.deployUUPSProxy(initCalldata);
203-
const event = await findEvent<ProxyCreatedEvent>(
204-
tx,
205-
PROXY_FACTORY_EVENTS.ProxyCreated
202+
const event = findEvent<ProxyCreatedEvent>(
203+
await tx.wait(),
204+
'ProxyCreated'
206205
);
207206
const proxy = Build1Factory.attach(event.args.proxy);
208207

@@ -235,9 +234,9 @@ describe('PluginUUPSUpgradeable', function () {
235234

236235
// Deploy an initialized build 1 proxy
237236
const tx = await proxyFactory.deployUUPSProxy(initCalldata);
238-
const event = await findEvent<ProxyCreatedEvent>(
239-
tx,
240-
PROXY_FACTORY_EVENTS.ProxyCreated
237+
const event = findEvent<ProxyCreatedEvent>(
238+
await tx.wait(),
239+
'ProxyCreated'
241240
);
242241
const proxy = Build1Factory.attach(event.args.proxy);
243242

contracts/test/plugin/setup/plugin-setup.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import {IPluginSetup} from '../../../typechain/src/plugin/setup/PluginSetup';
1212
import {erc165ComplianceTests} from '../../helpers';
1313
import {osxCommonsContractsVersion} from '../../utils/versioning/protocol-version';
14-
import {ADDRESS, getInterfaceId} from '@aragon/osx-commons-sdk';
14+
import {getInterfaceId} from '@aragon/osx-commons-sdk';
1515
import {
1616
IPluginSetup__factory as IPluginSetup_V1_0_0__factory,
1717
Plugin__factory,
@@ -31,15 +31,19 @@ describe('IPluginSetup', function () {
3131
});
3232
});
3333

34+
const ADDRESS_ZERO = `0x${'0'.repeat(40)}`;
35+
const ADDRESS_ONE = `0x${'0'.repeat(39)}1`;
36+
const ADDRESS_TWO = `0x${'0'.repeat(39)}2`;
37+
3438
describe('PluginSetup', async () => {
3539
pluginSetupBaseTests(pluginSetupFixture);
3640

3741
describe('prepareUpdate', async () => {
3842
it('reverts when called', async () => {
3943
const {pluginSetupMock} = await loadFixture(pluginSetupFixture);
4044

41-
const dummyDaoAddr = ADDRESS.ONE;
42-
const dummyPluginAddr = ADDRESS.TWO;
45+
const dummyDaoAddr = ADDRESS_ONE;
46+
const dummyPluginAddr = ADDRESS_TWO;
4347
const dummyFromBuildNumber = 123;
4448
const setupPayload: IPluginSetup.SetupPayloadStruct = {
4549
plugin: dummyPluginAddr,
@@ -69,8 +73,8 @@ describe('PluginUpgradeableSetup', async () => {
6973
pluginUUPSUpgradeableSetupFixture
7074
);
7175

72-
const dummyDaoAddr = ADDRESS.ONE;
73-
const dummyPluginAddr = ADDRESS.TWO;
76+
const dummyDaoAddr = ADDRESS_ONE;
77+
const dummyPluginAddr = ADDRESS_TWO;
7478
const setupPayload: IPluginSetup.SetupPayloadStruct = {
7579
plugin: dummyPluginAddr,
7680
currentHelpers: [],
@@ -97,8 +101,8 @@ describe('PluginUpgradeableSetup', async () => {
97101
deployer
98102
).deploy();
99103

100-
const dummyDaoAddr = ADDRESS.ONE;
101-
const dummyPluginAddr = ADDRESS.TWO;
104+
const dummyDaoAddr = ADDRESS_ONE;
105+
const dummyPluginAddr = ADDRESS_TWO;
102106
const dummyFromBuildNumber = 123;
103107
const setupPayload: IPluginSetup.SetupPayloadStruct = {
104108
plugin: dummyPluginAddr,
@@ -124,7 +128,7 @@ function pluginSetupBaseTests(fixture: () => Promise<FixtureResult>) {
124128
const implementation = await pluginSetupMock.implementation();
125129

126130
// Check that an address is returned
127-
expect(implementation).to.not.equal(ADDRESS.ZERO);
131+
expect(implementation).to.not.equal(ADDRESS_ZERO);
128132

129133
// Check that it supports the `IPlugin` interface
130134
const plugin = Plugin__factory.connect(implementation, deployer);

contracts/test/utils/deployment/proxy-lib.ts

+18-19
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ import {
77
ProxyFactory__factory,
88
} from '../../../typechain';
99
import {ProxyCreatedEvent} from '../../../typechain/src/utils/deployment/ProxyFactory';
10-
import {
11-
ADDRESS,
12-
findEvent,
13-
PROXY_FACTORY_EVENTS,
14-
} from '@aragon/osx-commons-sdk';
10+
import {findEvent} from '@aragon/osx-commons-sdk';
1511
import {loadFixture} from '@nomicfoundation/hardhat-network-helpers';
1612
import {SignerWithAddress} from '@nomiclabs/hardhat-ethers/signers';
1713
import {expect} from 'chai';
1814
import {ethers} from 'hardhat';
1915

16+
const ADDRESS_ZERO = `0x${'0'.repeat(40)}`;
17+
const ADDRESS_LAST = `0x${'f'.repeat(40)}`;
18+
2019
describe('ProxyFactory', function () {
2120
describe('deployUUPSProxy', function () {
2221
it('deploys an initialized proxy if initialization data is provided', async () => {
@@ -32,9 +31,9 @@ describe('ProxyFactory', function () {
3231
const tx = await proxyFactory.deployUUPSProxy(initCalldata);
3332

3433
// Get the proxy address from the event
35-
const event = await findEvent<ProxyCreatedEvent>(
36-
tx,
37-
PROXY_FACTORY_EVENTS.ProxyCreated
34+
const event = findEvent<ProxyCreatedEvent>(
35+
await tx.wait(),
36+
'ProxyCreated'
3837
);
3938
const proxy = PluginUUPSUpgradeableMockBuild1__factory.connect(
4039
event.args.proxy,
@@ -61,8 +60,8 @@ describe('ProxyFactory', function () {
6160

6261
// Get the proxy address from the event
6362
const event = await findEvent<ProxyCreatedEvent>(
64-
tx,
65-
PROXY_FACTORY_EVENTS.ProxyCreated
63+
await tx.wait(),
64+
'ProxyCreated'
6665
);
6766
const proxy = PluginUUPSUpgradeableMockBuild1__factory.connect(
6867
event.args.proxy,
@@ -75,7 +74,7 @@ describe('ProxyFactory', function () {
7574
.to.equal(implementation.address);
7675

7776
// Check that the proxy is not initialized
78-
expect(await proxy.dao()).to.equal(ADDRESS.ZERO);
77+
expect(await proxy.dao()).to.equal(ADDRESS_ZERO);
7978
expect(await proxy.state1()).to.equal(0);
8079
});
8180
});
@@ -89,9 +88,9 @@ describe('ProxyFactory', function () {
8988
const tx = await proxyFactory.deployMinimalProxy(initCalldata);
9089

9190
// Get the proxy address from the event
92-
const event = await findEvent<ProxyCreatedEvent>(
93-
tx,
94-
PROXY_FACTORY_EVENTS.ProxyCreated
91+
const event = findEvent<ProxyCreatedEvent>(
92+
await tx.wait(),
93+
'ProxyCreated'
9594
);
9695
const proxy = PluginCloneableMockBuild1__factory.connect(
9796
event.args.proxy,
@@ -111,16 +110,16 @@ describe('ProxyFactory', function () {
111110

112111
// Get the proxy address from the event
113112
const event = await findEvent<ProxyCreatedEvent>(
114-
tx,
115-
PROXY_FACTORY_EVENTS.ProxyCreated
113+
await tx.wait(),
114+
'ProxyCreated'
116115
);
117116
const proxy = PluginCloneableMockBuild1__factory.connect(
118117
event.args.proxy,
119118
deployer
120119
);
121120

122121
// Check that the proxy is not initialized
123-
expect(await proxy.dao()).to.equal(ADDRESS.ZERO);
122+
expect(await proxy.dao()).to.equal(ADDRESS_ZERO);
124123
expect(await proxy.state1()).to.equal(0);
125124
});
126125
});
@@ -146,7 +145,7 @@ async function uupsProxyFixture(): Promise<FixtureResult> {
146145
);
147146

148147
// Create a mock address with a valid checksum
149-
const daoMockAddr = ethers.utils.getAddress(ADDRESS.LAST);
148+
const daoMockAddr = ethers.utils.getAddress(ADDRESS_LAST);
150149

151150
const initCalldata = implementation.interface.encodeFunctionData(
152151
'initialize',
@@ -168,7 +167,7 @@ async function minimalProxyFixture(): Promise<FixtureResult> {
168167
);
169168

170169
// Create a mock address with a valid checksum
171-
const daoMockAddr = ethers.utils.getAddress(ADDRESS.LAST);
170+
const daoMockAddr = ethers.utils.getAddress(ADDRESS_LAST);
172171

173172
const initCalldata = implementation.interface.encodeFunctionData(
174173
'initialize',

0 commit comments

Comments
 (0)