types

package
v0.0.2-0...-13a971e Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCodespace codespace for the module
	DefaultCodespace sdk.CodespaceType = ModuleName

	// CodeEmptyInput error code for empty input errors
	CodeNoPOA sdk.CodeType = 1

	CodeTokenSymbolDoesNotExist sdk.CodeType = 101
)
View Source
const (
	ModuleName = "denominations"

	QuerierRoute = ModuleName

	ModuleNominees = "nominees"
	// StoreKey Top level store key where all module items will be stored
	StoreKey = ModuleName

	// RouterKey Top level router key
	RouterKey = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName
)

Variables

View Source
var (
	KeyNominees = []byte(ModuleNominees)
)

Parameter keys

View Source
var ModuleCdc *codec.Codec

generic sealed codec to be used throughout this module

Functions

func AreAnyCoinsZero

func AreAnyCoinsZero(coins *sdk.Coins) bool

func ErrNoPOA

func ErrNoPOA(codespace sdk.CodespaceType) sdk.Error

ErrEmptyInput Error constructor

func ErrTokenSymbolDoesNotExist

func ErrTokenSymbolDoesNotExist(codespace sdk.CodespaceType) sdk.Error

func ParamKeyTable

func ParamKeyTable() subspace.KeyTable

ParamKeyTable Key declaration for parameters

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

Types

type CustomCoinAccount

type CustomCoinAccount interface {
	exported.Account
	Freezer
}

CustomCoinAccount extends the built in account interface with extra abilities such as frozen coins

type FreezeAccount

type FreezeAccount struct {
	*authtypes.BaseAccount
	FrozenCoins sdk.Coins `json:"frozen" yaml:"frozen"`
}

FreezeAccount is customised to allow temporary freezing of coins to exclude them from transactions

func NewFreezeAccount

func NewFreezeAccount(ba *authtypes.BaseAccount, frozenCoins sdk.Coins) *FreezeAccount

func (*FreezeAccount) FreezeCoins

func (acc *FreezeAccount) FreezeCoins(coinsToFreeze sdk.Coins) error

FreezeCoins freezes unfrozen coins for account according to input

func (FreezeAccount) GetFrozenCoins

func (acc FreezeAccount) GetFrozenCoins() sdk.Coins

GetFrozenCoins retrieves frozen coins from account

func (FreezeAccount) MarshalJSON

func (acc FreezeAccount) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON representation of a ModuleAccount.

func (FreezeAccount) MarshalYAML

func (acc FreezeAccount) MarshalYAML() (interface{}, error)

MarshalYAML returns the YAML representation of a ModuleAccount.

func (*FreezeAccount) SetFrozenCoins

func (acc *FreezeAccount) SetFrozenCoins(frozen sdk.Coins) error

SetFrozenCoins sets frozen coins for account

func (FreezeAccount) String

func (acc FreezeAccount) String() string

func (*FreezeAccount) UnfreezeCoins

func (acc *FreezeAccount) UnfreezeCoins(coinsToUnfreeze sdk.Coins) error

UnfreezeCoins unfreezes frozen coins for account according to input

func (*FreezeAccount) UnmarshalJSON

func (acc *FreezeAccount) UnmarshalJSON(bz []byte) error

UnmarshalJSON unmarshals raw JSON bytes into a ModuleAccount.

func (FreezeAccount) Validate

func (acc FreezeAccount) Validate() error

Validate checks for errors on the account fields

type Freezer

type Freezer interface {
	// Get just the frozen coins
	GetFrozenCoins() sdk.Coins
	SetFrozenCoins(sdk.Coins) error

	// Freeze coins by a certain amount. It will reduce amount of coins available from GetCoins()
	FreezeCoins(sdk.Coins) error
	// Unfreeze coins by a certain amount. It will increase the amount of coins available from GetCoins()
	UnfreezeCoins(sdk.Coins) error
}

Freezer allows setting and getting frozen coins

