Documentation
¶
Index ¶
- type Drip
- func (d *Drip) BigInt() *big.Int
- func (d *Drip) Cmp(y *Drip) int
- func (d *Drip) Format(unit UnitType) decimal.Decimal
- func (d *Drip) FormatCFX() decimal.Decimal
- func (d *Drip) ParseFrom(value decimal.Decimal, unit UnitType) error
- func (d *Drip) ParseFromCFX(value decimal.Decimal) error
- func (d Drip) String() string
- type UnitType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Drip ¶
type Drip struct {
// contains filtered or unexported fields
}
Drip is minimal unit of conflux network coin, 1CFX = 10^18 DRIP
func NewDripFromString ¶
NewDripFromString create Drip from string, prettyValue could be one part or two parts, if one part like "12345" that equals to "12345 Drip", if two parts like "1.2 CFX", the second part is unit
NewDripFromString("12345") => 12345 Drip NewDripFromString("1.2 CFX") => 1.2 CFX
func (*Drip) Format ¶
Format format drip to value with unit
d := NewDrip(big.NewInt(1000000000)) d.Format(UNIT_CFX) => 0.0000000001
func (*Drip) FormatCFX ¶
FormatCFX format drip to value with unit CFX
d := NewDrip(big.NewInt(1000000000)) d.Format() => 0.0000000001
func (*Drip) ParseFrom ¶
ParseFrom parse drip from value with uint
ParseFrom(10, UNIT_GCFX) => 10_000_000_000 Drip
func (*Drip) ParseFromCFX ¶
ParseFrom same to ParseFrom and unit is CFX
ParseFrom(10) => 10_000_000_000 Drip
Click to show internal directories.
Click to hide internal directories.