types

package
v0.0.0-...-8551cdf Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxDescriptionLength int = 5000
	MaxTitleLength       int = 140
)

Constants pertaining to a Content object

View Source
const (
	EventTypeSubmitProposal   = "submit_proposal"
	EventTypeProposalDeposit  = "proposal_deposit"
	EventTypeProposalVote     = "proposal_vote"
	EventTypeInactiveProposal = "inactive_proposal"
	EventTypeActiveProposal   = "active_proposal"

	AttributeKeyProposalResult     = "proposal_result"
	AttributeKeyOption             = "option"
	AttributeKeyProposalID         = "proposal_id"
	AttributeKeyVotingPeriodStart  = "voting_period_start"
	AttributeValueCategory         = "governance"
	AttributeValueProposalDropped  = "proposal_dropped"  // didn't meet min deposit
	AttributeValueProposalPassed   = "proposal_passed"   // met vote quorum
	AttributeValueProposalRejected = "proposal_rejected" // didn't meet vote quorum
	AttributeValueProposalFailed   = "proposal_failed"   // error on proposal handler
	AttributeKeyProposalType       = "proposal_type"
)

Governance module event types

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "kugov"

	// StoreKey is the store key string for gov
	StoreKey = ModuleName

	// RouterKey is the message route for gov
	RouterKey = ModuleName

	// QuerierRoute is the querier route for gov
	QuerierRoute = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName

	AccountIDlen = sdk.AddrLen + 1
)
View Source
const (
	TypeMsgDeposit        = "deposit"
	TypeMsgVote           = "vote"
	TypeMsgSubmitProposal = "submitproposal"
)

Governance message types and routes

View Source
const (
	DefaultPeriod       time.Duration = time.Hour * 24 * 14 // 14 days
	DefaultPunishPeriod time.Duration = time.Hour * 24 * 7  //7 days
)

Default period for deposits & voting

View Source
const (
	QueryParams           = "params"
	QueryProposals        = "proposals"
	QueryProposal         = "proposal"
	QueryDeposits         = "deposits"
	QueryDeposit          = "deposit"
	QueryVotes            = "votes"
	QueryVote             = "vote"
	QueryTally            = "tally"
	QueryPunishValidators = "punishvalidators"
	QueryPunishValidator  = "punishvalidator"

	ParamDeposit  = "deposit"
	ParamVoting   = "voting"
	ParamTallying = "tallying"
)

query endpoints supported by the governance Querier

View Source
const DefaultStartingProposalID uint64 = 1

DefaultStartingProposalID is 1

View Source
const (
	ProposalTypeText string = "Text"
)

Proposal types

Variables

View Source
var (
	Amino = codec.New()

	// ModuleCdc references the global x/gov module codec. Note, the codec should
	// ONLY be used in certain instances of tests and for JSON encoding as Amino is
	// still used for that purpose.
	//
	// The actual codec used for serialization should be provided to x/gov and
	// defined at the application level.
	ModuleCdc = codec.NewHybridCodec(Amino)
)
View Source
var (
	ErrUnknownProposal         = sdkerrors.Register(ModuleName, 2, "unknown proposal")
	ErrInactiveProposal        = sdkerrors.Register(ModuleName, 3, "inactive proposal")
	ErrAlreadyActiveProposal   = sdkerrors.Register(ModuleName, 4, "proposal already active")
	ErrInvalidProposalContent  = sdkerrors.Register(ModuleName, 5, "invalid proposal content")
	ErrInvalidProposalType     = sdkerrors.Register(ModuleName, 6, "invalid proposal type")
	ErrInvalidVote             = sdkerrors.Register(ModuleName, 7, "invalid vote option")
	ErrInvalidGenesis          = sdkerrors.Register(ModuleName, 8, "invalid genesis state")
	ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 9, "no handler exists for proposal type")
	ErrInvalidVoter            = sdkerrors.Register(ModuleName, 10, "only validator can vote")
	ErrBadValidatorAddr        = sdkerrors.Register(ModuleName, 11, "validator does not exist for that address")
	ErrValidatorNoPunish       = sdkerrors.Register(ModuleName, 12, "validator does not be punished")
	ErrValidatorJailed         = sdkerrors.Register(ModuleName, 13, "validator still jailed; cannot be unjailed")
)

x/gov module sentinel errors

View Source
var (
	ProposalsKeyPrefix          = []byte{0x00}
	ActiveProposalQueuePrefix   = []byte{0x01}
	InactiveProposalQueuePrefix = []byte{0x02}
	ProposalIDKey               = []byte{0x03}

	DepositsKeyPrefix = []byte{0x10}

	VotesKeyPrefix = []byte{0x20}

	ValidatorKeyPrefix = []byte{0x30}
)

Keys for governance store Items are stored with the following key: values

- 0x00<proposalID_Bytes>: Proposal

- 0x01<endTime_Bytes><proposalID_Bytes>: activeProposalID

- 0x02<endTime_Bytes><proposalID_Bytes>: inactiveProposalID

- 0x03: nextProposalID

- 0x10<proposalID_Bytes><depositorAddr_Bytes>: Deposit

- 0x20<proposalID_Bytes><voterAddr_Bytes>: Voter

View Source
var (
	DefaultMinDepositTokens = external.TokensFromConsensusPower(500)
	DefaultQuorum           = sdk.NewDecWithPrec(334, 3)
	DefaultThreshold        = sdk.NewDecWithPrec(5, 1)
	DefaultVeto             = sdk.NewDecWithPrec(334, 3)
	DefaultEmergengcy       = sdk.NewDecWithPrec(667, 3)
	DefaultSlashFraction    = sdk.NewDec(1).Quo(sdk.NewDec(10000))
)

Default governance params

View Source
var (
	ParamStoreKeyDepositParams = []byte("depositparams")
	ParamStoreKeyVotingParams  = []byte("votingparams")
	ParamStoreKeyTallyParams   = []byte("tallyparams")
)

Parameter store key

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// ModuleAccountID is the account id for module account
	ModuleAccountID = types.NewAccountIDFromName(types.MustName(ModuleName))
)
View Source
var ProposalStatus_name = map[int32]string{
	0: "PROPOSAL_STATUS_UNSPECIFIED",
	1: "PROPOSAL_STATUS_DEPOSIT_PERIOD",
	2: "PROPOSAL_STATUS_VOTING_PERIOD",
	3: "PROPOSAL_STATUS_PASSED",
	4: "PROPOSAL_STATUS_REJECTED",
	5: "PROPOSAL_STATUS_FAILED",
}
View Source
var ProposalStatus_value = map[string]int32{
	"PROPOSAL_STATUS_UNSPECIFIED":    0,
	"PROPOSAL_STATUS_DEPOSIT_PERIOD": 1,
	"PROPOSAL_STATUS_VOTING_PERIOD":  2,
	"PROPOSAL_STATUS_PASSED":         3,
	"PROPOSAL_STATUS_REJECTED":       4,
	"PROPOSAL_STATUS_FAILED":         5,
}
View Source
var (
	RouterKeyName = chaintype.MustName(RouterKey)
)
View Source
var VoteOption_name = map[int32]string{
	0: "VOTE_OPTION_UNSPECIFIED",
	1: "VOTE_OPTION_YES",
	2: "VOTE_OPTION_ABSTAIN",
	3: "VOTE_OPTION_NO",
	4: "VOTE_OPTION_NO_WITH_VETO",
}
View Source
var VoteOption_value = map[string]int32{
	"VOTE_OPTION_UNSPECIFIED":  0,
	"VOTE_OPTION_YES":          1,
	"VOTE_OPTION_ABSTAIN":      2,
	"VOTE_OPTION_NO":           3,
	"VOTE_OPTION_NO_WITH_VETO": 4,
}

