-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Description
ERC: 22
Title: Token standard
Status: Draft
Type: Informational
Created: 19-11.2015
Resolution: https://github.com/ethereum/wiki/wiki/Standardized_Contract_APIs
Abstract
Registries allow listing and searching of tokens and can serve as connector between tokens.
Specification
Token Registries
Token registries contain information about tokens. There is at least one global registry (though other may create more like the global Registry) to which you can add your token. Adding your token to it would increase the experience of the user that the GUI Client can use or not.
symbol
function setSymbol(string _s)
function symbol(address _token) constant returns (string)Sets or returns a short sequence of letters that are used to represent the unit of the coin. When setting, it assumes the msg.sender is the token. Solidity string is on UTF-8 format so this should support any character supported by UTF-8. Symbols are chosen by the contract and it's up to the client to decide how to handle different currencies with similar or identical symbols.
Examples or symbols: USDX, BOB$, Ƀ, % of shares.
name
function setName(string _s)
function name(address _token) constant returns (string)Sets or returns the name of a token. Solidity string is on UTF-8 format so this should support any character supported by UTF-8. Names are chosen by the contract and it's up to the client to decide how to handle different currencies with similar or identical names.
Examples of names: e-Dollar, BobToken, Bitcoin-Eth.
baseUnit
function setBaseUnit(uint _s)
function baseUnit(address _token) constant returns (uint256)Sets or returns the base unit of a token. Although most tokens are displayed to the final user as containing decimal points, token values are unsigned integers counting in the smallest possible unit. The client should always display the total units divided by baseUnit. Base units can be any integer but we suggest only using powers of 10. At the moment there is no support for multiple sub-units.
Example: Bob has a balance of 100000 BobTokens, whose base unit is 100. His balance will be displayed on the client as BOB$100.00
Also see #20