mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-11 14:24:24 +00:00
Update compiler.js
This commit is contained in:
parent
867b7a16fc
commit
f5595adb43
@ -13,14 +13,15 @@ Compiler.prototype.init = function(env) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Compiler.prototype.compile_solidity = function(contractFiles) {
|
Compiler.prototype.compile_solidity = function(contractFiles) {
|
||||||
console.log(contractFiles.length);
|
|
||||||
var sources = {}
|
var input = {}
|
||||||
|
|
||||||
for (var i = 0; i < contractFiles.length; i++){
|
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;
|
var json = output.contracts;
|
||||||
|
|
||||||
@ -31,7 +32,6 @@ console.log(contractFiles.length);
|
|||||||
|
|
||||||
compiled_object[className] = {};
|
compiled_object[className] = {};
|
||||||
compiled_object[className].code = contract.bytecode;
|
compiled_object[className].code = contract.bytecode;
|
||||||
|
|
||||||
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.interface);
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ Compiler.prototype.compile = function(contractFiles) {
|
|||||||
throw new Error("extension not known, got " + extension);
|
throw new Error("extension not known, got " + extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(solidity);
|
|
||||||
if (solidity.length > 0) return this.compile_solidity(solidity);
|
if (solidity.length > 0) return this.compile_solidity(solidity);
|
||||||
if (serpent.length > 0) return this.compile_serpent(serpent);
|
if (serpent.length > 0) return this.compile_serpent(serpent);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user