Functions

func ActiveProposalByTimeKey

func ActiveProposalByTimeKey(endTime time.Time) []byte

ActiveProposalByTimeKey gets the active proposal queue key by endTime

func ActiveProposalQueueKey

func ActiveProposalQueueKey(proposalID uint64, endTime time.Time) []byte

ActiveProposalQueueKey returns the key for a proposalID in the activeProposalQueue

func Cdc

func Cdc() *codec.Codec

Cdc get codec for types

func DepositKey

func DepositKey(proposalID uint64, depositorAddr chaintype.AccountID) []byte

DepositKey key of a specific deposit from the store

func DepositsKey

func DepositsKey(proposalID uint64) []byte

DepositsKey gets the first part of the deposits key based on the proposalID

func GetProposalIDBytes

func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte)

GetProposalIDBytes returns the byte representation of the proposalID

func GetProposalIDFromBytes

func GetProposalIDFromBytes(bz []byte) (proposalID uint64)

GetProposalIDFromBytes returns proposalID in uint64 format from a byte array

func GetValidatorKey

func GetValidatorKey(validatorAccount chaintype.AccountID) []byte

func InactiveProposalByTimeKey

func InactiveProposalByTimeKey(endTime time.Time) []byte

InactiveProposalByTimeKey gets the inactive proposal queue key by endTime

func InactiveProposalQueueKey

func InactiveProposalQueueKey(proposalID uint64, endTime time.Time) []byte

InactiveProposalQueueKey returns the key for a proposalID in the inactiveProposalQueue

func IsValidProposalType

func IsValidProposalType(ty string) bool

IsValidProposalType returns a boolean determining if the proposal type is valid.

NOTE: Modules with their own proposal types must register them.

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable - Key declaration for parameters

func ProposalHandler

func ProposalHandler(_ sdk.Context, c Content) error

ProposalHandler implements the Handler interface for governance module-based proposals (ie. TextProposal ). Since these are merely signaling mechanisms at the moment and do not affect state, it performs a no-op.

func ProposalKey

func ProposalKey(proposalID uint64) []byte

ProposalKey gets a specific proposal from the store

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers all the necessary types and interfaces for the governance module.

func RegisterProposalType

func RegisterProposalType(ty string)

RegisterProposalType registers a proposal type. It will panic if the type is already registered.

func RegisterProposalTypeCodec

func RegisterProposalTypeCodec(o interface{}, name string)

RegisterProposalTypeCodec registers an external proposal content type defined in another module for the internal ModuleCdc. This allows the MsgSubmitProposal to be correctly Amino encoded and decoded.

NOTE: This should only be used for applications that are still using a concrete Amino codec for serialization.

func SplitActiveProposalQueueKey

func SplitActiveProposalQueueKey(key []byte) (proposalID uint64, endTime time.Time)

SplitActiveProposalQueueKey split the active proposal key and returns the proposal id and endTime

func SplitInactiveProposalQueueKey

func SplitInactiveProposalQueueKey(key []byte) (proposalID uint64, endTime time.Time)

SplitInactiveProposalQueueKey split the inactive proposal key and returns the proposal id and endTime

func SplitKeyDeposit

func SplitKeyDeposit(key []byte) (proposalID uint64, depositorAddr chaintype.AccountID)

SplitKeyDeposit split the deposits key and returns the proposal id and depositor address

func SplitKeyVote

func SplitKeyVote(key []byte) (proposalID uint64, voterAddr chaintype.AccountID)

SplitKeyVote split the votes key and returns the proposal id and voter address

func SplitProposalKey

func SplitProposalKey(key []byte) (proposalID uint64)

SplitProposalKey split the proposal key and returns the proposal id

func ValidProposalStatus

func ValidProposalStatus(status ProposalStatus) bool

ValidProposalStatus returns true if the proposal status is valid and false otherwise.

func ValidVoteOption

func ValidVoteOption(option VoteOption) bool

ValidVoteOption returns true if the vote option is valid and false otherwise.

func ValidateAbstract

func ValidateAbstract(c Content) error

ValidateAbstract validates a proposal's abstract contents returning an error if invalid.

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis checks if parameters are within valid ranges

func VoteKey

func VoteKey(proposalID uint64, voterAddr chaintype.AccountID) []byte

VoteKey key of a specific vote from the store

func VotesKey

func VotesKey(proposalID uint64) []byte

VotesKey gets the first part of the votes key based on the proposalID

Types

type AccountKeeper

type AccountKeeper interface {
	chaintype.AccountAuther
	GetAccount(sdk.Context, chaintype.AccountID) accountExported.Account
}

AccountKeeper defines the expected account keeper (noalias)

type BankKeeper

type BankKeeper interface {
	chaintype.AssetTransfer
	GetAllBalances(ctx sdk.Context, addr chaintype.AccountID) sdk.Coins
	GetCoinPowers(ctx sdk.Context, account chaintype.AccountID) sdk.Coins
	SpendableCoins(ctx sdk.Context, account chaintype.AccountID) sdk.Coins
}

BankKeeper defines the expected interface needed to retrieve account balances.

type Codec

type Codec interface {
	codec.Marshaler

	MarshalProposal(Proposal) ([]byte, error)
	UnmarshalProposal([]byte) (Proposal, error)
}

Codec defines the interface required to serialize custom x/gov types.

type Content

type Content interface {
	GetTitle() string
	GetDescription() string
	ProposalRoute() string
	ProposalType() string
	ValidateBasic() error
	String() string
}

Content defines an interface that a proposal must implement. It contains information such as the title and description along with the type and routing information for the appropriate handler to process the proposal. Content can have additional fields, which will handled by a proposal's Handler.

func ContentFromProposalType

func ContentFromProposalType(title, desc, ty string) Content

ContentFromProposalType returns a Content object based on the proposal type.

func NewTextProposal

func NewTextProposal(title, description string) Content

NewTextProposal creates a text proposal Content

type Deposit

type Deposit struct {
	ProposalID uint64                                   `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"`
	Depositor  types1.AccountID                         `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor" yaml:"depositor"`
	Amount     github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
}

Deposit defines an amount deposited by an account address to an active proposal

func NewDeposit

func NewDeposit(proposalID uint64, depositor chaintype.AccountID, amount sdk.Coins) Deposit

NewDeposit creates a new Deposit instance

func (*Deposit) Descriptor

func (*Deposit) Descriptor() ([]byte, []int)

func (Deposit) Empty

func (d Deposit) Empty() bool

Empty returns whether a deposit is empty.

func (*Deposit) Equal

func (this *Deposit) Equal(that interface{}) bool

func (*Deposit) Marshal

func (m *Deposit) Marshal() (dAtA []byte, err error)

func (*Deposit) MarshalTo

func (m *Deposit) MarshalTo(dAtA []byte) (int, error)

func (*Deposit) MarshalToSizedBuffer

func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Deposit) ProtoMessage

func (*Deposit) ProtoMessage()

func (*Deposit) Reset

func (m *Deposit) Reset()

func (*Deposit) Size

func (m *Deposit) Size() (n int)

func (Deposit) String

func (d Deposit) String() string

func (*Deposit) Unmarshal

func (m *Deposit) Unmarshal(dAtA []byte) error

func (*Deposit) XXX_DiscardUnknown

