Skip to content

Instantly share code, notes, and snippets.

@josephros
Created August 13, 2017 17:43
Show Gist options
  • Save josephros/d916b72e3908373f521c55c1cb5a1c42 to your computer and use it in GitHub Desktop.
Save josephros/d916b72e3908373f521c55c1cb5a1c42 to your computer and use it in GitHub Desktop.
Update the interface with the results
var percentOwned = balance.div(totalSupply).mul(100);
var divisor = new web3.BigNumber(10).toPower(decimals);
totalSupply = totalSupply.div(divisor);
balance = balance.div(divisor);
var results = '<b>Token:</b> ' + name + '<br />';
results += '<b>Total supply:</b> ' + totalSupply.round(5) + '<br /><br />';
results += accountAddress + ' owns ' + balance.round(5) + ' which is ' + percentOwned.round(5) + '% of the total supply';
$('#results').html(results);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment