types

package
v0.9.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultCodespace sdk.CodespaceType = ModuleName

	CodeInvalidSwapAmount       sdk.CodeType = 2100
	CodeInvalidInitialIssuePool sdk.CodeType = 2101
	CodeInvalidIssuePool        sdk.CodeType = 2102
	CodeMappingNotFound         sdk.CodeType = 2103
	CodeUnmatchedDecimals       sdk.CodeType = 2104
	CodeMappingDisabled         sdk.CodeType = 2105
	CodeDuplicatedIssueSymbol   sdk.CodeType = 2106
	CodeTargetSymbolUsedAsIssue sdk.CodeType = 2107
	CodeIssueSymbolUsedAsTarget sdk.CodeType = 2108
	CodeUnmatchedTotalSupply    sdk.CodeType = 2109
)
View Source
const (
	EventTypeExecuteAddMappingProposal    = "execute_add_mapping_proposal"
	EventTypeExecuteSwitchMappingProposal = "execute_switch_mapping_proposal"
	EventTypeCreateFreeSwap               = "create_free_swap"
	EventTypeCreateDirectSwap             = "create_direct_swap"
	EventTypeCancelSwap                   = "cancel_swap"
	EventTypeSwapSymbol                   = "swap_symbol"

	AttributeKeyFrom        = "from"
	AttributeKeyIssueToken  = "issue_token"
	AttributeKeyTargetToken = "target_token"
	AttributeKeyTotalSupply = "total_supply"
	AttributeKeyEnable      = "enable"
	AttributeKeyOrderID     = "order_id"
	AttributeKeyAmount      = "amount"
	AttributeKeySwapType    = "swap_type"
)
View Source
const (
	//module name
	ModuleName = "mapping"

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

	// QuerierRoute is the querier route for gov
	QuerierRoute = ModuleName

	// Parameter store default parameter store
	DefaultParamspace = ModuleName
)
View Source
const (
	TypeMsgMappingSwap      = "mapping_swap"
	TypeMsgCreateFreeSwap   = "free_swap"
	TypeMsgCreateDirectSwap = "direct_swap"
	TypeMsgSwapSymbol       = "swap_symbol"
	TypeMsgCancelSwap       = "cancel_swap"
)
View Source
const (
	ProposalTypeAddMapping    = "AddMapping"
	ProposalTypeSwitchMapping = "SwitchMapping"
)
View Source
const (
	QueryInfo           = "info"
	QueryList           = "list"
	QueryFreeSwapInfo   = "freeswapinfo"
	QueryDirectSwapInfo = "directswapinfo"
	QueryFreeSwapList   = "freeswaplist"
	QueryDirectSwapList = "directswaplist"
)

query endpoints supported by the mapping module

View Source
const (
	SwapTypeFree   = 0x0
	SwapTypeDirect = 0x1
)
View Source
const RouterKey = ModuleName // this was defined in key.go file

Variables

View Source
var (
	DefaultNewMappingFee = sdk.NewInt(10)
)
View Source
var (
	KeyNewMappingFee = []byte("NewMappingFee")
)
View Source
var ModuleCdc = codec.New()

Functions

func ErrDuplicatedIssueSymbol

func ErrDuplicatedIssueSymbol(codespace sdk.CodespaceType, format string) sdk.Error

func ErrInvalidInitialIssuePool

func ErrInvalidInitialIssuePool(codespace sdk.CodespaceType, format string) sdk.Error

func ErrInvalidIssuePool

func ErrInvalidIssuePool(codespace sdk.CodespaceType, format string) sdk.Error

func ErrInvalidSwapAmount

func ErrInvalidSwapAmount(codespace sdk.CodespaceType, format string) sdk.Error

func ErrIssueSymbolUsedAsTarget

func ErrIssueSymbolUsedAsTarget(codespace sdk.CodespaceType, format string) sdk.Error

func ErrMappingDisabled

func ErrMappingDisabled(codespace sdk.CodespaceType, format string) sdk.Error

func ErrMappingNotFound

func ErrMappingNotFound(codespace sdk.CodespaceType, format string) sdk.Error

func ErrTargetSymbolUsedAsIssue

func ErrTargetSymbolUsedAsIssue(codespace sdk.CodespaceType, format string) sdk.Error

func ErrUnmatchedDecimals

func ErrUnmatchedDecimals(codespace sdk.CodespaceType, format string) sdk.Error

func ErrUnmatchedTotalSupply