func (m *Deposit) XXX_DiscardUnknown()

func (*Deposit) XXX_Marshal

func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Deposit) XXX_Merge

func (m *Deposit) XXX_Merge(src proto.Message)

func (*Deposit) XXX_Size

func (m *Deposit) XXX_Size() int

func (*Deposit) XXX_Unmarshal

func (m *Deposit) XXX_Unmarshal(b []byte) error

type DepositParams

type DepositParams struct {
	MinDeposit       sdk.Coins     `json:"min_deposit,omitempty" yaml:"min_deposit,omitempty"`               //  Minimum deposit for a proposal to enter voting period.
	MaxDepositPeriod time.Duration `json:"max_deposit_period,omitempty" yaml:"max_deposit_period,omitempty"` //  Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
}

DepositParams defines the params around deposits for governance

func DefaultDepositParams

func DefaultDepositParams() DepositParams

DefaultDepositParams default parameters for deposits

func NewDepositParams

func NewDepositParams(minDeposit sdk.Coins, maxDepositPeriod time.Duration) DepositParams

NewDepositParams creates a new DepositParams object

func (DepositParams) Equal

func (dp DepositParams) Equal(dp2 DepositParams) bool

Equal checks equality of DepositParams

func (DepositParams) String

func (dp DepositParams) String() string

String implements stringer insterface

type Deposits

type Deposits []Deposit

Deposits is a collection of Deposit objects

func (Deposits) Equal

func (d Deposits) Equal(other Deposits) bool

Equal returns true if two slices (order-dependant) of deposits are equal.

func (Deposits) String

func (d Deposits) String() string

type DistributionKeeper

type DistributionKeeper interface {
	CanDistribution(ctx sdk.Context) (bool, time.Time)

	SetStartNotDistributionTimePoint(ctx sdk.Context, t time.Time)
}

type GenesisState

type GenesisState struct {
	StartingProposalID uint64        `json:"starting_proposal_id" yaml:"starting_proposal_id"`
	Deposits           Deposits      `json:"deposits" yaml:"deposits"`
	Votes              Votes         `json:"votes" yaml:"votes"`
	Proposals          Proposals     `json:"proposals" yaml:"proposals"`
	DepositParams      DepositParams `json:"deposit_params" yaml:"deposit_params"`
	VotingParams       VotingParams  `json:"voting_params" yaml:"voting_params"`
	TallyParams        TallyParams   `json:"tally_params" yaml:"tally_params"`
}

GenesisState - all staking state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState defines the default governance genesis state

func NewGenesisState

func NewGenesisState(startingProposalID uint64, dp DepositParams, vp VotingParams, tp TallyParams) GenesisState

NewGenesisState creates a new genesis state for the governance module

func (GenesisState) Equal

func (data GenesisState) Equal(other GenesisState) bool

func (GenesisState) IsEmpty

func (data GenesisState) IsEmpty() bool

IsEmpty returns true if a GenesisState is empty

type Handler

type Handler func(ctx sdk.Context, content Content) error

Handler defines a function that handles a proposal after it has passed the governance process.

type KuMsgDeposit

type KuMsgDeposit struct {
	chaintype.KuMsg
}

func NewKuMsgDeposit

func NewKuMsgDeposit(auth sdk.AccAddress, depositor chaintype.AccountID, proposalID uint64, amount sdk.Coins) KuMsgDeposit

type KuMsgSubmitProposal

type KuMsgSubmitProposal struct {
	chaintype.KuMsg
	Content Content `json:"content" yaml:"content"`
}

func NewKuMsgSubmitProposal

func NewKuMsgSubmitProposal(auth sdk.AccAddress, content Content, initialDeposit sdk.Coins, proposer chaintype.AccountID) KuMsgSubmitProposal

func (KuMsgSubmitProposal) GetContent

func (msg KuMsgSubmitProposal) GetContent() Content

func (KuMsgSubmitProposal) GetInitialDeposit

func (msg KuMsgSubmitProposal) GetInitialDeposit() sdk.Coins

func (KuMsgSubmitProposal) GetProposer

func (msg KuMsgSubmitProposal) GetProposer() sdk.AccAddress

func (KuMsgSubmitProposal) GetProposerAccountID

func (msg KuMsgSubmitProposal) GetProposerAccountID() chaintype.AccountID

func (KuMsgSubmitProposal) ValidateBasic

func (msg KuMsgSubmitProposal) ValidateBasic() error

type KuMsgVote

type KuMsgVote struct {
	chaintype.KuMsg
}

func NewKuMsgVote

func NewKuMsgVote(auth sdk.AccAddress, voter chaintype.AccountID, proposalID uint64, option VoteOption) KuMsgVote

type MsgDeposit

