Documentation ¶
Index ¶
- Constants
- Variables
- func BetStoreKey(BetID uint64, LotteryId uint64) []byte
- func ChannelStoreKey(chainName, channelPort string) []byte
- func GetEscrowAddress() sdk.AccAddress
- func LotteryStoreKey(LotteryID uint64) []byte
- func RegisterCodec(cdc *codec.Codec)
- type BankKeeper
- type Bet
- type BorshDecoder
- type ChannelKeeper
- type Lottery
- type LotteryStatus
- type MsgCLoseLottery
- type MsgCreateLottery
- type MsgPlayLottery
- type MsgSetSourceChannel
- type Result
Constants ¶
const ( // ModuleName is the name of the module ModuleName = "lottery" // StoreKey to be used when creating the KVStore StoreKey = ModuleName )
const RouterKey = ModuleName
RouterKey is they name of the lottery module
Variables ¶
var ( ErrInvalidBasicMsg = sdkerrors.Register(ModuleName, 1, "InvalidBasicMsg") ErrBadDataValue = sdkerrors.Register(ModuleName, 2, "BadDataValue") 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") )
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} )
var MaxNUmber = uint64(1000)
var ModuleCdc = codec.New()
ModuleCdc is the codec for the module.
var StandardPrice = sdk.Coins{sdk.NewInt64Coin("stake", 1)}
Functions ¶
func BetStoreKey ¶
BetStoreKey is a function to generate key for each Bet in store
func ChannelStoreKey ¶
ChannelStoreKey is a function to generate key for each verified channel in store
func GetEscrowAddress ¶
func GetEscrowAddress() sdk.AccAddress
func LotteryStoreKey ¶
LotteryStoreKey is a function to generate key for each Lottery in store
func RegisterCodec ¶
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"` }
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 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.