type MsgBurnCoins

type MsgBurnCoins struct {
	Amount sdk.Int        `json:"amount" yaml:"amount"`
	Symbol string         `json:"symbol" yaml:"symbol"`
	Owner  sdk.AccAddress `json:"owner" yaml:"owner"`
}

MsgBurnCoins defines the BurnCoins message

func NewMsgBurnCoins

func NewMsgBurnCoins(amount sdk.Int, symbol string, owner sdk.AccAddress) MsgBurnCoins

NewMsgBurnCoins is the constructor function for MsgBurnCoins

func (MsgBurnCoins) GetSignBytes

func (msg MsgBurnCoins) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgBurnCoins) GetSigners

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

GetSigners defines whose signature is required

func (MsgBurnCoins) Route

func (msg MsgBurnCoins) Route() string

Route should return the name of the module

func (MsgBurnCoins) Type

func (msg MsgBurnCoins) Type() string

Type should return the action

func (MsgBurnCoins) ValidateBasic

func (msg MsgBurnCoins) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgFreezeCoins

type MsgFreezeCoins struct {
	Amount  sdk.Int        `json:"amount" yaml:"amount"`
	Symbol  string         `json:"symbol" yaml:"symbol"`
	Owner   sdk.AccAddress `json:"owner" yaml:"owner"`
	Address sdk.AccAddress `json:"address" yaml:"address"`
}

MsgFreezeCoins defines the FreezeCoins message

func NewMsgFreezeCoins

func NewMsgFreezeCoins(amount sdk.Int, symbol string, owner sdk.AccAddress, address sdk.AccAddress) MsgFreezeCoins

NewMsgFreezeCoins is the constructor function for MsgFreezeCoins

func (MsgFreezeCoins) GetSignBytes

func (msg MsgFreezeCoins) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgFreezeCoins) GetSigners

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

GetSigners defines whose signature is required

func (MsgFreezeCoins) Route

func (msg MsgFreezeCoins) Route() string

Route should return the name of the module

func (MsgFreezeCoins) Type

func (msg MsgFreezeCoins) Type() string

Type should return the action

func (MsgFreezeCoins) ValidateBasic

func (msg MsgFreezeCoins) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgIssueToken

type MsgIssueToken struct {
	SourceAddress  sdk.AccAddress `json:"source_address" yaml:"source_address"`
	Owner          sdk.AccAddress `json:"owner" yaml:"owner"`
	Name           string         `json:"name" yaml:"name"`
	Symbol         string         `json:"symbol" yaml:"symbol"`
	OriginalSymbol string         `json:"original_symbol" yaml:"original_symbol"`
	MaxSupply      sdk.Int        `json:"max_supply" yaml:"max_supply"`
	Mintable       bool           `json:"mintable" yaml:"mintable"`
}

MsgIssueToken defines a IssueToken message

func NewMsgIssueToken

func NewMsgIssueToken(sourceAddress, owner sdk.AccAddress, name, symbol string, originalSymbol string, maxSupply sdk.Int, mintable bool) MsgIssueToken

NewMsgIssueToken is a constructor function for MsgIssueToken

func (MsgIssueToken) GetSignBytes

func (msg MsgIssueToken) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgIssueToken) GetSigners

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

GetSigners defines whose signature is required

func (MsgIssueToken) Route

func (msg MsgIssueToken) Route() string

Route should return the name of the module

func (MsgIssueToken) Type

func (msg MsgIssueToken) Type() string

Type should return the action

func (MsgIssueToken) ValidateBasic

func (msg MsgIssueToken) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgMintCoins

type MsgMintCoins struct {
	Amount sdk.Int        `json:"amount" yaml:"amount"`
	Symbol string         `json:"symbol" yaml:"symbol"`
	Owner  sdk.AccAddress `json:"owner" yaml:"owner"`
}

MsgMintCoins defines the MintCoins message

func NewMsgMintCoins

func NewMsgMintCoins(amount sdk.Int, symbol string, owner sdk.AccAddress) MsgMintCoins

NewMsgMintCoins is the constructor function for MsgMintCoins

func (MsgMintCoins) GetSignBytes

func (msg MsgMintCoins) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgMintCoins) GetSigners

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

GetSigners defines whose signature is required

func (MsgMintCoins) Route

func (msg MsgMintCoins) Route() string

Route should return the name of the module

func (MsgMintCoins) Type

func (msg MsgMintCoins) Type() string

Type should return the action

func (MsgMintCoins) ValidateBasic

func (msg MsgMintCoins) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type MsgUnfreezeCoins

type MsgUnfreezeCoins struct {
	Amount  sdk.Int        `json:"amount" yaml:"amount"`
	Symbol  string         `json:"symbol" yaml:"symbol"`
	Owner   sdk.AccAddress `json:"owner" yaml:"owner"`
	Address sdk.AccAddress `json:"address" yaml:"address"`
}

MsgUnfreezeCoins defines the UnfreezeCoins message

func NewMsgUnfreezeCoins

func NewMsgUnfreezeCoins(amount sdk.Int, symbol string, owner sdk.AccAddress, address sdk.AccAddress) MsgUnfreezeCoins

NewMsgUnfreezeCoins is the constructor function for MsgUnfreezeCoins

func (MsgUnfreezeCoins) GetSignBytes

func (msg MsgUnfreezeCoins) GetSignBytes() []byte

GetSignBytes encodes the message for signing

func (MsgUnfreezeCoins) GetSigners

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

GetSigners defines whose signature is required

func (MsgUnfreezeCoins) Route

func (msg MsgUnfreezeCoins) Route() string

Route should return the name of the module

func (MsgUnfreezeCoins) Type

func (msg MsgUnfreezeCoins) Type() string

Type should return the action

func (MsgUnfreezeCoins) ValidateBasic

func (msg MsgUnfreezeCoins) ValidateBasic() sdk.Error

ValidateBasic runs stateless checks on the message

type ParamSubspace

type ParamSubspace interface {
	Get(ctx sdk.Context, key []byte, ptr interface{})
	Set(ctx sdk.Context, key []byte, param interface{})
}

ParamSubspace defines the expected Subspace interface for parameters

type Params

type Params struct {
	Nominees []string
}

func DefaultParams

func DefaultParams() Params

DefaultParams default params

func NewParams

func NewParams(nominees []string) Params

NewParams creates a new Params object

func (*Params) ParamSetPairs

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

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of auth module's parameters. nolint

func (Params) String

func (p Params) String() string

String implements fmt.stringer

func (Params) Validate

func (p Params) Validate() error

Validate ensure that params have valid values

type QueryResultSymbol

type QueryResultSymbol []string

QueryResultSymbol is a payload for a symbols query

func (QueryResultSymbol) String

func (r QueryResultSymbol) String() string

String implements fmt.Stringer

type Token

type Token struct {
	Owner          sdk.AccAddress `json:"owner"`
	Name           string         `json:"name"`            // token name eg Fantom Chain Token
	Symbol         string         `json:"symbol"`          // unique token trade symbol eg FTM-000
	OriginalSymbol string         `json:"original_symbol"` // token symbol eg FTM
	MaxSupply      sdk.Int        `json:"max_supply"`      // Maximum mintable supply
	Mintable       bool           `json:"mintable"`
}

Token is a struct that contains all the metadata of the asset

func NewToken

func NewToken(name, symbol, originalSymbol string, maxSupply sdk.Int, owner sdk.AccAddress, mintable bool) *Token

NewToken returns a new token

func (Token) String

func (t Token) String() string

String implements fmt.Stringer

func (Token) ValidateBasic

func (t Token) ValidateBasic() sdk.Error

ValidateBasic does a simple validation check that doesn't require access to any other information.

Jump to

Keyboard shortcuts

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