@@ -3,7 +3,7 @@ import * as hre from 'hardhat';
33import { utils } from 'ethers' ;
44import { EnvironmentInfo , loadEnvironmentInfo } from '../../environment' ;
55import { newWalletOptions , WalletOptions } from '../../wallet-options' ;
6- import { deployContract } from '../../contract' ;
6+ import { deployContractViaCREATE2 } from '../../contract' ;
77import { waitForInput } from '../../helper-functions' ;
88
99/**
@@ -45,20 +45,34 @@ async function step4(): Promise<EnvironmentInfo> {
4545 const deployerAddress = await wallets . getWallet ( ) . getAddress ( ) ;
4646
4747 // Deploy K1Validator (Nexus core validator)
48- console . log ( `[${ network } ] Deploying K1Validator (Nexus core)...` ) ;
49- const validator = await deployContract ( env , wallets , 'K1Validator' , [ ] ) ;
48+ console . log ( `[${ network } ] Deploying K1Validator (Nexus core) via CREATE2...` ) ;
49+ let validator ;
50+ try {
51+ validator = await deployContractViaCREATE2 ( env , wallets , 'K1Validator' , [ ] ) ;
52+ console . log ( `[${ network } ] ✅ K1Validator deployed at: ${ validator . address } ` ) ;
53+ } catch ( error ) {
54+ console . error ( '❌ Error deploying K1Validator via CREATE2:' , error ) ;
55+ throw error ;
56+ }
5057
5158 // Deploy Nexus Implementation (integrating with Passport infrastructure)
5259 console . log ( `[${ network } ] Deploying Nexus implementation...` ) ;
5360 const validatorInitData = utils . hexConcat ( [ deployerAddress ] ) ;
5461 console . log ( `[${ network } ] K1Validator init data: ${ validatorInitData } ` ) ;
5562
56- // Deploy Nexus (core smart account implementation)
57- const nexus = await deployContract ( env , wallets , 'Nexus' , [
58- entryPointAddress , // EntryPoint for Account Abstraction
59- validator . address , // K1Validator for signature validation
60- validatorInitData // Initialization data for the validator
61- ] ) ;
63+ // Deploy Nexus (core smart account implementation) via CREATE2
64+ let nexus ;
65+ try {
66+ nexus = await deployContractViaCREATE2 ( env , wallets , 'Nexus' , [
67+ entryPointAddress , // EntryPoint for Account Abstraction
68+ validator . address , // K1Validator for signature validation
69+ validatorInitData // Initialization data for the validator
70+ ] ) ;
71+ console . log ( `[${ network } ] ✅ Nexus implementation deployed at: ${ nexus . address } ` ) ;
72+ } catch ( error ) {
73+ console . error ( '❌ Error deploying Nexus via CREATE2:' , error ) ;
74+ throw error ;
75+ }
6276
6377 // Save deployment information
6478 fs . writeFileSync ( 'scripts/biconomy/steps/step4.json' , JSON . stringify ( {
0 commit comments