types

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeInvalidName        sdk.CodeType = 101
	CodeInvalidSymbol      sdk.CodeType = 102
	CodeSymbolNotAllowed   sdk.CodeType = 103
	CodeInvalidTotalSupply sdk.CodeType = 104
	CodeTokenExists        sdk.CodeType = 105
	CodeTokenNotExists     sdk.CodeType = 106
)
View Source
const (
	// module name
	ModuleName = "token"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey to be used in router
	RouterKey = ModuleName

	// QuerierRoute is the query router key
	QuerierRoute = ModuleName
)
View Source
const (
	QueryToken      = "token"
	QueryListTokens = "listTokens"
)
View Source
const DefaultCodespace sdk.CodespaceType = ModuleName

Variables

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

Functions

func ErrInvalidName

func ErrInvalidName(name string) sdk.Error

func ErrInvalidSymbol

func ErrInvalidSymbol(symbol string) sdk.Error

func ErrInvalidTotalSupply

func ErrInvalidTotalSupply(msg string) sdk.Error

func ErrSymbolNotAllowed

func ErrSymbolNotAllowed(symbol string) sdk.Error

func ErrTokenExists

func ErrTokenExists(symbol Symbol) sdk.Error

func ErrTokenNotExists

func ErrTokenNotExists(symbol Symbol) sdk.Error

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on Amino codec

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

Types

type BankKeeper

type BankKeeper interface {
	AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Error)
}

BankKeeper defines the expected bank Keeper

type GenesisState

type GenesisState struct {
	Tokens map[string]Token `json:"tokens"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

type GenesisTokenKey

type GenesisTokenKey struct {
	Symbol Symbol `json:"symbol"`
}

func (GenesisTokenKey) Marshal

func (k GenesisTokenKey) Marshal() string

func (*GenesisTokenKey) Unmarshal

func (k *GenesisTokenKey) Unmarshal(key string) error

type MsgIssueToken

type MsgIssueToken struct {
	Name         Name           `json:"name"`
	Symbol       ShortSymbol    `json:"symbol"`
	TotalSupply  sdk.Int        `json:"total_supply"`
	Mintable     bool           `json:"mintable"`
	OwnerAddress sdk.AccAddress `json:"owner_address"`
}

MsgIssueToken defines a IssueToken message.

func NewMsgIssueToken

func NewMsgIssueToken(name Name, symbol ShortSymbol, totalSupply sdk.Int, mintable bool, ownerAddress sdk.AccAddress) MsgIssueToken

NewMsgIssueToken is a constructor of MsgIssueToken.

func (MsgIssueToken) GetSignBytes

func (msg MsgIssueToken) GetSignBytes() []byte

GetSignBytes returns the canonical byte representation of the message. Used to generate a signature.

func (MsgIssueToken) GetSigners

func (msg MsgIssueToken) GetSigners() []sdk.AccAddress

GetSigners return the addresses of signers that must sign.

func (MsgIssueToken) Route

func (msg MsgIssueToken) Route() string

Route returns the name of the module.

func (MsgIssueToken) Type

func (msg MsgIssueToken) Type() string

Type returns the name of the action.

func (MsgIssueToken) ValidateBasic

func (msg MsgIssueToken) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message.

type Name

type Name string

type QueryTokenParams

type QueryTokenParams struct {
	Symbol Symbol
}

func NewQueryTokenParams

func NewQueryTokenParams(symbol Symbol) *QueryTokenParams

type ShortSymbol

type ShortSymbol string

type Symbol

type Symbol string

func (Symbol) MicroDenom

func (s Symbol) MicroDenom() string

func (Symbol) ToUpper

func (s Symbol) ToUpper() string

Symbol is case-insensitive. Although newSymbol converts all letters to uppercase, Symbol can contains lowercase letters if it's created by the simple Go type casting. So, when comparing Symbols to each other, they must be converted to uppercase first.

type Token

type Token struct {
	Name         Name           `json:"name"`
	Symbol       Symbol         `json:"symbol"`
	TotalSupply  sdk.Coin       `json:"total_supply"`
	Mintable     bool           `json:"mintable"`
	OwnerAddress sdk.AccAddress `json:"owner_address"`
}

func NewToken

func NewToken(msg MsgIssueToken, txHash string) Token

func (Token) Empty

func (t Token) Empty() bool

func (Token) String

func (t Token) String() string

type Tokens

type Tokens []string

func (Tokens) String

func (s Tokens) String() string

Jump to

Keyboard shortcuts

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