@@ -947,7 +947,20 @@ export async function deployErc4626StackSync<
947947 )
948948 throw new Error ( '`bindingAccount` must match `owner`.' )
949949
950- const factories = resolveFactoryAddresses ( client , parameters . factories )
950+ const factories = ( ( ) => {
951+ if ( parameters . factories ) return parameters . factories
952+ if ( ! client . chain ) throw new ChainNotFoundError ( )
953+ return {
954+ earn : getChainContractAddress ( {
955+ chain : client . chain ,
956+ contract : 'earnFactory' ,
957+ } ) ,
958+ erc4626Engine : getChainContractAddress ( {
959+ chain : client . chain ,
960+ contract : 'erc4626EngineFactory' ,
961+ } ) ,
962+ }
963+ } ) ( )
951964 validateDeploymentId ( parameters . deploymentId )
952965 if (
953966 parameters . resume &&
@@ -1258,24 +1271,6 @@ function validateDeploymentId(deploymentId: Hex.Hex) {
12581271 throw new Error ( '`deploymentId` must be a nonzero 32-byte hex value.' )
12591272}
12601273
1261- function resolveFactoryAddresses (
1262- client : Client < Transport , Chain | undefined > ,
1263- factories : EarnFactoryAddresses | undefined ,
1264- ) : EarnFactoryAddresses {
1265- if ( factories ) return factories
1266- if ( ! client . chain ) throw new ChainNotFoundError ( )
1267- return {
1268- earn : getChainContractAddress ( {
1269- chain : client . chain ,
1270- contract : 'earnFactory' ,
1271- } ) ,
1272- erc4626Engine : getChainContractAddress ( {
1273- chain : client . chain ,
1274- contract : 'erc4626EngineFactory' ,
1275- } ) ,
1276- }
1277- }
1278-
12791274function toDeployParameters ( args : createStack . Args ) {
12801275 const fixedFees = args . fees ?. fixedFees ?? [ ]
12811276 if ( fixedFees . length > 4 )
0 commit comments