1
- import { DeployFunction , DeploymentsExtension } from 'hardhat-deploy /types' ;
2
- import { HardhatRuntimeEnvironment } from 'hardhat/types' ;
1
+ import type { HardhatRuntimeEnvironment } from 'hardhat/types' ;
2
+ import type { DeployFunction , DeploymentsExtension } from 'hardhat-deploy /types' ;
3
3
4
4
const deployTestProxy = async ( deployments : DeploymentsExtension , deployerAddress : string ) => {
5
- const { address : inverseApi3ReaderProxyV1Address } = await deployments
6
- . get ( " InverseApi3ReaderProxyV1" )
7
- . catch ( async ( ) => {
8
- return deployments . deploy ( " InverseApi3ReaderProxyV1" , {
9
- from : deployerAddress ,
10
- args : [ " 0x5b0cf2b36a65a6BB085D501B971e4c102B9Cd473" ] ,
11
- log : true ,
12
- } ) ;
13
- } ) ;
14
- return inverseApi3ReaderProxyV1Address ;
15
- }
5
+ const { address : inverseApi3ReaderProxyV1Address } = await deployments
6
+ . get ( ' InverseApi3ReaderProxyV1' )
7
+ . catch ( async ( ) => {
8
+ return deployments . deploy ( ' InverseApi3ReaderProxyV1' , {
9
+ from : deployerAddress ,
10
+ args : [ ' 0x5b0cf2b36a65a6BB085D501B971e4c102B9Cd473' ] ,
11
+ log : true ,
12
+ } ) ;
13
+ } ) ;
14
+ return inverseApi3ReaderProxyV1Address ;
15
+ } ;
16
16
17
- const func : DeployFunction = async function ( hre : HardhatRuntimeEnvironment ) {
18
- const { deployments, getUnnamedAccounts, network } = hre ;
19
- const { deploy, log } = deployments ;
17
+ export const func : DeployFunction = async function ( hre : HardhatRuntimeEnvironment ) {
18
+ const { deployments, getUnnamedAccounts, network } = hre ;
19
+ const { deploy, log } = deployments ;
20
20
21
- const [ deployerAddress ] = await getUnnamedAccounts ( ) ;
22
- if ( ! deployerAddress ) {
23
- throw new Error ( " No deployer address found." ) ;
24
- }
25
- log ( `Deployer address: ${ deployerAddress } ` ) ;
21
+ const [ deployerAddress ] = await getUnnamedAccounts ( ) ;
22
+ if ( ! deployerAddress ) {
23
+ throw new Error ( ' No deployer address found.' ) ;
24
+ }
25
+ log ( `Deployer address: ${ deployerAddress } ` ) ;
26
26
27
- const proxyAddress = network . name !== "hardhat" ? process . env . PROXY : await deployTestProxy ( deployments , deployerAddress ) ;
28
- if ( ! proxyAddress ) {
29
- throw new Error ( "PROXY environment variable not set. Please provide the address of the Api3ReaderProxy contract." ) ;
30
- }
31
- if ( ! hre . ethers . isAddress ( proxyAddress ) ) {
32
- throw new Error ( `Invalid address provided for PROXY: ${ proxyAddress } ` ) ;
33
- }
34
- log ( `Proxy address: ${ proxyAddress } ` ) ;
27
+ const proxyAddress =
28
+ network . name === 'hardhat' ? await deployTestProxy ( deployments , deployerAddress ) : process . env . PROXY ;
29
+ if ( ! proxyAddress ) {
30
+ throw new Error ( 'PROXY environment variable not set. Please provide the address of the Api3ReaderProxy contract.' ) ;
31
+ }
32
+ if ( ! hre . ethers . isAddress ( proxyAddress ) ) {
33
+ throw new Error ( `Invalid address provided for PROXY: ${ proxyAddress } ` ) ;
34
+ }
35
+ log ( `Proxy address: ${ proxyAddress } ` ) ;
35
36
36
- const decimals = process . env . DECIMALS ? parseInt ( process . env . DECIMALS ) : 18 ;
37
- log ( `Decimals: ${ decimals } ` ) ;
37
+ const decimals = process . env . DECIMALS ? Number . parseInt ( process . env . DECIMALS , 10 ) : 18 ;
38
+ log ( `Decimals: ${ decimals } ` ) ;
38
39
39
- await deployments
40
- . get ( "ScaledApi3FeedProxyV1" )
41
- . catch ( async ( ) => {
42
- return deploy ( "ScaledApi3FeedProxyV1" , {
43
- from : deployerAddress ,
44
- args : [ proxyAddress , decimals ] ,
45
- log : true ,
46
- } ) ;
47
- } ) ;
40
+ await deployments . get ( 'ScaledApi3FeedProxyV1' ) . catch ( async ( ) => {
41
+ return deploy ( 'ScaledApi3FeedProxyV1' , {
42
+ from : deployerAddress ,
43
+ args : [ proxyAddress , decimals ] ,
44
+ log : true ,
45
+ } ) ;
46
+ } ) ;
48
47
} ;
49
-
50
- export default func ;
51
- func . tags = [ 'ScaledApi3FeedProxyV1' ] ;
48
+ func . tags = [ 'ScaledApi3FeedProxyV1' ] ;
0 commit comments