File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -18,26 +18,17 @@ async function printSize() {
18
18
let files = await readFiles ( ) ;
19
19
console . log ( `NOTE- Maximum size of contracts allowed to deloyed on the Ethereum mainnet is 24 KB(EIP170)` ) ;
20
20
console . log ( `---- Size of the contracts ----` ) ;
21
- let contracts = new Array ( ) ;
22
- let size = new Array ( ) ;
21
+ let dataTable = [ [ 'Contracts' , 'Size in KB' ] ] ;
23
22
files . forEach ( item => {
24
23
let content = JSON . parse ( fs . readFileSync ( `./build/contracts/${ item } ` ) . toString ( ) ) . deployedBytecode ;
25
24
let sizeInKB = content . toString ( ) . length / 2 / 1024 ;
26
- size . push ( sizeInKB ) ;
27
25
if ( sizeInKB > 24 )
28
- contracts . push ( chalk . red ( path . basename ( item , ".json" ) ) ) ;
26
+ dataTable . push ( [ chalk . red ( path . basename ( item , ".json" ) ) , chalk . red ( sizeInKB ) ] ) ;
29
27
else if ( sizeInKB > 20 )
30
- contracts . push ( chalk . yellow ( path . basename ( item , ".json" ) ) ) ;
28
+ dataTable . push ( [ chalk . yellow ( path . basename ( item , ".json" ) ) , chalk . yellow ( sizeInKB ) ] ) ;
31
29
else
32
- contracts . push ( chalk . green ( path . basename ( item , ".json" ) ) ) ;
30
+ dataTable . push ( [ chalk . green ( path . basename ( item , ".json" ) ) , chalk . green ( sizeInKB ) ] ) ;
33
31
} ) ;
34
- let dataTable = [ [ 'Contracts' , 'Size in KB' ] ] ;
35
- for ( let i = 0 ; i < contracts . length ; i ++ ) {
36
- dataTable . push ( [
37
- contracts [ i ] ,
38
- size [ i ]
39
- ] ) ;
40
- }
41
32
console . log ( table ( dataTable ) ) ;
42
33
}
43
34
You can’t perform that action at this time.
0 commit comments