@@ -5,8 +5,7 @@ import fs from "fs/promises";
5
5
import path from "path" ;
6
6
import { parse } from "csv-parse/sync" ;
7
7
8
- type MyMapLikeType = Record < string , string > ;
9
- const ADDRESS_TABLE_PATH = path . resolve ( __dirname , ".." , "helper_scripts" , "contract-addresses.csv" ) ;
8
+ const ADDRESS_TABLE_PATH = path . resolve ( __dirname , ".." , "helper_scripts" , "contract-addresses.csv" ) ;
10
9
11
10
const func : DeployFunction = async function ( hre : HardhatRuntimeEnvironment ) {
12
11
const { deployments, getNamedAccounts } = hre
@@ -15,7 +14,7 @@ const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) {
15
14
const network : string = hre . hardhatArguments . network ? hre . hardhatArguments . network : 'ropsten'
16
15
const deployedContracts = await loadDeployedAddress ( ) ;
17
16
const proxyAddress = deployedContracts [ network ]
18
-
17
+
19
18
if ( true ) {
20
19
// deploy, we normally do this only once
21
20
const HappyRedPacketImpl_erc721 = await ethers . getContractFactory ( 'HappyRedPacket_ERC721' )
@@ -45,12 +44,12 @@ const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) {
45
44
}
46
45
}
47
46
48
- async function loadDeployedAddress ( ) : Promise < MyMapLikeType > {
47
+ async function loadDeployedAddress ( ) : Promise < Record < string , string > > {
49
48
const data = await fs . readFile ( ADDRESS_TABLE_PATH , "utf-8" ) ;
50
49
const columns = [ 'Chain' , 'HappyRedPacket' , 'HappyRedPacket_ERC721' ] ;
51
50
const records = parse ( data , { delimiter : ',' , columns, from : 2 } ) ;
52
- let deployedContract : MyMapLikeType = { } ;
53
- for ( const { Chain, HappyRedPacket_ERC721} of records ) {
51
+ let deployedContract : Record < string , string > = { } ;
52
+ for ( const { Chain, HappyRedPacket_ERC721 } of records ) {
54
53
deployedContract [ Chain . toLowerCase ( ) ] = HappyRedPacket_ERC721 ;
55
54
}
56
55
return deployedContract ;
0 commit comments