types

package
v0.0.0-...-1ebabd0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeCreateQuiz  = "CreateQuiz"
	EventTypeCreatePart  = "CreateParicipate"
	EventTypeCreateValid = "CreateValidate"
	AttributeQuizId      = "quizId"
	AttributeQuizCost    = "quizCost"
	AttributeStartTime   = "startTime"
	AttributeEndTime     = "endTime"

	AttributeValueCategory = ModuleName
)

quizes module event types

View Source
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-"
)
View Source
const (
	QueryListQuiz  = "list"
	QueryGetQuiz   = "get"
	QueryGetStatus = "status"
)
View Source
const CreateQuizConst = "CreateQuiz"
View Source
const (
	DefaultParamspace = ModuleName
)

Default parameter namespace

View Source
const ParticipateConst = "Participate"
View Source
const ValidateConst = "Validate"

Variables

View Source
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:

View Source
var ModuleCdc *codec.Codec

ModuleCdc defines the module codec

Functions

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for quizes module

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

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) Route

func (msg MsgCreateQuiz) Route() string

nolint

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) Route

func (msg MsgParticipate) Route() string

nolint

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) Route

func (msg MsgValidate) Route() string

nolint

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 NewParams

func NewParams() Params

NewParams creates a new Params object

func (*Params) ParamSetPairs

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

ParamSetPairs - Implements params.ParamSet

func (Params) String

func (p Params) String() string

String implements the stringer interface for Params

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

func (QueryResQuiz) String

func (n QueryResQuiz) String() string

implement fmt.Stringer

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"`
}

func (Quiz) String

func (s Quiz) String() string

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

type Validate

type Validate struct {
	Validator sdk.AccAddress `json:"validator" yaml:"validator"`
	Answer    uint64         `json:"answer" yaml:"answer"`
	QuizId    uint64         `json:"quizId" yaml:"quizId"`
}

func (Validate) String

func (s Validate) String() string

Jump to

Keyboard shortcuts

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