types

package
v0.0.0-...-3c679d0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	// module name
	ModuleName = "asset"

	// StoreKey is the store key string for asset
	StoreKey = ModuleName

	// RouterKey is the message route for asset
	RouterKey = ModuleName

	// QuerierRoute is the querier route for asset
	QuerierRoute = ModuleName
)
View Source
const (
	//todo refactor name
	IssueMsgType = "issueMsg"
	MintMsgType  = "mintMsg"

	MaxTokenNameLength           = 32
	MaxTokenSymbolLength         = 12
	MinTokenSymbolLength         = 3
	MaxTokenDesLenLimit          = 128
	NewMaxTokenDesLenLimit       = 1024
	MaxTotalSupply         int64 = 9000000000000000000 // int64 max value: 9,223,372,036,854,775,807
)
View Source
const (
	DefaultQueryLimit = 100
	QueryParams       = "params"
	GetToken          = "get"
	ListToken         = "list"
)

querier keys

Variables

View Source
var (
	EventTypeIssueToken = "issue_token"
	EventTypeMintToken  = "mint_token"

	AttributeValueCategory = ModuleName
)

Asset module event types

View Source
var (
	TokenKeyPrefix = []byte{0x01}

	ParamStoreKeyMaxDecimal = []byte("MaxDecimal")
)
View Source
var (
	ParamKeyMaxDecimal = []byte("paramMaxDecimal")
	ParamKeyIssueFee   = []byte("paramIssueFee")
	ParamKeyMintFee    = []byte("paramMintFee")
)
View Source
var ModuleCdc *codec.Codec

module codec

Functions

func BuildTokenKey

func BuildTokenKey(symbol string) []byte

func ErrInvalidDecimal

func ErrInvalidDecimal(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidMintAmount

func ErrInvalidMintAmount(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidTokenDescription

func ErrInvalidTokenDescription(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidTokenSymbol

func ErrInvalidTokenSymbol(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrInvalidTotalSupply

func ErrInvalidTotalSupply(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrNoInvalidTokenName

func ErrNoInvalidTokenName(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrNotMintableToken

func ErrNotMintableToken(codespace sdk.CodespaceType, msg string) sdk.Error

func ErrUnauthorizedMint

func ErrUnauthorizedMint(codespace sdk.CodespaceType, msg string) sdk.Error

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func ValidateToken

func ValidateToken(token *Token) error

Types

type CodeType

type CodeType = sdk.CodeType

Local code type

const (
	// Default asset codespace
	DefaultCodespace sdk.CodespaceType = ModuleName

	CodeInvalidTokenName        CodeType = 101
	CodeInvalidTokenSymbol      CodeType = 102
	CodeInvalidTotalSupply      CodeType = 103
	CodeInvalidDecimal          CodeType = 104
	CodeInvalidMintAmount       CodeType = 105
	CodeInvalidTokenDescription CodeType = 106
	CodeNotMintableToken        CodeType = 107
	CodeUnauthorizedMint        CodeType = 108
)

type IssueMsg

type IssueMsg struct {
	From        sdk.AccAddress `json:"from"`
	Name        string         `json:"name"`
	Symbol      string         `json:"symbol"`
	TotalSupply int64          `json:"total_supply"`
	Mintable    bool           `json:"mintable"`
	Decimal     int8           `json:"decimal"`
	Description string         `json:"description"`
}

func NewIssueMsg

func NewIssueMsg(from sdk.AccAddress, name, symbol string, supply int64, mintable bool, decimal int8, description string) IssueMsg

func (IssueMsg) GetSignBytes

func (msg IssueMsg) GetSignBytes() []byte

func (IssueMsg) GetSigners

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

func (IssueMsg) Route

func (msg IssueMsg) Route() string

func (IssueMsg) Type

func (msg IssueMsg) Type() string

func (IssueMsg) ValidateBasic

func (msg IssueMsg) ValidateBasic() sdk.Error

type MintMsg

type MintMsg struct {
	From   sdk.AccAddress `json:"from"`
	Symbol string         `json:"symbol"`
	Amount int64          `json:"amount"`
}

func NewMintMsg

func NewMintMsg(from sdk.AccAddress, symbol string, amount int64) MintMsg

func (MintMsg) GetSignBytes

func (msg MintMsg) GetSignBytes() []byte

func (MintMsg) GetSigners

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

func (MintMsg) Route

func (msg MintMsg) Route() string

func (MintMsg) Type

func (msg MintMsg) Type() string

func (MintMsg) ValidateBasic

func (msg MintMsg) ValidateBasic() sdk.Error

type Params

type Params struct {
	MaxDecimal int8      `json:"param_max_decimal"`
	IssueFee   sdk.Coins `json:"param_issue_fee"`
	MintFee    sdk.Coins `json:"param_mint_fee"`
}

issue new assets parameters

func DefaultParams

func DefaultParams() *Params

func NewParams

func NewParams(decimal int8, issueFee, mintFee sdk.Coins) *Params

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

Implements params.ParamSet

func (Params) String

func (params Params) String() string

func (Params) Validate

func (p Params) Validate() error

validate a set of params

type QueryTokensParams

type QueryTokensParams struct {
	Page, Limit int
}

QueryTokensParams defines the params for the following queries: - 'custom/asset/list'

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAddress(moduleName string) sdk.AccAddress
	GetModuleAccountAndPermissions(ctx sdk.Context, moduleName string) (supplyexported.ModuleAccountI, []string)
	GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI
	SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI)
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) sdk.Error
}

SupplyKeeper defines the expected supply keeper

type Token

type Token struct {
	Symbol      string         `json:"symbol"`
	Name        string         `json:"name"`
	Decimal     int8           `json:"decimals"`
	TotalSupply int64          `json:"total_supply"`
	Mintable    bool           `json:"mintable"`
	Description string         `json:"description"`
	Owner       sdk.AccAddress `json:"owner"`
}

func NewToken

func NewToken(symbol, name string, decimal int8, totalSupply int64,
	mintable bool, description string, owner sdk.AccAddress) *Token

func (*Token) String

func (token *Token) String() string

type TokenList

type TokenList []*Token

func (TokenList) String

func (tokenList TokenList) String() (out string)

Jump to

Keyboard shortcuts

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