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+ } ) ;
0 commit comments