@@ -60,15 +60,19 @@ function translateJsonCompilerOutput (output) {
60
60
var contractInput = output [ 'contracts' ] [ contract ] ;
61
61
62
62
var gasEstimates = contractInput [ 'gasEstimates' ] ;
63
- // FIXME: support undefined or a nicer way in translateGasEstimates
64
- if ( ! gasEstimates [ 'creation' ] ) {
65
- gasEstimates [ 'creation' ] = [ null , null ] ;
63
+ var translatedGasEstimates = { } ;
64
+
65
+ if ( gasEstimates [ 'creation' ] ) {
66
+ translatedGasEstimates [ 'creation' ] = {
67
+ 'codeDepositCost' : translateGasEstimates ( gasEstimates [ 'creation' ] [ 1 ] ) ,
68
+ 'executionCost' : translateGasEstimates ( gasEstimates [ 'creation' ] [ 0 ] )
69
+ } ;
66
70
}
67
- if ( ! gasEstimates [ 'internal' ] ) {
68
- gasEstimates [ 'internal' ] = null ;
71
+ if ( gasEstimates [ 'internal' ] ) {
72
+ translatedGasEstimates [ 'internal' ] = translateGasEstimates ( gasEstimates [ 'internal' ] ) ;
69
73
}
70
- if ( ! gasEstimates [ 'external' ] ) {
71
- gasEstimates [ 'external' ] = null ;
74
+ if ( gasEstimates [ 'external' ] ) {
75
+ translatedGasEstimates [ 'external' ] = translateGasEstimates ( gasEstimates [ 'external' ] ) ;
72
76
}
73
77
74
78
var contractOutput = {
@@ -86,14 +90,7 @@ function translateJsonCompilerOutput (output) {
86
90
'sourceMap' : contractInput [ 'srcmapRuntime' ]
87
91
} ,
88
92
'methodIdentifiers' : contractInput [ 'functionHashes' ] ,
89
- 'gasEstimates' : {
90
- 'creation' : {
91
- 'codeDepositCost' : translateGasEstimates ( gasEstimates [ 'creation' ] [ 1 ] ) ,
92
- 'executionCost' : translateGasEstimates ( gasEstimates [ 'creation' ] [ 0 ] )
93
- } ,
94
- 'internal' : translateGasEstimates ( gasEstimates [ 'internal' ] ) ,
95
- 'external' : translateGasEstimates ( gasEstimates [ 'external' ] )
96
- }
93
+ 'gasEstimates' : translatedGasEstimates
97
94
}
98
95
} ;
99
96
0 commit comments