Update compiler.js

This commit is contained in:
VoR0220 2015-10-26 18:42:56 -05:00 committed by Iuri Matias
parent 867b7a16fc
commit f5595adb43
1 changed files with 7 additions and 7 deletions

View File

@ -13,14 +13,15 @@ Compiler.prototype.init = function(env) {
};
Compiler.prototype.compile_solidity = function(contractFiles) {
console.log(contractFiles.length);
var sources = {}
var input = {}
for (var i = 0; i < contractFiles.length; i++){
sources[contractFiles[i]] = fs.readFileSync(contractFiles[i]).toString();
input[contractFiles[i].substring(14)] = fs.readFileSync(contractFiles[i]).toString();
}
var output = solc.compile(source, 1);
var output = solc.compile({sources: input}, 1);
var json = output.contracts;
@ -31,7 +32,6 @@ console.log(contractFiles.length);
compiled_object[className] = {};
compiled_object[className].code = contract.bytecode;
compiled_object[className].info = {};
compiled_object[className].info.abiDefinition = JSON.parse(contract.interface);
}
@ -96,7 +96,7 @@ Compiler.prototype.compile = function(contractFiles) {
throw new Error("extension not known, got " + extension);
}
}
console.log(solidity);
if (solidity.length > 0) return this.compile_solidity(solidity);
if (serpent.length > 0) return this.compile_serpent(serpent);
};