This contract has given out ERC20 tokens called VSL. The total supply is said to be 33,390,496.03337560002666059, but if you inspect the contract, that value is stored as a uint256, which means it's value is 33390496033375600026660590. How do you convert a uint256 to get the correct amount issued?


While creating a token, the creator of token specifies the number of decimal places he needs for his token. Since ethereum doesn't fully support decimals, the decimals defined by contact creator defines the smallest unit of the token. For eg, if the decimal place for token say, ABC Coin is 2, this means that the smallest unit of ABC token is 0.01. So in order to send someone 1 ABC coin, you need to send him/her 100 (1*no of Decimals) ABC Tokens.

Now talking about your case of VSL Token. The decimal units of VSL Token is 18. So if the total supply is 33390496033375600026660590, then this means actual supply is 33390496.03337560002666059 (33390496033375600026660590/10^18).


Divide it by 1e18. Should have done more reading before posting this question.

  • Note that different tokens can use different numbers of decimal places between 1e0 and 1e18. – Afr Jun 6 '17 at 10:24

Notice that Solidity does not have floating-point numbers support, so everything is expressed in integers. For tokens, what you would need to do is to multiply or divide the given number by the decimals variable said token has specified.


There is a detailed documentation written by me here.

  • Please provide some part of the link you provided as text. Only the link is not considered as a good answer as the link may be broken in future. – Prashant Prabhakar Singh Oct 21 '17 at 16:39
  • Since GitHub is purchased by Microsoft, I don't see how the link could be broken in any time near. :p – Jinhua Wang Jun 7 '18 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.