coin

package
v3.1.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewDecFromFloat

func MustNewDecFromFloat(f float64) sdk.Dec

func NewDecFromFloat

func NewDecFromFloat(f float64) (sdk.Dec, error)

Types

type DecBld

type DecBld struct {
	D sdk.DecCoin
}

TODO: add unit tests for `util/coin/math.go` DecBld is a Builder pattern for dec coin

func NewDecBld

func NewDecBld(d sdk.DecCoin) *DecBld

NewDecBld is a constructor for DecBld type

func (*DecBld) Scale

func (d *DecBld) Scale(f int64) *DecBld

Scale scales dec coin by given factor

func (*DecBld) ScaleStr

func (d *DecBld) ScaleStr(f string) *DecBld

Scale scales dec coin by given factor provided as string. Panics if f is not a correct decimal number.

func (*DecBld) ToCoin

func (d *DecBld) ToCoin() sdk.Coin

ToCoin converts DecCoin to sdk.Coin rounding up

func (*DecBld) ToCoins

func (d *DecBld) ToCoins() sdk.Coins

ToCoins converts DecCoin to sdk.Coins rounding up

func (*DecBld) ToDecCoins

func (d *DecBld) ToDecCoins() sdk.DecCoins

ToCoin converts DecCoin to sdk.DecCoins

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL