mirror of https://github.com/embarklabs/embark.git
change back to old compiler
This commit is contained in:
parent
0c6ced4dc9
commit
2a1ec1b2d7
|
@ -13,14 +13,14 @@ Compiler.prototype.init = function(env) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Compiler.prototype.compile_solidity = function(contractFile) {
|
Compiler.prototype.compile_solidity = function(contractFile) {
|
||||||
var source = fs.readFileSync(contractFile).toString();
|
var cmd, result, output, version, json, compiled_object;
|
||||||
var output = solc.compile(source, 1);
|
|
||||||
|
|
||||||
if(output.errors && output.errors.length>0){
|
cmd = "solc --input-file " + contractFile + " --combined-json bin,abi";
|
||||||
throw new Error(output.errors[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var json = output.contracts;
|
result = exec(cmd, {silent: true});
|
||||||
|
output = result.output;
|
||||||
|
|
||||||
|
json = JSON.parse(output).contracts;
|
||||||
|
|
||||||
compiled_object = {}
|
compiled_object = {}
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ Compiler.prototype.compile_solidity = function(contractFile) {
|
||||||
var contract = json[className];
|
var contract = json[className];
|
||||||
|
|
||||||
compiled_object[className] = {};
|
compiled_object[className] = {};
|
||||||
compiled_object[className].code = contract.bytecode;
|
compiled_object[className].code = contract.binary || contract.bin;
|
||||||
compiled_object[className].info = {};
|
compiled_object[className].info = {};
|
||||||
compiled_object[className].info.abiDefinition = JSON.parse(contract.interface);
|
compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"] || contract["json-abi"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return compiled_object;
|
return compiled_object;
|
||||||
|
|
Loading…
Reference in New Issue