HumanStandardToken.sol 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. This Token Contract implements the standard token functionality (https://github.com/ethereum/EIPs/issues/20) as well as the following OPTIONAL extras intended for use by humans.
  3. In other words. This is intended for deployment in something like a Token Factory or Mist wallet, and then used by humans.
  4. Imagine coins, currencies, shares, voting weight, etc.
  5. Machine-based, rapid creation of many tokens would not necessarily need these extra features or will be minted in other manners.
  6. 1) Initial Finite Supply (upon creation one specifies how much is minted).
  7. 2) In the absence of a token registry: Optional Decimal, Symbol & Name.
  8. 3) Optional approveAndCall() functionality to notify a contract if an approval() has occurred.
  9. .*/
  10. import "./StandardToken.sol";
  11. pragma solidity ^0.4.8;
  12. contract HumanStandardToken is StandardToken {
  13. /* Public variables of the token */
  14. /*
  15. NOTE:
  16. The following variables are OPTIONAL vanities. One does not have to include them.
  17. They allow one to customise the token contract & in no way influences the core functionality.
  18. Some wallets/interfaces might not even bother to look at this information.
  19. */
  20. string public name; //fancy name: eg Simon Bucks
  21. uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether.
  22. string public symbol; //An identifier: eg SBX
  23. string public version = 'H0.1'; //human 0.1 standard. Just an arbitrary versioning scheme.
  24. function HumanStandardToken(
  25. uint256 _initialAmount,
  26. string _tokenName,
  27. uint8 _decimalUnits,
  28. string _tokenSymbol
  29. ) public {
  30. balances[msg.sender] = _initialAmount; // Give the creator all initial tokens
  31. totalSupply = _initialAmount; // Update total supply
  32. name = _tokenName; // Set the name for display purposes
  33. decimals = _decimalUnits; // Amount of decimals for display purposes
  34. symbol = _tokenSymbol; // Set the symbol for display purposes
  35. }
  36. }