Skip to content

Commit 58c82ee

Browse files
committed
Clean deploy script
1 parent 02737b5 commit 58c82ee

File tree

1 file changed

+18
-12
lines changed
  • packages/sharing-smart-contract/scripts

1 file changed

+18
-12
lines changed

packages/sharing-smart-contract/scripts/deploy.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import hre from 'hardhat';
2+
import { env } from '../config/env.js';
23
import DataProtectorSharingModule from '../ignition/modules/DataProtectorSharingModule.cjs';
3-
import { env } from "../config/env.js";
44

55
const { 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+
713
async 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

5460
async 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

Comments
 (0)