Documentation ¶
Index ¶
- Constants
- Variables
- func CoinTypeKey(coinName string) string
- func GetCoin(coinStr string) (denom, amount string, err error)
- func GetCoinName(coinStr string) (coinName string, err error)
- type AnteHandler
- type CoinType
- func (ct CoinType) Convert(orgCoinStr string, denom string) (destCoinStr string, err error)
- func (ct CoinType) ConvertToMinCoin(coinStr string) (coin sdk.Coin, err error)
- func (ct CoinType) GetMainUnit() (unit Unit)
- func (ct CoinType) GetMinUnit() (unit Unit)
- func (ct CoinType) GetUnit(denom string) (u Unit, err error)
- func (ct CoinType) String() string
- type FeePreprocessHandler
- type FeeRefundHandler
- type Handler
- type Origin
- type Rat
- type Unit
- type Units
Constants ¶
View Source
const ( //1 iris = 10^3 iris-milli Milli = "milli" //1 iris = 10^6 iris-micro Micro = "micro" //1 iris = 10^9 iris-nano Nano = "nano" //1 iris = 10^12 iris-pico Pico = "pico" //1 iris = 10^15 iris-femto Femto = "femto" //1 iris = 10^18 iris-atto Atto = "atto" Native Origin = 0x01 External Origin = 0x02 UserIssued Origin = 0x03 )
Variables ¶
View Source
var ( MainUnit = func(coinName string) Unit { return NewUnit(coinName, 0) } MilliUnit = func(coinName string) Unit { denom := fmt.Sprintf("%s-%s", coinName, Milli) return NewUnit(denom, 3) } MicroUnit = func(coinName string) Unit { denom := fmt.Sprintf("%s-%s", coinName, Micro) return NewUnit(denom, 6) } NanoUnit = func(coinName string) Unit { denom := fmt.Sprintf("%s-%s", coinName, Nano) return NewUnit(denom, 9) } PicoUnit = func(coinName string) Unit { denom := fmt.Sprintf("%s-%s", coinName, Pico) return NewUnit(denom, 12) } FemtoUnit = func(coinName string) Unit { denom := fmt.Sprintf("%s-%s", coinName, Femto) return NewUnit(denom, 15) } AttoUnit = func(coinName string) Unit { denom := fmt.Sprintf("%s-%s", coinName, Atto) return NewUnit(denom, 18) } )
Functions ¶
func CoinTypeKey ¶
func GetCoinName ¶
Types ¶
type AnteHandler ¶
type AnteHandler func(ctx sdk.Context, tx sdk.Tx) (newCtx sdk.Context, result sdk.Result, abort bool)
AnteHandler authenticates transactions, before their internal messages are handled. If newCtx.IsZero(), ctx is used instead.
type CoinType ¶
type CoinType struct { Name string `json:"name"` MinUnit Unit `json:"min_unit"` Units Units `json:"units"` Origin Origin `json:"origin"` Desc string `json:"desc"` }
func NewDefaultCoinType ¶
func (CoinType) ConvertToMinCoin ¶
func (CoinType) GetMainUnit ¶
func (CoinType) GetMinUnit ¶
type FeeRefundHandler ¶
type Rat ¶
NOTE: never use new(Rat) or else we will panic unmarshalling into the nil embedded big.Rat
func (Rat) DecimalString ¶
type Unit ¶
func (Unit) GetPrecision ¶
Click to show internal directories.
Click to hide internal directories.