@@ -5,8 +5,7 @@ import fs from "fs/promises";
55import path from "path" ;
66import { parse } from "csv-parse/sync" ;
77
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" ) ;
109
1110const func : DeployFunction = async function ( hre : HardhatRuntimeEnvironment ) {
1211 const { deployments, getNamedAccounts } = hre
@@ -15,7 +14,7 @@ const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) {
1514 const network : string = hre . hardhatArguments . network ? hre . hardhatArguments . network : 'ropsten'
1615 const deployedContracts = await loadDeployedAddress ( ) ;
1716 const proxyAddress = deployedContracts [ network ]
18-
17+
1918 if ( true ) {
2019 // deploy, we normally do this only once
2120 const HappyRedPacketImpl_erc721 = await ethers . getContractFactory ( 'HappyRedPacket_ERC721' )
@@ -45,12 +44,12 @@ const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) {
4544 }
4645}
4746
48- async function loadDeployedAddress ( ) : Promise < MyMapLikeType > {
47+ async function loadDeployedAddress ( ) : Promise < Record < string , string > > {
4948 const data = await fs . readFile ( ADDRESS_TABLE_PATH , "utf-8" ) ;
5049 const columns = [ 'Chain' , 'HappyRedPacket' , 'HappyRedPacket_ERC721' ] ;
5150 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 ) {
5453 deployedContract [ Chain . toLowerCase ( ) ] = HappyRedPacket_ERC721 ;
5554 }
5655 return deployedContract ;
0 commit comments