func ErrUnmatchedTotalSupply(codespace sdk.CodespaceType, format string) sdk.Error

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type AddMappingProposal

type AddMappingProposal struct {
	From         sdk.CUAddress `json:"from"`
	Title        string        `json:"title"`
	Description  string        `json:"description"`
	IssueSymbol  sdk.Symbol    `json:"issue_symbol"`
	TargetSymbol sdk.Symbol    `json:"target_symbol"`
	TotalSupply  sdk.Int       `json:"total_supply"`
}

func NewAddMappingProposal

func NewAddMappingProposal(from sdk.CUAddress, title, desc string, issueSymbol, targetSymbol sdk.Symbol, totalSupply sdk.Int) AddMappingProposal

func (AddMappingProposal) GetDescription

func (amp AddMappingProposal) GetDescription() string

func (AddMappingProposal) GetTitle

func (amp AddMappingProposal) GetTitle() string

func (AddMappingProposal) ProposalRoute

func (amp AddMappingProposal) ProposalRoute() string

func (AddMappingProposal) ProposalToken

func (amp AddMappingProposal) ProposalToken() string

func (AddMappingProposal) ProposalType

func (amp AddMappingProposal) ProposalType() string

func (AddMappingProposal) String

func (amp AddMappingProposal) String() string

String implements the Stringer interface.

func (AddMappingProposal) ValidateBasic

func (amp AddMappingProposal) ValidateBasic() sdk.Error

type DirectSwapInfo

type DirectSwapInfo struct {
	SrcSymbol    sdk.Symbol `json:"src_symbol"`
	TargetSymbol sdk.Symbol `json:"target_symbol"`
	Amount       sdk.Int    `json:"amount"`
	SwapAmount   sdk.Int    `json:"swap_amount"`
	ExpiredTime  int64      `json:"expired_time"`
	ReceiveAddr  string     `json:"receieve_addr"`
	Desc         string     `json:"desc"`
}

func (DirectSwapInfo) String

func (s DirectSwapInfo) String() string

type DirectSwapOrder

type DirectSwapOrder struct {
	OrderId  string         `json:"order_id"`
	Owner    sdk.CUAddress  `json:"owner"`
	SwapInfo DirectSwapInfo `json:"swap_info"`
}

func (DirectSwapOrder) String

func (o DirectSwapOrder) String() string

type FreeSwapInfo

type FreeSwapInfo struct {
	SrcSymbol     sdk.Symbol `json:"src_symbol"`
	TargetSymbol  sdk.Symbol `json:"target_symbol"`
	TotalAmount   sdk.Int    `json:"total_amount"`
	MaxSwapAmount sdk.Int    `json:"max_swap_amount"`
	MinSwapAmount sdk.Int    `json:"min_swap_amount"`
	SwapPrice     sdk.Int    `json:"swap_price"`
	ExpiredTime   int64      `json:"expired_time"`
	Desc          string     `json:"desc"`
}

func (FreeSwapInfo) String

func (s FreeSwapInfo) String() string

type FreeSwapOrder

type FreeSwapOrder struct {
	OrderId      string        `json:"order_id"`
	Owner        sdk.CUAddress `json:"owner"`
	SwapInfo     FreeSwapInfo  `json:"swap_info"`
	RemainAmount sdk.Int       `json:"remain_amount"`
}

func (FreeSwapOrder) String

func (o FreeSwapOrder) String() string

type MappingInfo

type MappingInfo struct {
	IssueSymbol  sdk.Symbol `json:"issue_symbol"`
	TargetSymbol sdk.Symbol `json:"target_symbol"`
	TotalSupply  sdk.Int    `json:"total_supply"`
	IssuePool    sdk.Int    `json:"issue_pool"`
	Enabled      bool       `json:"enabled"`
}

MappingInfo struct for mapping

func (MappingInfo) String

func (m MappingInfo) String() string

type MsgCancelSwap

type MsgCancelSwap struct {
	From     string `json:"from"`
	SwapType int    `json:"swap_type"`
	OrderID  string `json:"order_id"`
}

func NewMsgCancelSwap

func NewMsgCancelSwap(from string, orderid string, swapType int) MsgCancelSwap

func (MsgCancelSwap) GetSignBytes

func (msg MsgCancelSwap) GetSignBytes() []byte

func (MsgCancelSwap) GetSigners

func (msg MsgCancelSwap) GetSigners() []sdk.CUAddress

