Last active
November 21, 2017 07:58
-
-
Save devonwesley/cb4364a9d9984643001a60c0ef8b5145 to your computer and use it in GitHub Desktop.
Code snippet for Medium blog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addCompileEvent() { | |
const compileBtn = document.getElementById('contract-compile') | |
compileBtn.addEventListener('click', solcCompile) | |
} | |
function solcCompile() { | |
if (!compiler) return alert('Please select a compiler version.') | |
setCompileButtonState(true) | |
status("Compiling contract...") | |
compiledContract = compiler.compile(getSourceCode(), optimize) | |
if (compiledContract) setCompileButtonState(false) | |
console.log('Compiled Contract :: ==>', compiledContract) | |
status("Compile Complete.") | |
} | |
function getSourceCode() { | |
return document.getElementById("source").value | |
} | |
function setCompileButtonState(state) { | |
document.getElementById("contract-compile").disabled = state | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment