Skip to content

Commit d9f50e3

Browse files
committed
Add ignition module to deploy contracts
1 parent 64822c9 commit d9f50e3

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// import { buildModule } from '@nomicfoundation/hardhat-ignition/modules';
2+
const { buildModule } = require('@nomicfoundation/hardhat-ignition/modules');
3+
4+
const {
5+
DATASET_REGISTRY_ADDRESS: defaultDatasetRegistryAddress,
6+
POCO_ADDRESS: defaultPocoAddress,
7+
} = require('../../config/config.cjs');
8+
const { env } = require('../../config/env.cjs');
9+
10+
// Hardhat Ignition does not support ESM yet.
11+
12+
// @ts-ignore
13+
module.exports = buildModule('DataProtectorSharingModule', (m) => {
14+
const proxyAdminOwner = m.getAccount(0);
15+
const pocoAddress = env.POCO_ADDRESS || defaultPocoAddress;
16+
const datasetRegistryAddress = env.DATASET_REGISTRY_ADDRESS || defaultDatasetRegistryAddress;
17+
18+
// Whitelist
19+
const addOnlyAppWhitelistRegistryImpl = m.contract('AddOnlyAppWhitelistRegistry', [], {
20+
id: 'AddOnlyAppWhitelistRegistryImpl',
21+
});
22+
const addOnlyAppWhitelistRegistryProxy = m.contract(
23+
'TransparentUpgradeableProxy',
24+
[
25+
addOnlyAppWhitelistRegistryImpl,
26+
proxyAdminOwner,
27+
'0x', // No initialization data.
28+
],
29+
{
30+
id: 'AddOnlyAppWhitelistRegistryProxy',
31+
},
32+
);
33+
const addOnlyAppWhitelistRegistry = m.contractAt(
34+
'AddOnlyAppWhitelistRegistry',
35+
addOnlyAppWhitelistRegistryProxy,
36+
);
37+
38+
// DPS
39+
const dataProtectorSharingImpl = m.contract(
40+
'DataProtectorSharing',
41+
[pocoAddress, datasetRegistryAddress, addOnlyAppWhitelistRegistryProxy],
42+
{
43+
id: 'DataProtectorSharingImpl',
44+
},
45+
);
46+
const dataProtectorSharingProxy = m.contract(
47+
'TransparentUpgradeableProxy',
48+
[
49+
dataProtectorSharingImpl,
50+
proxyAdminOwner,
51+
'0x', // No initialization data.
52+
],
53+
{
54+
id: 'DataProtectorSharingProxy',
55+
},
56+
);
57+
const dataProtectorSharing = m.contractAt('DataProtectorSharing', dataProtectorSharingProxy);
58+
59+
return { addOnlyAppWhitelistRegistry, dataProtectorSharing };
60+
61+
// TODO verify contracts.
62+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"module": "CommonJS",
5+
"strict": true,
6+
"esModuleInterop": true,
7+
"skipLibCheck": true
8+
},
9+
"include": ["ignition/modules"]
10+
}

0 commit comments

Comments
 (0)