func (MsgCancelSwap) Route

func (msg MsgCancelSwap) Route() string

func (MsgCancelSwap) Type

func (msg MsgCancelSwap) Type() string

func (MsgCancelSwap) ValidateBasic

func (msg MsgCancelSwap) ValidateBasic() sdk.Error

type MsgCreateDirectSwap

type MsgCreateDirectSwap struct {
	From     string         `json:"from"`
	OrderID  string         `json:"order_id"`
	SwapInfo DirectSwapInfo `json:"swap_info"`
}

func NewMsgCreateDirectSwap

func NewMsgCreateDirectSwap(from string, orderid string, swapInfo DirectSwapInfo) MsgCreateDirectSwap

func (MsgCreateDirectSwap) GetSignBytes

func (msg MsgCreateDirectSwap) GetSignBytes() []byte

func (MsgCreateDirectSwap) GetSigners

func (msg MsgCreateDirectSwap) GetSigners() []sdk.CUAddress

func (MsgCreateDirectSwap) Route

func (msg MsgCreateDirectSwap) Route() string

func (MsgCreateDirectSwap) Type

func (msg MsgCreateDirectSwap) Type() string

func (MsgCreateDirectSwap) ValidateBasic

func (msg MsgCreateDirectSwap) ValidateBasic() sdk.Error

type MsgCreateFreeSwap

type MsgCreateFreeSwap struct {
	From     string       `json:"from"`
	OrderID  string       `json:"order_id"`
	SwapInfo FreeSwapInfo `json:"swap_info"`
}

func NewMsgCreateFreeSwap

func NewMsgCreateFreeSwap(from string, orderid string, swapInfo FreeSwapInfo) MsgCreateFreeSwap

func (MsgCreateFreeSwap) GetSignBytes

func (msg MsgCreateFreeSwap) GetSignBytes() []byte

func (MsgCreateFreeSwap) GetSigners

func (msg MsgCreateFreeSwap) GetSigners() []sdk.CUAddress

func (MsgCreateFreeSwap) Route

func (msg MsgCreateFreeSwap) Route() string

func (MsgCreateFreeSwap) Type

func (msg MsgCreateFreeSwap) Type() string

func (MsgCreateFreeSwap) ValidateBasic

func (msg MsgCreateFreeSwap) ValidateBasic() sdk.Error

type MsgMappingSwap

type MsgMappingSwap struct {
	From        sdk.CUAddress `json:"from"`
	IssueSymbol sdk.Symbol    `json:"issue_symbol"`
	Coins       sdk.Coins     `json:"coins"`
}

func NewMsgMappingSwap

func NewMsgMappingSwap(from sdk.CUAddress, issueSymbol sdk.Symbol, amount sdk.Coins) MsgMappingSwap

func (MsgMappingSwap) GetSignBytes

func (msg MsgMappingSwap) GetSignBytes() []byte

func (MsgMappingSwap) GetSigners

func (msg MsgMappingSwap) GetSigners() []sdk.CUAddress

func (MsgMappingSwap) Route

func (msg MsgMappingSwap) Route() string

func (MsgMappingSwap) Type

func (msg MsgMappingSwap) Type() string

func (MsgMappingSwap) ValidateBasic

func (msg MsgMappingSwap) ValidateBasic() sdk.Error

type MsgSwapSymbol

type MsgSwapSymbol struct {
	From       string  `json:"from"`
	DstOrderID string  `json:"dst_order_id"`
	SwapAmount sdk.Int `json:"swap_amount"`
	SwapType   int     `json:"swap_type"`
}

func NewMsgSwapSymbol

func NewMsgSwapSymbol(from string, orderid string, amount sdk.Int, swapType int) MsgSwapSymbol

func (MsgSwapSymbol) GetSignBytes

func (msg MsgSwapSymbol) GetSignBytes() []byte

func (MsgSwapSymbol) GetSigners

func (msg MsgSwapSymbol) GetSigners() []sdk.CUAddress

func (MsgSwapSymbol) Route

func (msg MsgSwapSymbol) Route() string

func (MsgSwapSymbol) Type

func (msg MsgSwapSymbol) Type() string

func (MsgSwapSymbol) ValidateBasic

func (msg MsgSwapSymbol) ValidateBasic() sdk.Error

type Params

type Params struct {
	NewMappingFee sdk.Int `json:"new_mapping_fee"`
}

Params defines the high level settings for staking

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func MustUnmarshalParams

