Documentation ¶
Overview ¶
Package currency provides library functions for manipulating token balances
Units ¶
Taking inspiration from the SI units, we have suitable multiples:
1/ 1 000 000 000 000 000 000 atto (a) 10^-18 1/ 1 000 000 000 000 000 femto (f) 10^-15 1/ 1 000 000 000 000 pico (p) 10^-12 1/ 1 000 000 000 nano (n) 10^-9 1/ 1 000 000 micro (u) 10^-6 1/ 1 000 milli (m) 10^-3 1 Token (T) 1 All letters are lowercase except for T for Token
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandAndSeparateCurrencyString ¶
ExpandAndSeparateCurrencyString expands the input string, then applies comma separators
func ExpandCurrencyString ¶
ExpandCurrencyString takes a string with a token suffix and expands it with the appropriate number of zeroes. The input string may contain a decimal point, and it will expand it, standard form style. By conventtion hex balances have a leading 0x, decimals are bare. THis function will work correctly with either. This function returns Attoms.
func FormatTokenString ¶ added in v0.3.3
FormatTokenString is a wrapper to FormatUnitString
func FormatUnitString ¶ added in v0.3.3
FormatUnitString takes an atomic input and returns
Types ¶
This section is empty.