@@ -43,7 +43,7 @@ export async function deployNewProxy(
4343 constructorArgs : FnArgs [ ] ,
4444 initArgs : FnArgs [ ] ,
4545 implementationOnly ?: boolean
46- ) : Promise < void > {
46+ ) : Promise < { proxyAddress ?: string ; implementationAddress : string } > {
4747 const { deployments, run, upgrades, getChainId } = hre ;
4848 let chainId = Number ( await getChainId ( ) ) ;
4949
@@ -54,11 +54,12 @@ export async function deployNewProxy(
5454 }
5555
5656 // If a SpokePool can be found in deployments/deployments.json, then only deploy an implementation contract.
57- const proxy = getDeployedAddress ( "SpokePool" , chainId , false ) ;
58- implementationOnly ??= proxy !== undefined ;
57+ let proxyAddress = getDeployedAddress ( "SpokePool" , chainId , false ) ;
58+ implementationOnly ??= proxyAddress !== undefined ;
59+ let implementationAddress : string ;
5960 if ( implementationOnly ) {
60- console . log ( `${ name } deployment already detected @ ${ proxy } , deploying new implementation.` ) ;
61- instance = ( await upgrades . deployImplementation ( await getContractFactory ( name , { } ) , {
61+ console . log ( `${ name } deployment already detected @ ${ proxyAddress } , deploying new implementation.` ) ;
62+ implementationAddress = instance = ( await upgrades . deployImplementation ( await getContractFactory ( name , { } ) , {
6263 constructorArgs,
6364 kind : "uups" ,
6465 unsafeAllow : unsafeAllowArgs as unsafeAllowTypes ,
@@ -71,9 +72,9 @@ export async function deployNewProxy(
7172 constructorArgs,
7273 initializer : "initialize" ,
7374 } ) ;
74- instance = ( await proxy . deployed ( ) ) . address ;
75+ proxyAddress = instance = ( await proxy . deployed ( ) ) . address ;
7576 console . log ( `New ${ name } proxy deployed @ ${ instance } ` ) ;
76- const implementationAddress = await upgrades . erc1967 . getImplementationAddress ( instance ) ;
77+ implementationAddress = await upgrades . erc1967 . getImplementationAddress ( instance ) ;
7778 console . log ( `${ name } implementation deployed @ ${ implementationAddress } ` ) ;
7879 }
7980
@@ -93,6 +94,8 @@ export async function deployNewProxy(
9394 // https://docs.openzeppelin.com/upgrades-plugins/1.x/api-hardhat-upgrades#verify
9495 const contract = `contracts/${ name } .sol:${ name } ` ;
9596 await verifyContract ( instance , constructorArgs , contract ) ;
97+
98+ return { proxyAddress, implementationAddress } ;
9699}
97100
98101export async function verifyContract ( address : string , constructorArguments : any [ ] , contract ?: string ) {
0 commit comments