Documentation ¶
Overview ¶
Package token implements the token-related parts of the staking API.
Index ¶
Constants ¶
View Source
const ( // ModuleName is a unique module name for the staking/token module. ModuleName = "staking/token" // Maximum length of the token symbol. TokenSymbolMaxLength = 8 // Regular expression defining valid token symbol characters. TokenSymbolRegexp = "^[A-Z]+$" // nolint: gosec // Not that kind of token :). // Maximum value of token's value base-10 exponent. TokenValueExponentMaxValue = 20 )
Variables ¶
View Source
var ErrInvalidTokenValueExponent = errors.New(ModuleName, 1, "staking/token: invalid token's value exponent")
ErrInvalidTokenValueExponent is the error returned when an invalid token's value base-10 exponent is specified.
Functions ¶
func ConvertToTokenAmount ¶
ConvertToTokenAmount returns the given amount in base units to the corresponding token amount accourding to the given token's value base-10 exponent.
func PrettyPrintAmount ¶
PrettyPrintAmount writes a pretty-printed representation of the given amount to the given writer.
If the context carries appropriate values for the token's ticker symbol and token's value base-10 exponent, then the amount is printed in tokens instead of base units.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.