Skip to content

Commit

Permalink
sol.json or srcmap and runtime directly
Browse files Browse the repository at this point in the history
  • Loading branch information
MrChico committed Jun 11, 2018
1 parent b233e80 commit ff0983d
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions libexec/klab-evm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ const jsondiffpatch = require("jsondiffpatch").create({
});
const clc = require('cli-color');
var clear = require("cli-clear");
const testPath = path => {
try {
fs.accessSync(path, fs.constants.F_OK);
return true;
} catch (e) {
return false;
}
}

const { formatStep } = require("./../lib/formatter.js");

Expand All @@ -22,12 +30,25 @@ stdin.setEncoding( 'utf8' );
const tw = process.stdout.columns; // total width

const config = JSON.parse(fs.readFileSync("./config.json"));
if (testPath(config.source + ".json")) {
config.solJson = JSON.parse(fs.readFileSync(config.source + ".json"));
contract_path = config.source.replace('/','').replace('.','') + config.source.replace('./',':').replace('.sol','')
contract_json = config.solJson.contracts[contract_path]
config["bin_runtime"] = contract_json["bin-runtime"].toString();
config["sourcemap"] = contract_json["srcmap-runtime"].toString();
}
else {
config["bin_runtime"] = fs.readFileSync(config["bin_runtime"]).toString()
config["sourcemap"] = fs.readFileSync(config["sourcemap"]).toString()
}



// READ the spec files
[
"spec",
"lemmas",
"bin_runtime",
"source",
"sourcemap"
].forEach(filetype => {
let content = fs.readFileSync(config[filetype]).toString()
config[filetype] = content;
Expand Down

0 comments on commit ff0983d

Please sign in to comment.