Documentation ¶
Index ¶
- Constants
- type Amount
- func FromAmount(a *Amount) *Amount
- func FromBig(b *big.Int) *Amount
- func FromBigString(s string, base int) (*Amount, error)
- func FromInteger(i int64) *Amount
- func FromString(s string) (*Amount, error)
- func MustFromBigString(s string, base int) *Amount
- func MustFromString(s string) *Amount
- func New() *Amount
Constants ¶
const Precision = 18
Precision of amount
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Amount ¶
Amount is amount of token in Sumus
func FromAmount ¶
FromAmount creates an instance and copies a value from another instance
func FromBig ¶
FromBig creates an instance, setting it's value from big integer (100 => 0.000000000000000100)
func FromBigString ¶
FromBigString creates an instance from a string containing big integer representation of the value. Example: "0100" (base 10) => 0.000000000000000100, "100" (base 00) => 0.000000000000000100 Example: "000A" (base 16) => 0.000000000000000010, "0xA" (base 00) => 0.000000000000000010 Example: "0144" (base 08) => 0.000000000000000100, "012" (base 00) => 0.000000000000000010
func FromInteger ¶
FromInteger creates an instance, setting integral part of it's value from integer (100 => 100.000000000000000000)
func FromString ¶
FromString creates an instance from a string containing float-point representation of the value. Example: "1.000000000000000000123" => 1.000000000000000000 Example: "1.000000000000000000999" => 1.000000000000000001
func MustFromBigString ¶
MustFromBigString does the same as FromBigString, but panics on error
func MustFromString ¶
MustFromString does the same as FromString, but panics on error
func (*Amount) Fraction ¶
Fraction part as string: -123.000000000000456000 => "456000" (width 0) -123.000000000000456000 => "000000000000456000" (width 18)
func (*Amount) Integer ¶
Integer part as string: -123.000000000000456000 => "123" (width 0) -123.000000000000456000 => "00123" (width 5)