Documentation
¶
Index ¶
Constants ¶
const ( // NanoAUMPerAUM is the number of NanoAUM in one AUM. NanoAUMPerAUM = 1e9 // DefaultMaxNanoAUM is the default maximum transaction amount allowed in NanoAUM (42 million for mainnet). DefaultMaxNanoAUM = 42e6 * NanoAUMPerAUM // TestnetMaxNanoAUM is the maximum amount for testnet (9 billion). TestnetMaxNanoAUM = 9e9 * NanoAUMPerAUM )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Amount ¶
type Amount int64
Amount represents the atomic unit in Aerium blockchain. Each unit equals to 1e-9 of a AUM.
func FromString ¶
FromString parses a string representing a value in AUM. It then uses NewAmount to create an Amount based on the parsed floating-point value. If the parsing of the string fails, it returns an error.
func MaxNanoAUM ¶
func MaxNanoAUM() Amount
MaxNanoAUM returns the maximum amount based on chain type.
func NewAmount ¶
NewAmount creates an Amount from a floating-point value representing an amount in AUM. NewAmount returns an error if f is NaN or +-Infinity, but it does not check whether the amount is within the total amount of AUM producible, as it may not refer to an amount at a single moment in time.
NewAmount is specifically for converting AUM to NanoAUM. For creating a new Amount with an int64 value which denotes a quantity of NanoAUM, do a simple type conversion from type int64 to Amount.
func (Amount) Format ¶
Format formats a monetary amount counted in Aerium base units as a string for a given unit. The conversion will succeed for any unit, however, known units will be formatted with an appended label describing the units with SI notation, and "NanoAUM" for the base unit.
type Unit ¶
type Unit int
Unit describes a method of converting an Amount to something other than the base unit of a Aerium. The value of the Unit is the exponent component of the decadic multiple to convert from an amount in Aerium to an amount counted in units.