Documentation ¶
Index ¶
- Constants
- Variables
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type GenesisState
- type MsgCreateQuiz
- type MsgParticipate
- type MsgValidate
- type ParamSubspace
- type Params
- type Participante
- type QueryResQuiz
- type Quiz
- type QuizStatus
- type Validate
Constants ¶
const ( EventTypeCreateQuiz = "CreateQuiz" EventTypeCreatePart = "CreateParicipate" EventTypeCreateValid = "CreateValidate" AttributeQuizId = "quizId" AttributeQuizCost = "quizCost" AttributeStartTime = "startTime" AttributeEndTime = "endTime" AttributeValueCategory = ModuleName )
quizes module event types
const ( // ModuleName is the name of the module ModuleName = "quizes" // StoreKey to be used when creating the KVStore StoreKey = ModuleName // RouterKey to be used for routing msgs RouterKey = ModuleName // QuerierRoute to be used for querierer msgs QuerierRoute = ModuleName QuizPrefix = "quiz-" ParticipantPrefix = "part-" ValidatorPrefix = "valid-" QuizStatusPrefix = "quizStatus-" )
const ( QueryListQuiz = "list" QueryGetQuiz = "get" QueryGetStatus = "status" )
const CreateQuizConst = "CreateQuiz"
const (
DefaultParamspace = ModuleName
)
Default parameter namespace
const ParticipateConst = "Participate"
const ValidateConst = "Validate"
Variables ¶
var (
ErrInvalid = sdkerrors.Register(ModuleName, 1, "custom error message")
)
TODO: Fill out some custom errors for the module You can see how they are constructed below:
var ModuleCdc *codec.Codec
ModuleCdc defines the module codec
Functions ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on codec
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the quizes genesis parameters
Types ¶
type GenesisState ¶
type GenesisState struct { }
GenesisState - all quizes state that must be provided at genesis
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState - default GenesisState used by Cosmos Hub
func NewGenesisState ¶
func NewGenesisState() GenesisState
NewGenesisState creates a new GenesisState object
type MsgCreateQuiz ¶
type MsgCreateQuiz struct { QuizId uint64 `json:"quizId" yaml:"quizId"` StartTime uint64 `json:"startTime" yaml:"startTime"` EndTime uint64 `json:"endTime" yaml:"endTime"` AnswerAmount uint64 `json:"answerAmount" yaml:"answerAmount"` QuizCost uint64 `json:"quizCost" yaml:"quizCost"` PercentHost uint64 `json:"percentHost" yaml:"percentHost"` PercentValidator uint64 `json:"percentValidator" yaml:"percentValidator"` HostAddress sdk.AccAddress `json:"hostAddress" yaml:"hostAddress"` CurrencyType string `json:"currencyType" yaml:"currencyType"` ValidatorAmount uint64 `json:"validatorAmount" yaml:"validatorAmount"` }
func NewMsgCreateQuiz ¶
func NewMsgCreateQuiz( _quizId uint64, _startTime uint64, _endTime uint64, _answerAmount uint64, _quizCost uint64, _percentHost uint64, _percentValidator uint64, _currencyType string, _hostAddress sdk.AccAddress, _validatorAmount uint64, ) MsgCreateQuiz
NewMsgCreateQuiz creates a new MsgCreateQuiz instance
func (MsgCreateQuiz) GetSignBytes ¶
func (msg MsgCreateQuiz) GetSignBytes() []byte
GetSignBytes gets the bytes for the message signer to sign on
func (MsgCreateQuiz) GetSigners ¶
func (msg MsgCreateQuiz) GetSigners() []sdk.AccAddress
func (MsgCreateQuiz) Type ¶
func (msg MsgCreateQuiz) Type() string
func (MsgCreateQuiz) ValidateBasic ¶
func (msg MsgCreateQuiz) ValidateBasic() error
!!! Нужно потестить будет ли работать логика с msg.QuizId == 0
type MsgParticipate ¶
type MsgParticipate struct { Participant sdk.AccAddress `json:"participant" yaml:"participant"` Answer uint64 `json:"answer" yaml:"answer"` QuizId uint64 `json:"quizId" yaml:"quizId"` Amount sdk.Coins `json:"amount" yaml:"amount"` }
func NewMsgParticipate ¶
func NewMsgParticipate( _participant sdk.AccAddress, _answer uint64, _quizId uint64, _amount sdk.Coins, ) MsgParticipate
NewMsgParticipate creates a new MsgParticipate instance
func (MsgParticipate) GetSignBytes ¶
func (msg MsgParticipate) GetSignBytes() []byte
GetSignBytes gets the bytes for the message signer to sign on
func (MsgParticipate) GetSigners ¶
func (msg MsgParticipate) GetSigners() []sdk.AccAddress
func (MsgParticipate) Type ¶
func (msg MsgParticipate) Type() string
func (MsgParticipate) ValidateBasic ¶
func (msg MsgParticipate) ValidateBasic() error
type MsgValidate ¶
type MsgValidate struct { Validator sdk.AccAddress `json:"validator" yaml:"validator"` Answer uint64 `json:"answer" yaml:"answer"` QuizId uint64 `json:"quizId" yaml:"quizId"` }
func NewMsgValidate ¶
func NewMsgValidate( _validator sdk.AccAddress, _answer uint64, _quizId uint64, ) MsgValidate
func (MsgValidate) GetSignBytes ¶
func (msg MsgValidate) GetSignBytes() []byte
GetSignBytes gets the bytes for the message signer to sign on
func (MsgValidate) GetSigners ¶
func (msg MsgValidate) GetSigners() []sdk.AccAddress
func (MsgValidate) Type ¶
func (msg MsgValidate) Type() string
func (MsgValidate) ValidateBasic ¶
func (msg MsgValidate) ValidateBasic() error
type ParamSubspace ¶
type ParamSubspace interface { WithKeyTable(table params.KeyTable) params.Subspace Get(ctx sdk.Context, key []byte, ptr interface{}) GetParamSet(ctx sdk.Context, ps params.ParamSet) SetParamSet(ctx sdk.Context, ps params.ParamSet) }
ParamSubspace defines the expected Subspace interfacace
type Params ¶
type Params struct { }
Params - used for initializing default parameter for quizes at genesis
func DefaultParams ¶
func DefaultParams() Params
DefaultParams defines the parameters for this module
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs - Implements params.ParamSet
type Participante ¶
type Participante struct { Participant sdk.AccAddress `json:"participant" yaml:"participant"` Answer uint64 `json:"answer" yaml:"answer"` QuizId uint64 `json:"quizId" yaml:"quizId"` Amount sdk.Coins `json:"amount" yaml:"amount"` }
func (Participante) String ¶
func (s Participante) String() string
type QueryResQuiz ¶
type QueryResQuiz []string
QueryResQuiz Queries Result Payload for a names query
type Quiz ¶
type Quiz struct { QuizId uint64 `json:"quizId" yaml:"quizId"` StartTime uint64 `json:"startTime" yaml:"startTime"` EndTime uint64 `json:"endTime" yaml:"endTime"` AnswerAmount uint64 `json:"answerAmount" yaml:"answerAmount"` QuizCost uint64 `json:"quizCost" yaml:"quizCost"` PercentHost uint64 `json:"percentHost" yaml:"percentHost"` PercentValidator uint64 `json:"percentValidator" yaml:"percentValidator"` HostAddress sdk.AccAddress `json:"hostAddress" yaml:"hostAddress"` CurrencyType string `json:"currencyType" yaml:"currencyType"` ValidatorAmount uint64 `json:"validatorAmount" yaml:"validatorAmount"` }
type QuizStatus ¶
type QuizStatus struct { // MoneyForCompany uint `json:"moneyForCompany" yaml:"moneyForCompany"` MoneyForHost uint `json:"moneyForHost" yaml:"moneyForHost"` MoneyForEachValidators uint `json:"moneyForEachValidators" yaml:"moneyForEachValidators"` MoneyForEachParticipant uint `json:"moneyForEachParticipant" yaml:"moneyForEachParticipant"` CorrectAnswer uint `json:"correctAnswer" yaml:"correctAnswer"` Reverted bool `json:"reverted" yaml:"reverted"` QuizId uint64 `json:"quizId" yaml:"quizId"` }
func (QuizStatus) String ¶
func (s QuizStatus) String() string