func MustUnmarshalParams(cdc *codec.Codec, value []byte) Params

unmarshal the current staking params value from store key or panic

func NewParams

func NewParams(newMappingFee sdk.Int) Params

NewParams creates a new Params instance

func UnmarshalParams

func UnmarshalParams(cdc *codec.Codec, value []byte) (params Params, err error)

unmarshal the current staking params value from store key

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Param types are identical. TODO: This is slower than comparing struct fields directly

func (*Params) ParamSetPairs

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

Implements params.ParamSet

func (Params) String

func (p Params) String() string

String returns a human readable string representation of the parameters.

func (Params) Validate

func (p Params) Validate() error

validate a set of params

type QueryDirectSwapOrderList

type QueryDirectSwapOrderList []DirectSwapOrder

func (QueryDirectSwapOrderList) String

func (o QueryDirectSwapOrderList) String() (out string)

type QueryDirectSwapOrderListParams

type QueryDirectSwapOrderListParams struct {
	Page, Limit int
}

func NewQueryDirectSwapInfoListParams

func NewQueryDirectSwapInfoListParams(page, limit int) QueryDirectSwapOrderListParams

type QueryDirectSwapOrderParams

type QueryDirectSwapOrderParams struct {
	OrderID string `json:"order_id"`
}

type QueryFreeSwapOrderList

type QueryFreeSwapOrderList []FreeSwapOrder

func (QueryFreeSwapOrderList) String

func (o QueryFreeSwapOrderList) String() (out string)

type QueryFreeSwapOrderListParams

type QueryFreeSwapOrderListParams struct {
	Page, Limit int
}

func NewQueryFreeSwapInfoListParams

func NewQueryFreeSwapInfoListParams(page, limit int) QueryFreeSwapOrderListParams

type QueryFreeSwapOrderParams

type QueryFreeSwapOrderParams struct {
	OrderID string `json:"order_id"`
}

type QueryMappingListParams

type QueryMappingListParams struct {
	Page, Limit int
}

func NewQueryMappingListParams

func NewQueryMappingListParams(page, limit int) QueryMappingListParams

type QueryMappingParams

type QueryMappingParams struct {
	IssueSymbol string `json:"issue_symbol"`
}

type QueryResMappingInfo

type QueryResMappingInfo struct {
	IssueSymbol  sdk.Symbol `json:"issue_symbol"`
	TargetSymbol sdk.Symbol `json:"target_symbol"`
	TotalSupply  sdk.Int    `json:"total_supply"`
	IssuePool    sdk.Int    `json:"issue_pool"`
	Enabled      bool       `json:"enabled"`
}

func MappingInfoToQueryRes

func MappingInfoToQueryRes(mi *MappingInfo) QueryResMappingInfo

func (QueryResMappingInfo) String

func (m QueryResMappingInfo) String() string

type QueryResMappingList

type QueryResMappingList []QueryResMappingInfo

func (QueryResMappingList) String

func (m QueryResMappingList) String() (out string)

type SwapPool

type SwapPool struct {
	SwapCoins sdk.Coins `json:"swap_coins"`
}

type SwitchMappingProposal

type SwitchMappingProposal struct {
	Title       string     `json:"title"`
	Description string     `json:"description"`
	IssueSymbol sdk.Symbol `json:"issue_symbol"`
	Enable      bool       `json:"enable"`
}

func NewSwitchMappingProposal

func NewSwitchMappingProposal(title, desc string, issueSymbol sdk.Symbol, enable bool) SwitchMappingProposal

func (SwitchMappingProposal) GetDescription

func (smp SwitchMappingProposal) GetDescription() string

func (SwitchMappingProposal) GetTitle

func (smp SwitchMappingProposal) GetTitle() string

func (SwitchMappingProposal) ProposalRoute

func (smp SwitchMappingProposal) ProposalRoute() string

func (SwitchMappingProposal) ProposalToken

func (smp SwitchMappingProposal) ProposalToken() string

func (SwitchMappingProposal) ProposalType

func (smp SwitchMappingProposal) ProposalType() string

func (SwitchMappingProposal) String

func (smp SwitchMappingProposal) String() string

String implements the Stringer interface.

func (SwitchMappingProposal) ValidateBasic

func (smp SwitchMappingProposal) ValidateBasic() sdk.Error

ValidateBasic runs basic stateless validity checks

Jump to

Keyboard shortcuts

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