types

package
v0.0.0-...-18ecf46 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

RouterKey is they name of the lottery 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")
	ErrorInvalidAmount        = sdkerrors.Register(ModuleName, 11, "InvalidAmount")
)
View Source
var (
	// GlobalStoreKeyPrefix is a prefix for global primitive state variable
	GlobalStoreKeyPrefix = []byte{0x00}

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

	BetsCountStoreKey = append(GlobalStoreKeyPrefix, []byte("BetsCount")...)

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

	// LotteryStoreKeyPrefix is a prefix for storing lottery
	LotteryStoreKeyPrefix = []byte{0x02}

	// BetStoreKeyPrefix is a prefix for storing bet
	BetStoreKeyPrefix = []byte{0x03}
)
View Source
var MaxNUmber = uint64(1000)
View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec for the module.

View Source
var StandardPrice = sdk.Coins{sdk.NewInt64Coin("stake", 1)}

Functions

func BetStoreKey

func BetStoreKey(BetID uint64, LotteryId uint64) []byte

BetStoreKey is a function to generate key for each Bet in store

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 LotteryStoreKey

func LotteryStoreKey(LotteryID uint64) []byte

LotteryStoreKey is a function to generate key for each Lottery 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
	SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
}

BankKeeper defines the expected bank keeper

type Bet

type Bet struct {
	Player        sdk.AccAddress `json:"player"`
	LotteryNumber uint64         `json:"lotteryNumber"`
	Lottery       Lottery        `json:"lotteryId"`
}

func NewBet

func NewBet(player sdk.AccAddress, number uint64, lottery Lottery) Bet

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 Lottery

type Lottery struct {
	AccumulatedAmount sdk.Coins     `json:"accumulatedAmount"`
	Price             sdk.Coins     `json:"price"`
	Status            LotteryStatus `json:"status"`
	WinningNumber     uint64        `json:"winningNumber"`
	MaxNUmber         uint64        `json:"maxNumber"`
	Id                uint64        `json:"id"`
}

func NewLottery

func NewLottery(Open LotteryStatus, id uint64, amount sdk.Coins) Lottery

type LotteryStatus

type LotteryStatus uint8
const (
	Open LotteryStatus = iota
	Closed
)

type MsgCLoseLottery

type MsgCLoseLottery struct {
	Closer sdk.AccAddress `json:"creator"`
}

MsgCreateLottery is a message to create lottery game with open status

func NewMsgCloseLottery

func NewMsgCloseLottery(
	closer sdk.AccAddress,
) MsgCLoseLottery

func (MsgCLoseLottery) GetSignBytes

func (msg MsgCLoseLottery) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface for MsgBuyGold.

func (MsgCLoseLottery) GetSigners

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

GetSigners implements the sdk.Msg interface for MsgBuyGold.

func (MsgCLoseLottery) Route

func (msg MsgCLoseLottery) Route() string

Route implements the sdk.Msg interface for MsgCLoseLottery.

func (MsgCLoseLottery) Type

func (msg MsgCLoseLottery) Type() string

Type implements the sdk.Msg interface for MsgCLoseLottery.

func (MsgCLoseLottery) ValidateBasic

func (msg MsgCLoseLottery) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface for MsgCLoseLottery.

type MsgCreateLottery

type MsgCreateLottery struct {
	Creator sdk.AccAddress `json:"creator"`
	Status  LotteryStatus  `json:"status"`
	Amount  sdk.Coins      `json:"amount"`
}

MsgCreateLottery is a message to create lottery game with open status

AccumulatedAmount sdk.Coins 		`json:"amount"`

func NewMsgCreateLottery

func NewMsgCreateLottery(
	creator sdk.AccAddress,
	status LotteryStatus,
	amount sdk.Coins,
) MsgCreateLottery

func (MsgCreateLottery) GetSignBytes

func (msg MsgCreateLottery) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface for MsgBuyGold.

func (MsgCreateLottery) GetSigners

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

GetSigners implements the sdk.Msg interface for MsgBuyGold.

func (MsgCreateLottery) Route

func (msg MsgCreateLottery) Route() string

Route implements the sdk.Msg interface for MsgCreateLottery.

func (MsgCreateLottery) Type

func (msg MsgCreateLottery) Type() string

Type implements the sdk.Msg interface for MsgCreateLottery.

func (MsgCreateLottery) ValidateBasic

func (msg MsgCreateLottery) ValidateBasic() error

ValidateBasic implements the sdk.Msg interface for MsgBuyGold.

type MsgPlayLottery

type MsgPlayLottery struct {
	Player sdk.AccAddress `json:"player"`
	Amount sdk.Coins      `json:"amount"`
	Number uint64         `json:"number"`
}

MsgPlayLottery is a message for play a number in the open lottery

func NewMsgPlayLottery

func NewMsgPlayLottery(
	player sdk.AccAddress,
	amount sdk.Coins,
	number uint64,
) MsgPlayLottery

NewMsgBuyGold creates a new MsgBuyGold instance.

func (MsgPlayLottery) GetSignBytes

func (msg MsgPlayLottery) GetSignBytes() []byte

GetSignBytes implements the sdk.Msg interface for MsgBuyGold.

func (MsgPlayLottery) GetSigners

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

GetSigners implements the sdk.Msg interface for MsgBuyGold.

func (MsgPlayLottery) Route

func (msg MsgPlayLottery) Route() string

Route implements the sdk.Msg interface for MsgPlayLottery.

func (MsgPlayLottery) Type

func (msg MsgPlayLottery) Type() string

Type implements the sdk.Msg interface for MsgPlayLottery.

func (MsgPlayLottery) ValidateBasic

func (msg MsgPlayLottery) 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 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