type MsgDeposit struct {
	ProposalID uint64                                   `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"`
	Depositor  types1.AccountID                         `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor" yaml:"depositor"`
	Amount     github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=amount,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"amount"`
}

MsgDeposit defines a message to submit a deposit to an existing proposal

func NewMsgDeposit

func NewMsgDeposit(depositor chaintype.AccountID, proposalID uint64, amount sdk.Coins) MsgDeposit

NewMsgDeposit creates a new MsgDeposit instance

func (*MsgDeposit) Descriptor

func (*MsgDeposit) Descriptor() ([]byte, []int)

func (*MsgDeposit) Equal

func (this *MsgDeposit) Equal(that interface{}) bool

func (MsgDeposit) GetSignBytes

func (msg MsgDeposit) GetSignBytes() []byte

GetSignBytes implements Msg

func (MsgDeposit) GetSigners

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

GetSigners implements Msg

func (*MsgDeposit) Marshal

func (m *MsgDeposit) Marshal() (dAtA []byte, err error)

func (*MsgDeposit) MarshalTo

func (m *MsgDeposit) MarshalTo(dAtA []byte) (int, error)

func (*MsgDeposit) MarshalToSizedBuffer

func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgDeposit) ProtoMessage

func (*MsgDeposit) ProtoMessage()

func (*MsgDeposit) Reset

func (m *MsgDeposit) Reset()

func (MsgDeposit) Route

func (msg MsgDeposit) Route() string

Route implements Msg

func (*MsgDeposit) Size

func (m *MsgDeposit) Size() (n int)

func (MsgDeposit) String

func (msg MsgDeposit) String() string

String implements the Stringer interface

func (MsgDeposit) Type

func (msg MsgDeposit) Type() chaintype.Name

Type implements Msg

func (*MsgDeposit) Unmarshal

func (m *MsgDeposit) Unmarshal(dAtA []byte) error

func (MsgDeposit) ValidateBasic

func (msg MsgDeposit) ValidateBasic() error

ValidateBasic implements Msg

func (*MsgDeposit) XXX_DiscardUnknown

func (m *MsgDeposit) XXX_DiscardUnknown()

func (*MsgDeposit) XXX_Marshal

func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgDeposit) XXX_Merge

func (m *MsgDeposit) XXX_Merge(src proto.Message)

func (*MsgDeposit) XXX_Size

func (m *MsgDeposit) XXX_Size() int

func (*MsgDeposit) XXX_Unmarshal

func (m *MsgDeposit) XXX_Unmarshal(b []byte) error

type MsgGovUnJail

type MsgGovUnJail struct {
	chaintype.KuMsg
}

func NewMsgGovUnjail

func NewMsgGovUnjail(auth sdk.AccAddress, validatoraddr chaintype.AccountID) MsgGovUnJail

type MsgGovUnjailBase

type MsgGovUnjailBase struct {
	ValidatorAccount types1.AccountID `protobuf:"bytes,1,opt,name=validator_account,json=validatorAccount,proto3" json:"account_id" yaml:"account_id"`
}

func NewMsgGovUnjailBaseFromFace

func NewMsgGovUnjailBaseFromFace(that MsgGovUnjailBaseFace) *MsgGovUnjailBase

func (*MsgGovUnjailBase) Descriptor

func (*MsgGovUnjailBase) Descriptor() ([]byte, []int)

func (*MsgGovUnjailBase) Equal

func (this *MsgGovUnjailBase) Equal(that interface{}) bool

func (MsgGovUnjailBase) GetSigners

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

nolint

func (MsgGovUnjailBase) GetUnjailValidator

func (msg MsgGovUnjailBase) GetUnjailValidator() chaintype.AccountID

func (*MsgGovUnjailBase) GetValidatorAccount

func (this *MsgGovUnjailBase) GetValidatorAccount() types1.AccountID

func (*MsgGovUnjailBase) Marshal

func (m *MsgGovUnjailBase) Marshal() (dAtA []byte, err error)

func (*MsgGovUnjailBase) MarshalTo

func (m *MsgGovUnjailBase) MarshalTo(dAtA []byte) (int, error)

func (*MsgGovUnjailBase) MarshalToSizedBuffer

func (m *MsgGovUnjailBase) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGovUnjailBase) Proto

func (*MsgGovUnjailBase) ProtoMessage

func (*MsgGovUnjailBase) ProtoMessage()

func (*MsgGovUnjailBase) Reset

func (m *MsgGovUnjailBase) Reset()

func (MsgGovUnjailBase) Route

func (msg MsgGovUnjailBase) Route() string

func (*MsgGovUnjailBase) Size

func (m *MsgGovUnjailBase) Size() (n int)

func (*MsgGovUnjailBase) String

func (m *MsgGovUnjailBase) String() string

func (*MsgGovUnjailBase) TestProto

func (MsgGovUnjailBase) Type

func (msg MsgGovUnjailBase) Type() chaintype.Name

func (*MsgGovUnjailBase) Unmarshal

func (m *MsgGovUnjailBase) Unmarshal(dAtA []byte) error

func (MsgGovUnjailBase) ValidateBasic

func (msg MsgGovUnjailBase) ValidateBasic() error

func (*MsgGovUnjailBase) XXX_DiscardUnknown

func (m *MsgGovUnjailBase) XXX_DiscardUnknown()

func (*MsgGovUnjailBase) XXX_Marshal

func (m *MsgGovUnjailBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGovUnjailBase) XXX_Merge

func (m *MsgGovUnjailBase) XXX_Merge(src proto.Message)

func (*MsgGovUnjailBase) XXX_Size

func (m *MsgGovUnjailBase) XXX_Size() int

func (*MsgGovUnjailBase) XXX_Unmarshal

func (m *MsgGovUnjailBase) XXX_Unmarshal(b []byte) error

type MsgGovUnjailBaseFace

type MsgGovUnjailBaseFace interface {
	Proto() github_com_gogo_protobuf_proto.Message
	GetValidatorAccount() types1.AccountID
}

type MsgSubmitProposal

type MsgSubmitProposal struct {
	Content        Content             `json:"content" yaml:"content"`
	InitialDeposit sdk.Coins           `json:"initial_deposit" yaml:"initial_deposit"` //  Initial deposit paid by sender. Must be strictly positive
	Proposer       chaintype.AccountID `json:"proposer" yaml:"proposer"`               //  Address of the proposer
}

MsgSubmitProposal defines a (deprecated) message to create/submit a governance proposal.

TODO: Remove once client-side Protobuf migration has been completed.

func NewMsgSubmitProposal

func NewMsgSubmitProposal(content Content, initialDeposit sdk.Coins, proposer chaintype.AccountID) MsgSubmitProposal

NewMsgSubmitProposal returns a (deprecated) MsgSubmitProposal message.

TODO: Remove once client-side Protobuf migration has been completed.

func (MsgSubmitProposal) GetContent

func (msg MsgSubmitProposal) GetContent() Content

func (MsgSubmitProposal) GetInitialDeposit

func (msg MsgSubmitProposal) GetInitialDeposit() sdk.Coins

func (MsgSubmitProposal) GetProposer

func (msg MsgSubmitProposal) GetProposer() sdk.AccAddress

func (MsgSubmitProposal) GetProposerAccountID

func (msg MsgSubmitProposal) GetProposerAccountID() chaintype.AccountID

func (MsgSubmitProposal) GetSignBytes

func (msg MsgSubmitProposal) GetSignBytes() []byte

GetSignBytes implements Msg

func (MsgSubmitProposal) GetSigners

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

nolint

func (MsgSubmitProposal) Marshal

func (msg MsgSubmitProposal) Marshal() (dAtA []byte, err error)

func (MsgSubmitProposal) Route

func (msg MsgSubmitProposal) Route() string

func (MsgSubmitProposal) Type

func (msg MsgSubmitProposal) Type() string

func (MsgSubmitProposal) Unmarshal

func (msg MsgSubmitProposal) Unmarshal(dAtA []byte) (err error)

func (MsgSubmitProposal) ValidateBasic

func (msg MsgSubmitProposal) ValidateBasic() error

ValidateBasic implements Msg

type MsgSubmitProposalBase

type MsgSubmitProposalBase struct {
	InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `` /* 170-byte string literal not displayed */
	Proposer       types1.AccountID                         `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer" yaml:"proposer"`
}

MsgSubmitProposalBase defines an sdk.Msg type that supports submitting arbitrary proposal Content.

Note, this message type provides the basis for which a true MsgSubmitProposal can be constructed. Since the Content submitted in the message can be arbitrary, assuming it fulfills the Content interface, it must be defined at the application-level and extend MsgSubmitProposalBase.

func NewMsgSubmitProposalBase

func NewMsgSubmitProposalBase(initialDeposit sdk.Coins, proposer chaintype.AccountID) MsgSubmitProposalBase

NewMsgSubmitProposalBase creates a new MsgSubmitProposalBase.

func (*MsgSubmitProposalBase) Descriptor

func (*MsgSubmitProposalBase) Descriptor() ([]byte, []int)

func (*MsgSubmitProposalBase) Equal

func (this *MsgSubmitProposalBase) Equal(that interface{}) bool

func (MsgSubmitProposalBase) GetSignBytes

func (msg MsgSubmitProposalBase) GetSignBytes() []byte

GetSignBytes implements Msg

func (MsgSubmitProposalBase) GetSigners

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

GetSigners implements Msg

func (*MsgSubmitProposalBase) Marshal

func (m *MsgSubmitProposalBase) Marshal() (dAtA []byte, err error)

func (*MsgSubmitProposalBase) MarshalTo

func (m *MsgSubmitProposalBase) MarshalTo(dAtA []byte) (int, error)

func (*MsgSubmitProposalBase) MarshalToSizedBuffer

func (m *MsgSubmitProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgSubmitProposalBase) ProtoMessage

func (*MsgSubmitProposalBase) ProtoMessage()

func (*MsgSubmitProposalBase) Reset

func (m *MsgSubmitProposalBase) Reset()

func (MsgSubmitProposalBase) Route

func (msg MsgSubmitProposalBase) Route() string

Route implements Msg

func (*MsgSubmitProposalBase) Size

func (m *MsgSubmitProposalBase) Size() (n int)

func (MsgSubmitProposalBase) String

