This file contains 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
pragma solidity ^0.4.8; | |
contract Victim { | |
bool locked; | |
/** | |
@dev Modifier to insure that functions cannot be reentered | |
during execution. Note there is only one global "locked" var, so | |
there is a potential to be locked out of all functions that use | |
the modifier at the same time. |
This file contains 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
pragma solidity ^0.4.18; | |
contract HelloWorld { | |
function displayMessage() constant returns (string) { | |
return "Whale hello there!"; | |
} | |
} |
This file contains 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
<div class="mui-container-fluid"> | |
<div class="mui-row"> | |
<div class="mui-col-md-6"> | |
<div class="mui-panel"> | |
<p style="font-size:25px; font-weight:bold"> | |
Compile Contract | |
</p> | |
<textarea id="source" onclick="this.select()" style="height:360px; width: 600px; display:block; margin-left:20px"></textarea> | |
<button class="mui-btn mui-btn--primary"> | |
Compile |
This file contains 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
<section class="mui-container-fluid"> | |
<div class="mui-row"> | |
<div class="mui-col-md-6"> | |
<div class="mui-select"> | |
<select id="versions"></select> | |
</div> | |
</div> | |
</div> | |
</section> |
This file contains 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
<div class="mui-container" style="float: left;"> | |
<p id="status" style="float: right; margin-top:20px"></p> | |
</div> |
This file contains 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
let compiler | |
window.onload = function () { | |
document.getElementById('versions').onchange = loadSolcVersion | |
if (!BrowserSolc) { | |
console.log('You have to load browser-solc.js in the page. We recommend using a <script> tag.') | |
throw new Error() | |
} |
This file contains 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
<div class="mui-row"> | |
<div class="mui-col-md-6"> | |
<div class="mui-panel"> | |
<p style="font-size:25px; font-weight:bold"> | |
Compile Contract | |
</p> | |
<textarea id="source" onclick="this.select()" style="height: 360px; width: 530px; display: block; margin-left: 20px;"></textarea> | |
<button id="contract-compile" class="mui-btn mui-btn--primary"> | |
Compile | |
</button> |
This file contains 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...") |
This file contains 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 renderContractList() { | |
const contractListContainer = document.getElementById('contract-list') | |
const { contracts } = compiledContract | |
Object.keys(contracts).forEach((contract, index) => { | |
const label = `contract-id-${index}` | |
const gas = contracts[contract].gasEstimates.creation | |
createContractInfo(gas, contract, label, function(el){ | |
contractListContainer.appendChild(el) |