@@ -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