@@ -2,7 +2,7 @@ import PQueue from 'p-queue'
2
2
import fs from 'fs'
3
3
import consola from 'consola'
4
4
import inquirer from 'inquirer'
5
- import { utils , BigNumber , Event , ContractTransaction , ContractReceipt , Contract , ContractFactory } from 'ethers'
5
+ import { BigNumber , Contract , ContractFactory , ContractReceipt , ContractTransaction , Event , utils } from 'ethers'
6
6
7
7
import { NonceManager } from '@ethersproject/experimental'
8
8
import { task } from 'hardhat/config'
@@ -47,7 +47,7 @@ export const askConfirm = async () => {
47
47
type : 'confirm' ,
48
48
message : `Are you sure you want to proceed?` ,
49
49
} )
50
- return res . confirm
50
+ return res . confirm ? res . confirm as boolean : false
51
51
}
52
52
53
53
const isValidAddress = ( address : string ) => {
@@ -68,10 +68,10 @@ export const isValidAddressOrFail = (address: string) => {
68
68
69
69
const loadDeployData = ( filepath : string ) : TokenLockConfigEntry [ ] => {
70
70
const data = fs . readFileSync ( filepath , 'utf8' )
71
- const entries = data . split ( '\n' ) . map ( ( e ) => e . trim ( ) )
71
+ const entries = data . split ( '\n' ) . map ( e => e . trim ( ) )
72
72
entries . shift ( ) // remove the title from the csv
73
73
return entries
74
- . filter ( ( entryData ) => ! ! entryData )
74
+ . filter ( entryData => ! ! entryData )
75
75
. map ( ( entryData ) => {
76
76
const entry = entryData . split ( ',' )
77
77
return {
@@ -89,9 +89,9 @@ const loadDeployData = (filepath: string): TokenLockConfigEntry[] => {
89
89
90
90
const loadResultData = ( filepath : string ) : TokenLockConfigEntry [ ] => {
91
91
const data = fs . readFileSync ( filepath , 'utf8' )
92
- const entries = data . split ( '\n' ) . map ( ( e ) => e . trim ( ) )
92
+ const entries = data . split ( '\n' ) . map ( e => e . trim ( ) )
93
93
return entries
94
- . filter ( ( entryData ) => ! ! entryData )
94
+ . filter ( entryData => ! ! entryData )
95
95
. map ( ( entryData ) => {
96
96
const entry = entryData . split ( ',' )
97
97
return {
@@ -246,7 +246,7 @@ const populateEntries = async (
246
246
tokenAddress : string ,
247
247
ownerAddress : string ,
248
248
) => {
249
- const results = [ ]
249
+ const results : TokenLockConfigEntry [ ] = [ ]
250
250
for ( const entry of entries ) {
251
251
entry . owner = ownerAddress
252
252
entry . salt = await calculateSalt ( hre , entry , managerAddress , tokenAddress )
@@ -323,7 +323,7 @@ task('create-token-locks', 'Create token lock contracts from file')
323
323
entries = await populateEntries ( hre , entries , manager . address , tokenAddress , taskArgs . ownerAddress )
324
324
325
325
// Filter out already deployed ones
326
- entries = entries . filter ( ( entry ) => ! deployedEntries . find ( ( deployedEntry ) => deployedEntry . salt === entry . salt ) )
326
+ entries = entries . filter ( entry => ! deployedEntries . find ( deployedEntry => deployedEntry . salt === entry . salt ) )
327
327
logger . success ( `Total of ${ entries . length } entries after removing already deployed. All good!` )
328
328
if ( entries . length === 0 ) {
329
329
logger . warn ( 'Nothing new to deploy' )
@@ -378,7 +378,7 @@ task('create-token-locks', 'Create token lock contracts from file')
378
378
const queue = new PQueue ( { concurrency : 6 } )
379
379
380
380
for ( const entry of entries ) {
381
- queue . add ( async ( ) => {
381
+ await queue . add ( async ( ) => {
382
382
logger . log ( '' )
383
383
logger . info ( `Creating contract...` )
384
384
logger . log ( prettyConfigEntry ( entry ) )
0 commit comments