11import hre from 'hardhat' ;
2+ import { env } from '../config/env.js' ;
23import DataProtectorSharingModule from '../ignition/modules/DataProtectorSharingModule.cjs' ;
3- import { env } from "../config/env.js" ;
44
55const { ethers } = hre ;
66
7+ /**
8+ * This script deploys DataProtectorSharing contract and its dependencies using
9+ * Hardhat Ignition and createX factory if supported.
10+ * It also imports the deployed contracts into the OpenZeppelin upgrades plugin.
11+ */
12+
713async function main ( ) {
814 const pocoAddress = env . POCO_ADDRESS ;
915 const datasetRegistryAddress = env . DATASET_REGISTRY_ADDRESS ;
@@ -21,16 +27,16 @@ async function main() {
2127 console . log ( '⚠️ CreateX factory is NOT supported.' ) ;
2228 }
2329 // Deploy contracts using Ignition module.
24- const {
25- addOnlyAppWhitelistRegistry ,
26- dataProtectorSharing ,
27- } = await hre . ignition . deploy ( DataProtectorSharingModule , {
28- ... ( isCreatexSupported && {
29- strategy : ' create2' ,
30- strategyConfig : hre . userConfig . ignition . strategyConfig . create2 ,
31- } ) ,
32- displayUi : true , // for logs.
33- } ) ;
30+ const { addOnlyAppWhitelistRegistry , dataProtectorSharing } = await hre . ignition . deploy (
31+ DataProtectorSharingModule ,
32+ {
33+ ... ( isCreatexSupported && {
34+ strategy : 'create2' ,
35+ strategyConfig : hre . userConfig . ignition . strategyConfig . create2 ,
36+ } ) ,
37+ displayUi : true , // for logs.
38+ } ,
39+ ) ;
3440 // Import proxies in OZ `upgrades` plugin for future upgrades.
3541 console . log ( `Importing proxy contracts in OZ upgrades...` ) ;
3642 const whitelistProxyAddress = await addOnlyAppWhitelistRegistry . getAddress ( ) ;
@@ -52,7 +58,7 @@ async function main() {
5258}
5359
5460async function isCreatexFactorySupported ( ) {
55- const code = await ethers . provider . getCode ( '0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed' ) ;
61+ const code = await ethers . provider . getCode ( '0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed' ) ;
5662 return code !== '0x' ;
5763}
5864
0 commit comments