types

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Currency type implementation.

Default types for currency module implementation.

Implements destroy type for currencies module.

Implements errors codes and functions for currencies module.

Issue type implementation for currencies.

Querier.

Index

Constants

View Source
const (
	ModuleName                         = "currencies"
	Router                             = ModuleName
	RouterKey                          = ModuleName
	DefaultCodespace sdk.CodespaceType = ModuleName
)
View Source
const (
	CodeErrWrongSymbol       = 101
	CodeErrWrongAmount       = 102
	CodeErrWrongDecimals     = 103
	CodeErrWrongIssueID      = 104
	CodeErrIncorrectDecimals = 105
	CodeErrExistsIssue       = 106
	CodeErrNotExistCurrency  = 107
	CodeErrWrongRecipient    = 108
)

Variables

View Source
var (
	KeyDelimiter = []byte(":")
	DestroyQueue = []byte("destroy")
)

Functions

func ErrExistsIssue

func ErrExistsIssue(issueID string) sdk.Error

IssueID already exists in store

func ErrIncorrectDecimals

func ErrIncorrectDecimals(d1, d2 int8, symbol string) sdk.Error

Currency.Decimals != decimals in request

func ErrNotExistCurrency

func ErrNotExistCurrency(symbol string) sdk.Error

Currency.Symbol != requested symbol

func ErrWrongAmount

func ErrWrongAmount(amount string) sdk.Error

Msg.Amount is zero

func ErrWrongDecimals

func ErrWrongDecimals(decimals int8) sdk.Error

Msg.Decimals < 0

func ErrWrongIssueID

func ErrWrongIssueID(issueID string) sdk.Error

Issue.Recipient is empty / Msg.IssueID is empty

func ErrWrongRecipient

func ErrWrongRecipient() sdk.Error

Msg.Recipient is empty

func ErrWrongSymbol

func ErrWrongSymbol(symbol string) sdk.Error

Msg.Symbol is empty

func GetCurrencyKey

func GetCurrencyKey(symbol string) []byte

Key for storing currency

func GetDestroyKey

func GetDestroyKey(id sdk.Int) []byte

Get destroy key

func GetIssuesKey

func GetIssuesKey(issueID string) []byte

Key for issues

func GetLastIDKey

func GetLastIDKey() []byte

Get last ID key

Types

type Currency

type Currency struct {
	CurrencyId sdk.Int `json:"currencyId" swaggertype:"string"`
	Symbol     string  `json:"symbol" example:"dfi"`                      // Denom
	Supply     sdk.Int `json:"supply" swaggertype:"string" example:"100"` // Total amount
	Decimals   int8    `json:"decimals" example:"0"`
}

func NewCurrency

func NewCurrency(symbol string, supply sdk.Int, decimals int8) Currency

New currency

func (Currency) String

func (c Currency) String() string

type CurrencyReq

type CurrencyReq struct {
	Symbol string
}

Request to get currency by id.

type Destroy

type Destroy struct {
	ID        types.Int        `json:"id" swaggertype:"string" example:"0"` // CallID
	ChainID   string           `json:"chainID" example:"testnet"`
	Symbol    string           `json:"symbol" example:"dfi"`
	Amount    types.Int        `json:"amount" swaggertype:"string" example:"100"`
	Spender   types.AccAddress `json:"spender" swaggertype:"string" format:"bech32" example:"wallet13jyjuz3kkdvqw8u4qfkwd94emdl3vx394kn07h"`
	Recipient string           `json:"recipient" format:"bech32" example:"wallet13jyjuz3kkdvqw8u4qfkwd94emdl3vx394kn07h"`
	Timestamp int64            `json:"timestamp" format:"seconds" example:"1585295757"` // UNIX time
	TxHash    string           `json:"tx_hash" example:"fd82ce32835dfd7042808eaf6ff09cece952b9da20460fa462420a93607fa96f"`
}

swagger:model

func NewDestroy

func NewDestroy(id types.Int, chainID string, symbol string, amount types.Int, spender types.AccAddress, recipient string, txBytes []byte, timestamp int64) Destroy

func (Destroy) String

func (destroy Destroy) String() string

type DestroyReq

type DestroyReq struct {
	DestroyId sdk.Int
}

Request to get destroy by destroy id.

type Destroys

type Destroys []Destroy

func (Destroys) String

func (destroys Destroys) String() string

type DestroysReq

type DestroysReq struct {
	Page  sdk.Int
	Limit sdk.Int
}

Request to print destroys

type Issue

type Issue struct {
	Symbol    string         `json:"symbol" example:"dfi"` // Denom
	Amount    sdk.Int        `json:"amount" swaggertype:"string" example:"100"`
	Recipient sdk.AccAddress `json:"recipient" swaggertype:"string" format:"bech32" example:"wallet13jyjuz3kkdvqw8u4qfkwd94emdl3vx394kn07h"`
}

func NewIssue

func NewIssue(symbol string, amount sdk.Int, recipient sdk.AccAddress) Issue

func (Issue) String

func (issue Issue) String() string

type IssueReq

type IssueReq struct {
	IssueID string
}

Request to get issue by id.

Jump to

Keyboard shortcuts

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