@@ -14,12 +14,13 @@ const PROVIDER = config.provider || process.env.PROVIDER
14
14
class ContractNotFoundError extends Error { }
15
15
16
16
const addContract = ( contracts , contractFilePath ) => {
17
+ const ctrs = contracts
17
18
const fileString = readFileSync ( join ( contractsDirectory , contractFilePath ) )
18
19
try {
19
20
const contract = JSON . parse ( fileString )
20
21
const name = contract . contractName
21
22
console . log ( `loaded contract: ${ name } ` )
22
- contracts [ name ] = contract
23
+ ctrs [ name ] = contract
23
24
return contracts
24
25
} catch ( err ) {
25
26
console . error ( `Can not parse contract JSON info - path: ${ contractFilePath } ` )
@@ -55,8 +56,8 @@ const deployContracts = async ({ ctrNames, contracts, defaultAddress, eth }) =>
55
56
}
56
57
57
58
const deploy = ( ) => {
58
- const contracts = contractsFilenames . reduce ( ( contracts , file ) => {
59
- return addContract ( contracts , file )
59
+ const contracts = contractsFilenames . reduce ( ( ctrs , file ) => {
60
+ return addContract ( ctrs , file )
60
61
} , { } )
61
62
62
63
; ( async ( ) => {
@@ -79,7 +80,8 @@ const deploy = () => {
79
80
const contractABIs = await deployContracts ( { ctrNames, contracts, defaultAddress, eth } )
80
81
console . log ( 'Contracts deployed!\n' )
81
82
82
- const contractAddresses = ctrNames . reduce ( ( infos , contract ) => {
83
+ const contractAddresses = ctrNames . reduce ( ( ctrInfos , contract ) => {
84
+ const infos = ctrInfos
83
85
const info = contractABIs [ contract ]
84
86
infos [ info . name ] = info . address
85
87
delete contractABIs [ contract ] . address
0 commit comments