Skip to content

Instantly share code, notes, and snippets.

@tcichowicz
Created August 7, 2017 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tcichowicz/655337b781717dd5ac73277d52cd488e to your computer and use it in GitHub Desktop.
Save tcichowicz/655337b781717dd5ac73277d52cd488e to your computer and use it in GitHub Desktop.
<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>
/// 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