types

package
v0.0.0-...-410e5a8 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "goldcdp"
	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName
)
View Source
const RouterKey = ModuleName

RouterKey is they name of the goldcdp module

Variables

View Source
var (
	ErrInvalidBasicMsg        = sdkerrors.Register(ModuleName, 1, "InvalidBasicMsg")
	ErrBadDataValue           = sdkerrors.Register(ModuleName, 2, "BadDataValue")
	ErrUnauthorizedPermission = sdkerrors.Register(ModuleName, 3, "UnauthorizedPermission")
	ErrItemDuplication        = sdkerrors.Register(ModuleName, 4, "ItemDuplication")
	ErrItemNotFound           = sdkerrors.Register(ModuleName, 5, "ItemNotFound")
	ErrInvalidState           = sdkerrors.Register(ModuleName, 6, "InvalidState")
	ErrBadWasmExecution       = sdkerrors.Register(ModuleName, 7, "BadWasmExecution")
	ErrOnlyOneDenomAllowed    = sdkerrors.Register(ModuleName, 8, "OnlyOneDenomAllowed")
	ErrInvalidDenom           = sdkerrors.Register(ModuleName, 9, "InvalidDenom")
	ErrUnknownClientID        = sdkerrors.Register(ModuleName, 10, "UnknownClientID")
)
View Source
var (
	// GlobalStoreKeyPrefix is a prefix for global primitive state variable
	GlobalStoreKeyPrefix = []byte{0x00}

	// OrdersCountStoreKey is a key that help getting to current orders count state variable
	OrdersCountStoreKey = append(GlobalStoreKeyPrefix, []byte("OrdersCount")...)

	// ChannelStoreKeyPrefix is a prefix for storing channel
	ChannelStoreKeyPrefix = []byte{0x01}

	// OrderStoreKeyPrefix is a prefix for storing order
	OrderStoreKeyPrefix = []byte{0x02}
)
View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec for the module.

Functions

func ChannelStoreKey

func ChannelStoreKey(chainName, channelPort string) []byte

ChannelStoreKey is a function to generate key for each verified channel in store

func GetEscrowAddress

func GetEscrowAddress() sdk.AccAddress

func OrderStoreKey

func OrderStoreKey(orderID uint64) []byte

OrderStoreKey is a function to generate key for each order in store

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec.

Types

type BankKeeper

type BankKeeper interface {
	AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
	SendCoins(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amt sdk.Coins) error
}

BankKeeper defines the expected bank keeper

type BorshDecoder

type BorshDecoder struct {
	// contains filtered or unexported fields
}

func NewBorshDecoder

func NewBorshDecoder(data []byte) BorshDecoder

func (*BorshDecoder) DecodeString

func (decoder *BorshDecoder) DecodeString() (string, error)

func (*BorshDecoder) DecodeU32

func (decoder *BorshDecoder) DecodeU32() (uint32, error)

func (*BorshDecoder) DecodeU64

func (decoder *BorshDecoder) DecodeU64() (uint64, error)

func (*BorshDecoder) DecodeU8

func (decoder *BorshDecoder) DecodeU8() (uint8, error)

func (*BorshDecoder) Finished

func (decoder *BorshDecoder) Finished() bool

type ChannelKeeper

type ChannelKeeper interface {
	GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channel.Channel, found bool)
	GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
	SendPacket(ctx sdk.Context, packet channelexported.PacketI) error
	PacketExecuted(ctx sdk.Context, packet channelexported.PacketI, acknowledgement []byte) error
	ChanCloseInit(ctx sdk.Context, portID, channelID string) error
	TimeoutExecuted(ctx sdk.Context, packet channelexported.PacketI) error
}

ChannelKeeper defines the expected IBC channel keeper

type MsgBuyGold

type MsgBuyGold struct {
	Buyer  sdk.AccAddress `json:"buyer"`
	Amount sdk.Coins      `json:"amount"`
}

MsgBuyGold is a message for creating order to buy gold

func NewMsgBuyGold

func NewMsgBuyGold(
	buyer sdk.AccAddress,
	amount sdk.Coins,
) MsgBuyGold

NewMsgBuyGold creates a new MsgBuyGold instance.

func (MsgBuyGold) GetSignBytes

func (msg MsgBuyGold) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface for MsgBuyGold.

func (MsgBuyGold) GetSigners

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

GetSigners implements the sdk.Msg interface for MsgBuyGold.

func (MsgBuyGold) Route

func (msg MsgBuyGold) Route() string

Route implements the sdk.Msg interface for MsgBuyGold.

func (MsgBuyGold) Type

func (msg MsgBuyGold) Type() string

Type implements the sdk.Msg interface for MsgBuyGold.

func (MsgBuyGold) ValidateBasic

func (msg MsgBuyGold) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface for MsgBuyGold.

type MsgSetSourceChannel

type MsgSetSourceChannel struct {
	ChainName     string         `json:"chain_name"`
	SourcePort    string         `json:"source_port"`
	SourceChannel string         `json:"source_channel"`
	Signer        sdk.AccAddress `json:"signer"`
}

MsgSetSoruceChannel is a message for setting source channel to other chain

func NewMsgSetSourceChannel

func NewMsgSetSourceChannel(
	chainName, sourcePort, sourceChannel string,
	signer sdk.AccAddress,
) MsgSetSourceChannel

func (MsgSetSourceChannel) GetSignBytes

func (msg MsgSetSourceChannel) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface for MsgSetSourceChannel.

func (MsgSetSourceChannel) GetSigners

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

GetSigners implements the sdk.Msg interface for MsgSetSourceChannel.

func (MsgSetSourceChannel) Route

func (msg MsgSetSourceChannel) Route() string

Route implements the sdk.Msg interface for MsgSetSourceChannel.

func (MsgSetSourceChannel) Type

func (msg MsgSetSourceChannel) Type() string

Type implements the sdk.Msg interface for MsgSetSourceChannel.

func (MsgSetSourceChannel) ValidateBasic

func (msg MsgSetSourceChannel) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface for MsgSetSourceChannel.

type Order

type Order struct {
	Owner  sdk.AccAddress `json:"owner"`
	Amount sdk.Coins      `json:"amount"`
	Gold   sdk.Coin       `json:"gold"`
	Status OrderStatus    `json:"status"`
}

func NewOrder

func NewOrder(owner sdk.AccAddress, amount sdk.Coins) Order

type OrderStatus

type OrderStatus uint8
const (
	Pending OrderStatus = iota
	Active
	Completed
)

type Result

type Result struct {
	Px uint64
}

func DecodeResult

func DecodeResult(data []byte) (Result, error)

Jump to

Keyboard shortcuts

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