Skip to content

Commit fc617a9

Browse files
committed
refactor: streamline deployment process by removing fallback logic for CREATE2 strategy
1 parent be97000 commit fc617a9

File tree

1 file changed

+11
-32
lines changed
  • packages/sharing-smart-contract/scripts

1 file changed

+11
-32
lines changed

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

Lines changed: 11 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,17 @@ async function main() {
3131
console.log('⚠️ CreateX factory is NOT supported.');
3232
}
3333
// Deploy contracts using Ignition module.
34-
let deploymentResult;
35-
try {
36-
console.log(`Attempting deployment${isCreatexSupported ? ' with CREATE2 strategy' : ''}...`);
37-
deploymentResult = await hre.ignition.deploy(
38-
DataProtectorSharingModule,
39-
{
40-
...(isCreatexSupported && {
41-
strategy: 'create2',
42-
strategyConfig: hre.userConfig.ignition.strategyConfig.create2,
43-
}),
44-
displayUi: true, // for logs.
45-
...(deploymentId && { deploymentId }),
46-
},
47-
);
48-
console.log(`✅ Deployment successful${isCreatexSupported ? ' with CREATE2' : ''}!`);
49-
} catch (error) {
50-
if (isCreatexSupported && (error.message.includes('FailedContractCreation') || error.message.includes('CREATE2'))) {
51-
console.log('⚠️ CREATE2 deployment failed, falling back to normal deployment...');
52-
console.log(`Error details: ${error.message}`);
53-
deploymentResult = await hre.ignition.deploy(
54-
DataProtectorSharingModule,
55-
{
56-
displayUi: true, // for logs.
57-
...(deploymentId && { deploymentId }),
58-
},
59-
);
60-
console.log('✅ Fallback deployment successful!');
61-
} else {
62-
throw error;
63-
}
64-
}
65-
const { addOnlyAppWhitelistRegistry, dataProtectorSharing } = deploymentResult;
34+
const { addOnlyAppWhitelistRegistry, dataProtectorSharing } = await hre.ignition.deploy(
35+
DataProtectorSharingModule,
36+
{
37+
...(isCreatexSupported && {
38+
strategy: 'create2',
39+
strategyConfig: hre.userConfig.ignition.strategyConfig.create2,
40+
}),
41+
displayUi: true, // for logs.
42+
...(deploymentId && { deploymentId }),
43+
},
44+
);
6645
// Import proxies in OZ `upgrades` plugin for future upgrades.
6746
console.log(`Importing proxy contracts in OZ upgrades...`);
6847
const whitelistProxyAddress = await addOnlyAppWhitelistRegistry.getAddress();

0 commit comments

Comments
 (0)