func (msg MsgSubmitProposalBase) String() string

String implements the Stringer interface

func (MsgSubmitProposalBase) Type

Type implements Msg

func (*MsgSubmitProposalBase) Unmarshal

func (m *MsgSubmitProposalBase) Unmarshal(dAtA []byte) error

func (MsgSubmitProposalBase) ValidateBasic

func (msg MsgSubmitProposalBase) ValidateBasic() error

ValidateBasic implements Msg

func (*MsgSubmitProposalBase) XXX_DiscardUnknown

func (m *MsgSubmitProposalBase) XXX_DiscardUnknown()

func (*MsgSubmitProposalBase) XXX_Marshal

func (m *MsgSubmitProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgSubmitProposalBase) XXX_Merge

func (m *MsgSubmitProposalBase) XXX_Merge(src proto.Message)

func (*MsgSubmitProposalBase) XXX_Size

func (m *MsgSubmitProposalBase) XXX_Size() int

func (*MsgSubmitProposalBase) XXX_Unmarshal

func (m *MsgSubmitProposalBase) XXX_Unmarshal(b []byte) error

type MsgSubmitProposalI

type MsgSubmitProposalI interface {
	sdk.Msg

	GetContent() Content
	GetInitialDeposit() sdk.Coins
	GetProposer() sdk.AccAddress
	GetProposerAccountID() chaintype.AccountID
}

MsgSubmitProposalI defines the specific interface a concrete message must implement in order to process governance proposals. The concrete MsgSubmitProposal must be defined at the application-level.

type MsgVote

type MsgVote struct {
	ProposalID uint64           `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"`
	Voter      types1.AccountID `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter" yaml:"voter"`
	Option     VoteOption       `protobuf:"varint,3,opt,name=option,proto3,enum=kuchain.x.gov.v1.VoteOption" json:"option,omitempty"`
}

MsgVote defines a message to cast a vote

func NewMsgVote

func NewMsgVote(voter chaintype.AccountID, proposalID uint64, option VoteOption) MsgVote

NewMsgVote creates a message to cast a vote on an active proposal

func (*MsgVote) Descriptor

func (*MsgVote) Descriptor() ([]byte, []int)

func (*MsgVote) Equal

func (this *MsgVote) Equal(that interface{}) bool

func (MsgVote) GetSignBytes

func (msg MsgVote) GetSignBytes() []byte

GetSignBytes implements Msg

func (MsgVote) GetSigners

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

GetSigners implements Msg

func (*MsgVote) Marshal

func (m *MsgVote) Marshal() (dAtA []byte, err error)

func (*MsgVote) MarshalTo

func (m *MsgVote) MarshalTo(dAtA []byte) (int, error)

func (*MsgVote) MarshalToSizedBuffer

func (m *MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgVote) ProtoMessage

func (*MsgVote) ProtoMessage()

func (*MsgVote) Reset

func (m *MsgVote) Reset()

func (MsgVote) Route

func (msg MsgVote) Route() string

Route implements Msg

func (*MsgVote) Size

func (m *MsgVote) Size() (n int)

func (MsgVote) String

func (msg MsgVote) String() string

String implements the Stringer interface

func (MsgVote) Type

func (msg MsgVote) Type() chaintype.Name

Type implements Msg

func (*MsgVote) Unmarshal

func (m *MsgVote) Unmarshal(dAtA []byte) error

func (MsgVote) ValidateBasic

func (msg MsgVote) ValidateBasic() error

ValidateBasic implements Msg

func (*MsgVote) XXX_DiscardUnknown

func (m *MsgVote) XXX_DiscardUnknown()

func (*MsgVote) XXX_Marshal

func (m *MsgVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgVote) XXX_Merge

func (m *MsgVote) XXX_Merge(src proto.Message)

func (*MsgVote) XXX_Size

func (m *MsgVote) XXX_Size() int

func (*MsgVote) XXX_Unmarshal

func (m *MsgVote) XXX_Unmarshal(b []byte) error

type ParamSubspace

type ParamSubspace interface {
	Get(ctx sdk.Context, key []byte, ptr interface{})
	Set(ctx sdk.Context, key []byte, param interface{})
}

ParamSubspace defines the expected Subspace interface for parameters (noalias)

type Params

type Params struct {
	VotingParams  VotingParams  `json:"voting_params" yaml:"voting_params"`
	TallyParams   TallyParams   `json:"tally_params" yaml:"tally_params"`
	DepositParams DepositParams `json:"deposit_params" yaml:"deposit_parmas"`
}

Params returns all of the governance params

func DefaultParams

func DefaultParams() Params

DefaultParams default governance params

func NewParams

func NewParams(vp VotingParams, tp TallyParams, dp DepositParams) Params

NewParams creates a new gov Params instance

func (Params) String

func (gp Params) String() string

type Proposal

type Proposal struct {
	Content `json:"content" yaml:"content"` // Proposal content interface
	ProposalBase
}

Proposal defines a struct used by the governance module to allow for voting on network changes.

func NewProposal

func NewProposal(content Content, id uint64, submitTime, depositEndTime time.Time) Proposal

NewProposal creates a new Proposal instance

func (Proposal) Equal

func (p Proposal) Equal(other Proposal) bool

Equal returns true if two Proposal types are equal.

func (Proposal) String

func (p Proposal) String() string

String implements stringer interface

type ProposalBase

type ProposalBase struct {
	ProposalID       uint64                                   `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"`
	Status           ProposalStatus                           `` /* 126-byte string literal not displayed */
	FinalTallyResult TallyResult                              `` /* 127-byte string literal not displayed */
	SubmitTime       time.Time                                `protobuf:"bytes,4,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time" yaml:"submit_time"`
	DepositEndTime   time.Time                                `` /* 127-byte string literal not displayed */
	TotalDeposit     github_com_cosmos_cosmos_sdk_types.Coins `` /* 162-byte string literal not displayed */
	VotingStartTime  time.Time                                `` /* 131-byte string literal not displayed */
	VotingEndTime    time.Time                                `protobuf:"bytes,8,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time" yaml:"voting_end_time"`
}

ProposalBase defines the core field members of a governance proposal. It includes all static fields (i.e fields excluding the dynamic Content). A full proposal extends the ProposalBase with Content.

func NewProposalBaseFromFace

func NewProposalBaseFromFace(that ProposalBaseFace) *ProposalBase

func (*ProposalBase) Descriptor

func (*ProposalBase) Descriptor() ([]byte, []int)

func (*ProposalBase) Equal

func (this *ProposalBase) Equal(that interface{}) bool

func (*ProposalBase) GetDepositEndTime

func (this *ProposalBase) GetDepositEndTime() time.Time

func (*ProposalBase) GetFinalTallyResult

func (this *ProposalBase) GetFinalTallyResult() TallyResult

func (*ProposalBase) GetProposalID

func (this *ProposalBase) GetProposalID() uint64

func (*ProposalBase) GetStatus

func (this *ProposalBase) GetStatus() ProposalStatus

func (*ProposalBase) GetSubmitTime

func (this *ProposalBase) GetSubmitTime() time.Time

func (*ProposalBase) GetTotalDeposit

func (this *ProposalBase) GetTotalDeposit() github_com_cosmos_cosmos_sdk_types.Coins

func (*ProposalBase) GetVotingEndTime

func (this *ProposalBase) GetVotingEndTime() time.Time

func (*ProposalBase) GetVotingStartTime

func (this *ProposalBase) GetVotingStartTime() time.Time

func (*ProposalBase) Marshal

