11import type { HardhatRuntimeEnvironment } from 'hardhat/types' ;
22import type { DeploymentsExtension } from 'hardhat-deploy/types' ;
33
4+ const VERIFICATION_BLOCK_CONFIRMATIONS = 5 ;
5+
46const deployTestProxy = async ( deployments : DeploymentsExtension , deployerAddress : string ) => {
57 const { address : inverseApi3ReaderProxyV1Address } = await deployments
68 . get ( 'InverseApi3ReaderProxyV1' )
@@ -14,7 +16,8 @@ const deployTestProxy = async (deployments: DeploymentsExtension, deployerAddres
1416 return inverseApi3ReaderProxyV1Address ;
1517} ;
1618
17- module . exports = async ( { getUnnamedAccounts, deployments, network, ethers } : HardhatRuntimeEnvironment ) => {
19+ module . exports = async ( hre : HardhatRuntimeEnvironment ) => {
20+ const { getUnnamedAccounts, deployments, network, ethers, run } = hre ;
1821 const { deploy, log } = deployments ;
1922
2023 const [ deployerAddress ] = await getUnnamedAccounts ( ) ;
@@ -39,12 +42,29 @@ module.exports = async ({ getUnnamedAccounts, deployments, network, ethers }: Ha
3942 }
4043 log ( `Proxy address: ${ proxyAddress } ` ) ;
4144
42- await deployments . get ( 'ScaledApi3FeedProxyV1' ) . catch ( async ( ) => {
43- return deploy ( 'ScaledApi3FeedProxyV1' , {
44- from : deployerAddress ,
45- args : [ proxyAddress , decimals ] ,
46- log : true ,
47- } ) ;
45+ const isLocalNetwork = network . name === 'hardhat' || network . name === 'localhost' ;
46+
47+ const confirmations = isLocalNetwork ? 1 : VERIFICATION_BLOCK_CONFIRMATIONS ;
48+ log ( `Deployment confirmations: ${ confirmations } ` ) ;
49+
50+ const contractName = 'ScaledApi3FeedProxyV1' ;
51+
52+ const deployment = await deploy ( contractName , {
53+ from : deployerAddress ,
54+ args : [ proxyAddress , decimals ] ,
55+ log : true ,
56+ waitConfirmations : confirmations ,
57+ } ) ;
58+
59+ if ( isLocalNetwork ) {
60+ log ( 'Skipping verification on local network.' ) ;
61+ return ;
62+ }
63+
64+ log ( `Attempting verification of ${ contractName } (already waited for confirmations)...` ) ;
65+ await run ( 'verify:verify' , {
66+ address : deployment . address ,
67+ constructorArguments : deployment . args ,
4868 } ) ;
4969} ;
5070module . exports . tags = [ 'ScaledApi3FeedProxyV1' ] ;
0 commit comments