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 deployContractEvent(name, contract) { | |
const comfirmMsg = ` | |
Contract: ${name.substring(1)} | |
Network: ${currentNetwork()} | |
Confirm to deploy with these settings. | |
` | |
if (!confirm(comfirmMsg)) return | |
const { bytecode, interface } = 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-${contract}-${Math.random()}` | |
const gas = contracts[contract].gasEstimates.creation | |
createContractInfo(gas, contract, label, function (el) { | |
contractListContainer.appendChild(el) |
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-col-md-6"> | |
<div class="mui-panel"> | |
<div id="account-addresses"></div> | |
</div> | |
</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
function getAccounts() { | |
const ethAccount = web3.eth.accounts[0] | |
return document | |
.getElementById('account-addresses') | |
.innerHTML = `<div> | |
Account: ${ethAccount} | |
<br /> | |
Balance: ${balanceInEth(ethAccount)} | |
</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
if (typeof web3 !== 'undefined') { | |
web3 = new Web3(web3.currentProvider) | |
} else { | |
// set the provider you want from Web3.providers | |
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")) | |
} |
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 renderContractDetails(name, contract) { | |
const modalEl = document.createElement('div') | |
modalEl.style.width = '700px'; | |
modalEl.style.margin = '100px auto'; | |
modalEl.style.padding = '50px'; | |
modalEl.style.backgroundColor = '#fff'; | |
modalEl.appendChild(renderContractInfo(name, contract)) | |
mui.overlay('on', modalEl); | |
} |
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) |
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
<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
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() | |
} |