func (m *ProposalBase) Marshal() (dAtA []byte, err error)

func (*ProposalBase) MarshalTo

func (m *ProposalBase) MarshalTo(dAtA []byte) (int, error)

func (*ProposalBase) MarshalToSizedBuffer

func (m *ProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ProposalBase) Proto

func (*ProposalBase) ProtoMessage

func (*ProposalBase) ProtoMessage()

func (*ProposalBase) Reset

func (m *ProposalBase) Reset()

func (*ProposalBase) Size

func (m *ProposalBase) Size() (n int)

func (*ProposalBase) String

func (m *ProposalBase) String() string

func (*ProposalBase) TestProto

func (*ProposalBase) Unmarshal

func (m *ProposalBase) Unmarshal(dAtA []byte) error

func (*ProposalBase) XXX_DiscardUnknown

func (m *ProposalBase) XXX_DiscardUnknown()

func (*ProposalBase) XXX_Marshal

func (m *ProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ProposalBase) XXX_Merge

func (m *ProposalBase) XXX_Merge(src proto.Message)

func (*ProposalBase) XXX_Size

func (m *ProposalBase) XXX_Size() int

func (*ProposalBase) XXX_Unmarshal

func (m *ProposalBase) XXX_Unmarshal(b []byte) error

type ProposalBaseFace

type ProposalBaseFace interface {
	Proto() github_com_gogo_protobuf_proto.Message
	GetProposalID() uint64
	GetStatus() ProposalStatus
	GetFinalTallyResult() TallyResult
	GetSubmitTime() time.Time
	GetDepositEndTime() time.Time
	GetTotalDeposit() github_com_cosmos_cosmos_sdk_types.Coins
	GetVotingStartTime() time.Time
	GetVotingEndTime() time.Time
}

type ProposalQueue

type ProposalQueue []uint64

ProposalQueue defines a queue for proposal ids

type ProposalStatus

type ProposalStatus int32

ProposalStatus is a type alias that represents a proposal status as a byte

const (
	// PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status.
	StatusNil ProposalStatus = 0
	// PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit period.
	StatusDepositPeriod ProposalStatus = 1
	// PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting period.
	StatusVotingPeriod ProposalStatus = 2
	// PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has passed.
	StatusPassed ProposalStatus = 3
	// PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has been rejected.
	StatusRejected ProposalStatus = 4
	// PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has failed.
	StatusFailed ProposalStatus = 5
)

func ProposalStatusFromString

func ProposalStatusFromString(str string) (ProposalStatus, error)

ProposalStatusFromString turns a string into a ProposalStatus

func (ProposalStatus) EnumDescriptor

func (ProposalStatus) EnumDescriptor() ([]byte, []int)

func (ProposalStatus) Format

func (status ProposalStatus) Format(s fmt.State, verb rune)

Format implements the fmt.Formatter interface. nolint: errcheck

func (ProposalStatus) Marshal

func (status ProposalStatus) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility

func (ProposalStatus) MarshalJSON

func (status ProposalStatus) MarshalJSON() ([]byte, error)

MarshalJSON Marshals to JSON using string representation of the status

func (ProposalStatus) String

func (status ProposalStatus) String() string

String implements the Stringer interface.

func (*ProposalStatus) Unmarshal

func (status *ProposalStatus) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility

func (*ProposalStatus) UnmarshalJSON

func (status *ProposalStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON Unmarshals from JSON assuming Bech32 encoding

type Proposals

type Proposals []Proposal

Proposals is an array of proposal

func (Proposals) Equal

func (p Proposals) Equal(other Proposals) bool

Equal returns true if two slices (order-dependant) of proposals are equal.

func (Proposals) String

func (p Proposals) String() string

String implements stringer interface

type PunishValidator

type PunishValidator struct {
	ValidatorAccount types1.AccountID `protobuf:"bytes,1,opt,name=validator_account,json=validatorAccount,proto3" json:"account_id" yaml:"account_id"`
	// height at which validator was first a candidate OR was unjailed
	StartHeight      int64     `protobuf:"varint,2,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty" yaml:"start_height"`
	JailedUntil      time.Time `protobuf:"bytes,3,opt,name=jailed_until,json=jailedUntil,proto3,stdtime" json:"jailed_until" yaml:"jailed_until"`
	MissedProposalID uint64    `` /* 128-byte string literal not displayed */
}

func NewPunishValidator

func NewPunishValidator(validatorAccount chaintype.AccountID, height int64, untilTime time.Time, proposalID uint64) PunishValidator

func NewPunishValidatorFromFace

func NewPunishValidatorFromFace(that PunishValidatorFace) *PunishValidator

func (*PunishValidator) Descriptor

func (*PunishValidator) Descriptor() ([]byte, []int)

func (*PunishValidator) Equal

func (this *PunishValidator) Equal(that interface{}) bool

func (*PunishValidator) GetJailedUntil

func (this *PunishValidator) GetJailedUntil() time.Time

func (*PunishValidator) GetMissedProposalID

func (this *PunishValidator) GetMissedProposalID() uint64

func (*PunishValidator) GetStartHeight

func (this *PunishValidator) GetStartHeight() int64

func (*PunishValidator) GetValidatorAccount

func (this *PunishValidator) GetValidatorAccount() types1.AccountID

func (*PunishValidator) Marshal

func (m *PunishValidator) Marshal() (dAtA []byte, err error)

func (*PunishValidator) MarshalTo

func (m *PunishValidator) MarshalTo(dAtA []byte) (int, error)

func (*PunishValidator) MarshalToSizedBuffer

func (m *PunishValidator) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PunishValidator) Proto

func (*PunishValidator) ProtoMessage

func (*PunishValidator) ProtoMessage()

func (*PunishValidator) Reset

func (m *PunishValidator) Reset()

func (*PunishValidator) Size

func (m *PunishValidator) Size() (n int)

func (*PunishValidator) String

func (m *PunishValidator) String() string

func (*PunishValidator) TestProto

func (*PunishValidator) Unmarshal

func (m *PunishValidator) Unmarshal(dAtA []byte) error

func (*PunishValidator) XXX_DiscardUnknown

func (m *PunishValidator) XXX_DiscardUnknown()

func (*PunishValidator) XXX_Marshal

func (m *PunishValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PunishValidator) XXX_Merge

func (m *PunishValidator) XXX_Merge(src proto.Message)

func (*PunishValidator) XXX_Size

func (m *PunishValidator) XXX_Size() int

func (*PunishValidator) XXX_Unmarshal

func (m *PunishValidator) XXX_Unmarshal(b []byte) error

type PunishValidatorFace

type PunishValidatorFace interface {
	Proto() github_com_gogo_protobuf_proto.Message
	GetValidatorAccount() types1.AccountID
	GetStartHeight() int64
	GetJailedUntil() time.Time
	GetMissedProposalID() uint64
}

type Punishvalidators

type Punishvalidators []PunishValidator

func (Punishvalidators) Equal

func (p Punishvalidators) Equal(other Punishvalidators) bool

func (Punishvalidators) String

func (v Punishvalidators) String() string

type QueryDepositParams

type QueryDepositParams struct {
	ProposalID uint64
	Depositor  chaintype.AccountID
}

QueryDepositParams params for query 'custom/gov/deposit'

func NewQueryDepositParams

func NewQueryDepositParams(proposalID uint64, depositor chaintype.AccountID) QueryDepositParams

NewQueryDepositParams creates a new instance of QueryDepositParams

type QueryProposalParams

