@@ -21,9 +21,20 @@ Compiler.prototype.init = function(env) {
2121} ;
2222
2323Compiler . prototype . compile_solidity = function ( contractFile ) {
24- var cmd , result , output , json , compiled_object ;
24+ var cmd , result , output , version , json , compiled_object ;
25+
26+ cmd = "solc --version" ;
27+
28+ result = exec ( cmd , { silent : true } ) ;
29+ output = result . output ;
30+ version = output . split ( '\n' ) [ 1 ] . split ( ' ' ) [ 1 ] . slice ( 0 , 5 ) ;
2531
26- cmd = "solc --input-file " + contractFile + " --combined-json binary,json-abi" ;
32+ if ( version == '0.1.1' ) {
33+ cmd = "solc --input-file " + contractFile + " --combined-json binary,json-abi" ;
34+ }
35+ else {
36+ cmd = "solc --input-file " + contractFile + " --combined-json bin,abi" ;
37+ }
2738
2839 result = exec ( cmd , { silent : true } ) ;
2940 output = result . output ;
@@ -39,9 +50,9 @@ Compiler.prototype.compile_solidity = function(contractFile) {
3950 var contract = json [ className ] ;
4051
4152 compiled_object [ className ] = { } ;
42- compiled_object [ className ] . code = contract . binary ;
53+ compiled_object [ className ] . code = contract . binary || contact . bin ;
4354 compiled_object [ className ] . info = { } ;
44- compiled_object [ className ] . info . abiDefinition = JSON . parse ( contract [ "json-abi" ] ) ;
55+ compiled_object [ className ] . info . abiDefinition = JSON . parse ( contract [ "abi" ] || contract [ " json-abi"] ) ;
4556 }
4657
4758 return compiled_object ;
0 commit comments