types

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCoinKey

func GenerateCoinKey() (addr types.Address, secret string, err error)

func InitBaseCoinGenStateJSON

func InitBaseCoinGenStateJSON(cdc *amino.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)

func InitBaseCoinGenTx

func InitBaseCoinGenTx(cdc *amino.Codec, pk crypto.PubKey, genTxConfig config.GenTx) (
	appGenTx, cliPrint json.RawMessage, validator tmtypes.GenesisValidator, err error)

Generate a genesis transaction

func InitBaseCoinInit

func InitBaseCoinInit() server.AppInit

func NewAppAccount

func NewAppAccount() account.Account

Types

type AppAccount

type AppAccount struct {
	account.BaseAccount `json:"base_account"`
	Coins               Coins `json:"coins"`
}

func (*AppAccount) GetCoins

func (acc *AppAccount) GetCoins() Coins

func (*AppAccount) SetCoins

func (acc *AppAccount) SetCoins(coins Coins) error

type BaseCoinGenTx

type BaseCoinGenTx struct {
	Addr types.Address `json:"addr"`
}

type Coin

type Coin struct {
	Name   string       `json:"name"`
	Amount types.BigInt `json:"amount"`
}

func NewCoin

func NewCoin(name string, amount types.BigInt) Coin

func (*Coin) GetAmount

func (coin *Coin) GetAmount() types.BigInt

func (*Coin) GetName

func (coin *Coin) GetName() string

func (Coin) IsEqual

func (coin Coin) IsEqual(other Coin) bool

IsEqual returns true if the two sets of Coins have the same value

func (Coin) IsGTE

func (coin Coin) IsGTE(other Coin) bool

IsGTE returns true if they are the same type and the receiver is an equal or greater value

func (Coin) IsLT

func (coin Coin) IsLT(other Coin) bool

IsLT returns true if they are the same type and the receiver is a smaller value

func (Coin) IsNotNegative

func (coin Coin) IsNotNegative() bool

IsNotNegative returns true if coin amount is not negative

func (Coin) IsPositive

func (coin Coin) IsPositive() bool

IsPositive returns true if coin amount is positive

func (Coin) IsZero

func (coin Coin) IsZero() bool

IsZero returns if this represents no money

func (Coin) Minus

func (coin Coin) Minus(coinB Coin) Coin

Subtracts amounts of two coins with same denom

func (Coin) Plus

func (coin Coin) Plus(coinB Coin) Coin

Adds amounts of two coins with same denom

func (Coin) SameNameAs

func (coin Coin) SameNameAs(other Coin) bool

SameDenomAs returns true if the two coins are the same denom

func (*Coin) SetAmount

func (coin *Coin) SetAmount(amount types.BigInt)

func (Coin) String

func (coin Coin) String() string

String provides a human-readable representation of a coin

type Coins

type Coins []Coin

Coins is a set of Coin, one per currency

func (Coins) AmountOf

func (coins Coins) AmountOf(denom string) types.BigInt

Returns the amount of a denom from coins

func (Coins) IsEqual

func (coins Coins) IsEqual(coinsB Coins) bool

IsEqual returns true if the two sets of Coins have the same value

func (Coins) IsGTE

func (coins Coins) IsGTE(coinsB Coins) bool

IsGTE returns True iff coins is NonNegative(), and for every currency in coinsB, the currency is present at an equal or greater amount in coinsB

func (Coins) IsLT

func (coins Coins) IsLT(coinsB Coins) bool

IsLT returns True iff every currency in coins, the currency is present at a smaller amount in coins

func (Coins) IsNotNegative

func (coins Coins) IsNotNegative() bool

IsNotNegative returns true if there is no currency with a negative value (even no coins is true here)

func (Coins) IsPositive

func (coins Coins) IsPositive() bool

IsPositive returns true if there is at least one coin, and all currencies have a positive value

func (Coins) IsValid

func (coins Coins) IsValid() bool

IsValid asserts the Coins are sorted, and don't have 0 amounts

func (Coins) IsZero

func (coins Coins) IsZero() bool

IsZero returns true if there are no coins or all coins are zero.

func (Coins) Minus

func (coins Coins) Minus(coinsB Coins) Coins

Minus subtracts a set of coins from another (adds the inverse)

func (Coins) MinusSingle

func (coins Coins) MinusSingle(coin Coin) Coins

func (Coins) Negative

func (coins Coins) Negative() Coins

Negative returns a set of coins with all amount negative

func (Coins) Plus

func (coins Coins) Plus(coinsB Coins) Coins

Plus combines two sets of coins CONTRACT: Plus will never return Coins where one Coin has a 0 amount.

func (Coins) PlusSingle

func (coins Coins) PlusSingle(coin Coin) Coins

func (Coins) String

func (coins Coins) String() string

type GenesisAccount

type GenesisAccount struct {
	Address types.Address `json:"address"`
	Coins   Coins         `json:"coins"`
}

初始账户

func NewGenesisAccount

func NewGenesisAccount(aa *AppAccount) *GenesisAccount

给定 AppAccpunt 创建 GenesisAccount

func (*GenesisAccount) ToAppAccount

func (ga *GenesisAccount) ToAppAccount() (acc *AppAccount, err error)

给定 GenesisAccount 创建 AppAccpunt

type GenesisState

type GenesisState struct {
	CAPubKey crypto.PubKey     `json:"ca_pub_key"`
	Accounts []*GenesisAccount `json:"accounts"`
}

QOS初始状态

Jump to

Keyboard shortcuts

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