types

package
v0.0.0-...-aa2a1f9 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

nolint noalias

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = ModuleName

	CodeTokenSymbolDoesNotExist sdk.CodeType = 101
)
View Source
const (
	// module name
	ModuleName = "assetmanagement"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName
)
View Source
const RouterKey = ModuleName // this was defined in your key.go file

Variables

View Source
var ModuleCdc = codec.New()

Functions

func AreAnyCoinsZero

func AreAnyCoinsZero(coins *sdk.Coins) bool

func ErrTokenSymbolDoesNotExist

func ErrTokenSymbolDoesNotExist(codespace sdk.CodespaceType) sdk.Error

func KeyTestPubAddr

func KeyTestPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress)

func NewTestCoins

func NewTestCoins(symbol string, amount int64) sdk.Coins

coins to more than cover the fee

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type CustomAccount

type CustomAccount struct {
	*auth.BaseAccount
	FrozenCoins sdk.Coins `json:"coins" yaml:"coins"`
}

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

func NewCustomAccount

func NewCustomAccount(address sdk.AccAddress, coins sdk.Coins, frozenCoins sdk.Coins,
	pubKey crypto.PubKey, accountNumber uint64, sequence uint64) *CustomAccount

func (*CustomAccount) FreezeCoins

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

FreezeCoins freezes unfrozen coins for account according to input

func (*CustomAccount) GetFrozenCoins

func (acc *CustomAccount) GetFrozenCoins() sdk.Coins

GetFrozenCoins retrieves frozen coins from account

func (*CustomAccount) SetFrozenCoins

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

SetFrozenCoins sets frozen coins for account

func (CustomAccount) String

func (acc CustomAccount) String() string

String implements fmt.Stringer

func (*CustomAccount) UnfreezeCoins

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

UnfreezeCoins unfreezes frozen coins for account according to input

type CustomCoinAccount

type CustomCoinAccount interface {
	auth.Account
	Freezer
}

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

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 int64          `json:"amount"`
	Symbol string         `json:"symbol"`
	Owner  sdk.AccAddress `json:"owner"`
}

MsgBurnCoins defines the BurnCoins message

func NewMsgBurnCoins

func NewMsgBurnCoins(amount int64, 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 int64          `json:"amount"`
	Symbol string         `json:"symbol"`
	Owner  sdk.AccAddress `json:"owner"`
}

MsgFreezeCoins defines the FreezeCoins message

func NewMsgFreezeCoins

func NewMsgFreezeCoins(amount int64, symbol string, owner 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"`
	Name           string         `json:"name"`
	Symbol         string         `json:"symbol"`
	OriginalSymbol string         `json:"original_symbol"`
	TotalSupply    int64          `json:"total_supply"`
	Mintable       bool           `json:"mintable"`
}

MsgIssueToken defines a IssueToken message

func NewMsgIssueToken

func NewMsgIssueToken(sourceAddress sdk.AccAddress, name, symbol string, originalSymbol string,
	totalSupply int64, 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 int64          `json:"amount"`
	Symbol string         `json:"symbol"`
	Owner  sdk.AccAddress `json:"owner"`
}

MsgMintCoins defines the MintCoins message

func NewMsgMintCoins

func NewMsgMintCoins(amount int64, 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 int64          `json:"amount"`
	Symbol string         `json:"symbol"`
	Owner  sdk.AccAddress `json:"owner"`
}

MsgUnfreezeCoins defines the UnfreezeCoins message

func NewMsgUnfreezeCoins

func NewMsgUnfreezeCoins(amount int64, symbol string, owner 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 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
	TotalSupply    sdk.Coins      `json:"total_supply"`    // Total token 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, totalSupply int64, owner sdk.AccAddress, mintable bool) *Token

NewToken returns a new token

func (Token) String

func (t Token) String() string

String implements fmt.Stringer

Jump to

Keyboard shortcuts

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