type QueryProposalParams struct {
	ProposalID uint64
}

QueryProposalParams Params for queries: - 'custom/gov/proposal' - 'custom/gov/deposits' - 'custom/gov/tally'

func NewQueryProposalParams

func NewQueryProposalParams(proposalID uint64) QueryProposalParams

NewQueryProposalParams creates a new instance of QueryProposalParams

type QueryProposalVotesParams

type QueryProposalVotesParams struct {
	ProposalID uint64
	Page       int
	Limit      int
}

QueryProposalVotesParams used for queries to 'custom/gov/votes'.

func NewQueryProposalVotesParams

func NewQueryProposalVotesParams(proposalID uint64, page, limit int) QueryProposalVotesParams

NewQueryProposalVotesParams creates new instance of the QueryProposalVotesParams.

type QueryProposalsParams

type QueryProposalsParams struct {
	Page           int
	Limit          int
	Voter          chaintype.AccountID
	Depositor      chaintype.AccountID
	ProposalStatus ProposalStatus
}

QueryProposalsParams Params for query 'custom/gov/proposals'

func NewQueryProposalsParams

func NewQueryProposalsParams(page, limit int, status ProposalStatus, voter chaintype.AccountID, depositor chaintype.AccountID) QueryProposalsParams

NewQueryProposalsParams creates a new instance of QueryProposalsParams

type QueryPunishValidatorParams

type QueryPunishValidatorParams struct {
	ValidatorAccount chaintype.AccountID
}

func NewQueryPunishValidatorParams

func NewQueryPunishValidatorParams(validatorAccount chaintype.AccountID) QueryPunishValidatorParams

type QueryVoteParams

type QueryVoteParams struct {
	ProposalID uint64
	Voter      chaintype.AccountID
}

QueryVoteParams Params for query 'custom/gov/vote'

func NewQueryVoteParams

func NewQueryVoteParams(proposalID uint64, voter chaintype.AccountID) QueryVoteParams

NewQueryVoteParams creates a new instance of QueryVoteParams

type Router

type Router interface {
	AddRoute(r string, h Handler) (rtr Router)
	HasRoute(r string) bool
	GetRoute(path string) (h Handler)
	Seal()
}

Router implements a governance Handler router.

TODO: Use generic router (ref #3976).

func NewRouter

func NewRouter() Router

NewRouter creates a new Router interface instance

type StakingKeeper

type StakingKeeper interface {
	// iterate through bonded validators by operator address, execute func for each validator
	IterateBondedValidatorsByPower(
		sdk.Context, func(index int64, validator external.StakingValidatorI) (stop bool),
	)

	TotalBondedTokens(sdk.Context) sdk.Int // total bonded tokens within the validator set
	IterateDelegations(
		ctx sdk.Context, delegator chaintype.AccountID,
		fn func(index int64, delegation external.StakingDelegationI) (stop bool),
	)

	Validator(sdk.Context, chaintype.AccountID) external.StakingValidatorI
	JailByAccount(ctx sdk.Context, account chaintype.AccountID)
	UnjailByAccount(ctx sdk.Context, account chaintype.AccountID)
	SlashByValidatorAccount(ctx sdk.Context, valAccount chaintype.AccountID, infractionHeight int64, slashFactor sdk.Dec)
}

StakingKeeper expected staking keeper (Validator and Delegator sets) (noalias)

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, name string) external.SupplyModuleAccount

	// TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862
	SetModuleAccount(sdk.Context, external.SupplyModuleAccount)

	ModuleCoinsToPower(ctx sdk.Context, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr chaintype.AccountID, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr chaintype.AccountID, recipientModule string, amt sdk.Coins) error
	BurnCoins(ctx sdk.Context, name chaintype.AccountID, amt sdk.Coins) error
}

SupplyKeeper defines the expected supply keeper for module accounts (noalias)

type TallyParams

type TallyParams struct {
	Quorum          sdk.Dec       `json:"quorum,omitempty" yaml:"quorum,omitempty"`                       //  Minimum percentage of total stake needed to vote for a result to be considered valid
	Threshold       sdk.Dec       `json:"threshold,omitempty" yaml:"threshold,omitempty"`                 //  Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5
	Veto            sdk.Dec       `json:"veto,omitempty" yaml:"veto,omitempty"`                           //  Minimum value of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
	Emergency       sdk.Dec       `json:"emergency,omitempty" yaml:"emergency,omitempty"`                 // Minimum proportion of votes for emergency passage.Initial value: 2/3
	MaxPunishPeriod time.Duration `json:"max_punish_period,omitempty" yaml:"max_punish_period,omitempty"` //  Maximum punish for validator who donot vote for proposal
	SlashFraction   sdk.Dec       `json:"slash_fraction,omitempty" yaml:"slash_fraction,omitempty"`       //  slash fraction for Veto vote to slah validators.Initial value: 1/1000
}

TallyParams defines the params around Tallying votes in governance

func DefaultTallyParams

func DefaultTallyParams() TallyParams

DefaultTallyParams default parameters for tallying

func NewTallyParams

func NewTallyParams(quorum, threshold, veto sdk.Dec, emergency sdk.Dec, punishPeriod time.Duration, slashFraction sdk.Dec) TallyParams

NewTallyParams creates a new TallyParams object

func (TallyParams) Equal

func (tp TallyParams) Equal(other TallyParams) bool

Equal checks equality of TallyParams

func (TallyParams) String

func (tp TallyParams) String() string

String implements stringer insterface

type TallyResult

