-
-
Save tcichowicz/655337b781717dd5ac73277d52cd488e to your computer and use it in GitHub Desktop.
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
<h1>Espeo Token ICO</h1> | |
<p id="contractAddress"></p> | |
<p>Raised so far:</p> | |
<h2 id="totalRaised"></h2> | |
<script src="https://cdn.rawgit.com/ethereum/web3.js/0.19.0/dist/web3.js"></script> | |
<script src="ico.js"></script> |
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
/// utility methods | |
const writeValue = (elementId, value) => document.getElementById(elementId).textContent = value; | |
const toEthString = wei => wei / 10**18 + ' ETH'; | |
/// constants | |
const abi = []; // espeoTokenIco-abi.json at https://gist.github.com/tcichowicz/6567312563ae2aed1e6764b88a8e7976 | |
const targetApi = 'https://ropsten.infura.io/'; | |
const contractAddress = '0xA292375e9343f1684e36a03b56bCe6E0664aD1f9'; | |
/// getting contract | |
const web3 = new Web3(new Web3.providers.HttpProvider(targetApi)); | |
const espeoTokenIco = web3.eth.contract(abi).at(contractAddress); | |
/// read and display values | |
writeValue('contractAddress', contractAddress); | |
writeValue('totalRaised', toEthString(espeoTokenIco.totalRaised())); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment