Add optimize and autocompile toggles

This commit is contained in:
Nicolas Gotchac
2016-12-20 02:11:04 +01:00
parent f70e808056
commit 5886034265
4 changed files with 46 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ import solc from 'solc/browser-wrapper';
export default class SolidityUtils {
static compile (data, compiler) {
const { sourcecode, build, optimized = 1 } = data;
const { sourcecode, build, optimize } = data;
const start = Date.now();
console.log('[solidity] compiling...');
@@ -28,7 +28,7 @@ export default class SolidityUtils {
'': sourcecode
};
const compiled = compiler.compile({ sources: input }, optimized);
const compiled = compiler.compile({ sources: input }, optimize ? 1 : 0);
const time = Math.round((Date.now() - start) / 100) / 10;
console.log(`[solidity] done compiling in ${time}s`);