type TallyResult struct {
	Yes        github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=yes,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"yes"`
	Abstain    github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=abstain,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"abstain"`
	No         github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=no,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"no"`
	NoWithVeto github_com_cosmos_cosmos_sdk_types.Int `` /* 153-byte string literal not displayed */
}

TallyResult defines a standard tally for a proposal

func EmptyTallyResult

func EmptyTallyResult() TallyResult

EmptyTallyResult returns an empty TallyResult.

func NewTallyResult

func NewTallyResult(yes, abstain, no, noWithVeto sdk.Int) TallyResult

NewTallyResult creates a new TallyResult instance

func NewTallyResultFromMap

func NewTallyResultFromMap(results map[VoteOption]sdk.Dec) TallyResult

NewTallyResultFromMap creates a new TallyResult instance from a Option -> Dec map

func (*TallyResult) Descriptor

func (*TallyResult) Descriptor() ([]byte, []int)

func (*TallyResult) Equal

func (this *TallyResult) Equal(that interface{}) bool

func (TallyResult) Equals

func (tr TallyResult) Equals(comp TallyResult) bool

Equals returns if two proposals are equal.

func (*TallyResult) Marshal

func (m *TallyResult) Marshal() (dAtA []byte, err error)

func (*TallyResult) MarshalTo

func (m *TallyResult) MarshalTo(dAtA []byte) (int, error)

func (*TallyResult) MarshalToSizedBuffer

func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TallyResult) ProtoMessage

func (*TallyResult) ProtoMessage()

func (*TallyResult) Reset

func (m *TallyResult) Reset()

func (*TallyResult) Size

func (m *TallyResult) Size() (n int)

func (TallyResult) String

func (tr TallyResult) String() string

String implements stringer interface

func (*TallyResult) Unmarshal

func (m *TallyResult) Unmarshal(dAtA []byte) error

func (*TallyResult) XXX_DiscardUnknown

func (m *TallyResult) XXX_DiscardUnknown()

func (*TallyResult) XXX_Marshal

func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TallyResult) XXX_Merge

func (m *TallyResult) XXX_Merge(src proto.Message)

func (*TallyResult) XXX_Size

func (m *TallyResult) XXX_Size() int

func (*TallyResult) XXX_Unmarshal

func (m *TallyResult) XXX_Unmarshal(b []byte) error

type TextProposal

type TextProposal struct {
	Title       string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
}

TextProposal defines a standard text proposal whose changes need to be manually updated in case of approval

func (*TextProposal) Descriptor

func (*TextProposal) Descriptor() ([]byte, []int)

func (*TextProposal) Equal

func (this *TextProposal) Equal(that interface{}) bool

func (TextProposal) GetDescription

func (tp TextProposal) GetDescription() string

GetDescription returns the proposal description

func (TextProposal) GetTitle

func (tp TextProposal) GetTitle() string

GetTitle returns the proposal title

func (*TextProposal) Marshal

func (m *TextProposal) Marshal() (dAtA []byte, err error)

func (*TextProposal) MarshalTo

func (m *TextProposal) MarshalTo(dAtA []byte) (int, error)

func (*TextProposal) MarshalToSizedBuffer

func (m *TextProposal) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (TextProposal) ProposalRoute

func (tp TextProposal) ProposalRoute() string

ProposalRoute returns the proposal router key

func (TextProposal) ProposalType

func (tp TextProposal) ProposalType() string

ProposalType is "Text"

func (*TextProposal) ProtoMessage

func (*TextProposal) ProtoMessage()

func (*TextProposal) Reset

func (m *TextProposal) Reset()

func (*TextProposal) Size

func (m *TextProposal) Size() (n int)

func (TextProposal) String

func (tp TextProposal) String() string

String implements Stringer interface

func (*TextProposal) Unmarshal

func (m *TextProposal) Unmarshal(dAtA []byte) error

func (TextProposal) ValidateBasic

func (tp TextProposal) ValidateBasic() error

ValidateBasic validates the content's title and description of the proposal

func (*TextProposal) XXX_DiscardUnknown

func (m *TextProposal) XXX_DiscardUnknown()

func (*TextProposal) XXX_Marshal

func (m *TextProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TextProposal) XXX_Merge

func (m *TextProposal) XXX_Merge(src proto.Message)

func (*TextProposal) XXX_Size

func (m *TextProposal) XXX_Size() int

func (*TextProposal) XXX_Unmarshal

func (m *TextProposal) XXX_Unmarshal(b []byte) error

type ValidatorGovInfo

type ValidatorGovInfo struct {
	Address             chaintype.AccountID // address of the validator operator
	BondedTokens        sdk.Int             // Power of a Validator
	DelegatorShares     sdk.Dec             // Total outstanding delegator shares
	DelegatorDeductions sdk.Dec             // Delegator deductions from validator's delegators voting independently
	Vote                VoteOption          // Vote of the validator
}

ValidatorGovInfo used for tallying

func NewValidatorGovInfo

func NewValidatorGovInfo(address chaintype.AccountID, bondedTokens sdk.Int, delegatorShares,
	delegatorDeductions sdk.Dec, vote VoteOption) ValidatorGovInfo

NewValidatorGovInfo creates a ValidatorGovInfo instance

type Vote

type Vote struct {
	ProposalID uint64           `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"`
	Voter      types1.AccountID `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter" yaml:"voter"`
	Option     VoteOption       `protobuf:"varint,3,opt,name=option,proto3,enum=kuchain.x.gov.v1.VoteOption" json:"option,omitempty"`
}

Vote defines a vote on a governance proposal. A vote corresponds to a proposal ID, the voter, and the vote option.

func NewVote

func NewVote(proposalID uint64, voter chaintype.AccountID, option VoteOption) Vote

NewVote creates a new Vote instance

func (*Vote) Descriptor

func (*Vote) Descriptor() ([]byte, []int)

func (Vote) Empty

func (v Vote) Empty() bool

Empty returns whether a vote is empty.

func (*Vote) Equal

func (this *Vote) Equal(that interface{}) bool

func (*Vote) Marshal

func (m *Vote) Marshal() (dAtA []byte, err error)

func (*Vote) MarshalTo

func (m *Vote) MarshalTo(dAtA []byte) (int, error)

func (*Vote) MarshalToSizedBuffer

func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Vote) ProtoMessage

func (*Vote) ProtoMessage()

func (*Vote) Reset

func (m *Vote) Reset()

func (*Vote) Size

func (m *Vote) Size() (n int)

func (Vote) String

func (v Vote) String() string

func (*Vote) Unmarshal

func (m *Vote) Unmarshal(dAtA []byte) error

func (*Vote) XXX_DiscardUnknown

func (m *Vote) XXX_DiscardUnknown()

func (*Vote) XXX_Marshal

func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Vote) XXX_Merge

func (m *Vote) XXX_Merge(src proto.Message)

func (*Vote) XXX_Size

func (m *Vote) XXX_Size() int

func (*Vote) XXX_Unmarshal

func (m *Vote) XXX_Unmarshal(b []byte) error

type VoteOption

type VoteOption int32

VoteOption defines a vote option

const (
	// VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
	OptionEmpty VoteOption = 0
	// VOTE_OPTION_YES defines a yes vote option.
	OptionYes VoteOption = 1
	// VOTE_OPTION_ABSTAIN defines an abstain vote option.
	OptionAbstain VoteOption = 2
	// VOTE_OPTION_NO defines a no vote option.
	OptionNo VoteOption = 3
	// VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option.
	OptionNoWithVeto VoteOption = 4
)

func VoteOptionFromString

func VoteOptionFromString(str string) (VoteOption, error)

VoteOptionFromString returns a VoteOption from a string. It returns an error if the string is invalid.

func (VoteOption) EnumDescriptor

func (VoteOption) EnumDescriptor() ([]byte, []int)

func (VoteOption) Format

func (vo VoteOption) Format(s fmt.State, verb rune)

Format implements the fmt.Formatter interface.

func (VoteOption) Marshal

func (vo VoteOption) Marshal() ([]byte, error)

Marshal needed for protobuf compatibility.

func (VoteOption) MarshalJSON

func (vo VoteOption) MarshalJSON() ([]byte, error)

Marshals to JSON using string.

func (VoteOption) String

func (vo VoteOption) String() string

String implements the Stringer interface.

func (*VoteOption) Unmarshal

func (vo *VoteOption) Unmarshal(data []byte) error

Unmarshal needed for protobuf compatibility.

func (*VoteOption) UnmarshalJSON

func (vo *VoteOption) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes from JSON assuming Bech32 encoding.

type Votes

type Votes []Vote

Votes is a collection of Vote objects

func (Votes) Equal

func (v Votes) Equal(other Votes) bool

Equal returns true if two slices (order-dependant) of votes are equal.

func (Votes) String

func (v Votes) String() string

type VotingParams

type VotingParams struct {
	VotingPeriod time.Duration `json:"voting_period,omitempty" yaml:"voting_period,omitempty"` //  Length of the voting period.
}

VotingParams defines the params around Voting in governance

func DefaultVotingParams

func DefaultVotingParams() VotingParams

DefaultVotingParams default parameters for voting

func NewVotingParams

func NewVotingParams(votingPeriod time.Duration) VotingParams

NewVotingParams creates a new VotingParams object

func (VotingParams) Equal

func (vp VotingParams) Equal(other VotingParams) bool

Equal checks equality of TallyParams

func (VotingParams) String

func (vp VotingParams) String() string

String implements stringer interface

Jump to

Keyboard shortcuts

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