Documentation
¶
Index ¶
- Constants
- Variables
- func ActiveProposalByTimeKey(endTime time.Time) []byte
- func ActiveProposalQueueKey(proposalID uint64, endTime time.Time) []byte
- func DepositKey(proposalID uint64, depositorAddr sdk.AccAddress) []byte
- func DepositsKey(proposalID uint64) []byte
- func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte)
- func GetProposalIDFromBytes(bz []byte) (proposalID uint64)
- func InactiveProposalByTimeKey(endTime time.Time) []byte
- func InactiveProposalQueueKey(proposalID uint64, endTime time.Time) []byte
- func IsValidProposalType(ty string) bool
- func ParamKeyTable() paramtypes.KeyTable
- func ProposalHandler(_ sdk.Context, c Content) error
- func ProposalKey(proposalID uint64) []byte
- func RegisterCodec(cdc *codec.Codec)
- func RegisterProposalType(ty string)
- func RegisterProposalTypeCodec(o interface{}, name string)
- func SplitActiveProposalQueueKey(key []byte) (proposalID uint64, endTime time.Time)
- func SplitInactiveProposalQueueKey(key []byte) (proposalID uint64, endTime time.Time)
- func SplitKeyDeposit(key []byte) (proposalID uint64, depositorAddr sdk.AccAddress)
- func SplitKeyVote(key []byte) (proposalID uint64, voterAddr sdk.AccAddress)
- func SplitProposalKey(key []byte) (proposalID uint64)
- func ValidProposalStatus(status ProposalStatus) bool
- func ValidVoteOption(option VoteOption) bool
- func ValidateAbstract(c Content) error
- func ValidateGenesis(data GenesisState) error
- func VoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte
- func VotesKey(proposalID uint64) []byte
- type AccountKeeper
- type BankKeeper
- type Codec
- type Content
- type Deposit
- func (*Deposit) Descriptor() ([]byte, []int)
- func (d Deposit) Empty() bool
- func (this *Deposit) Equal(that interface{}) bool
- func (m *Deposit) Marshal() (dAtA []byte, err error)
- func (m *Deposit) MarshalTo(dAtA []byte) (int, error)
- func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Deposit) ProtoMessage()
- func (m *Deposit) Reset()
- func (m *Deposit) Size() (n int)
- func (d Deposit) String() string
- func (m *Deposit) Unmarshal(dAtA []byte) error
- func (m *Deposit) XXX_DiscardUnknown()
- func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Deposit) XXX_Merge(src proto.Message)
- func (m *Deposit) XXX_Size() int
- func (m *Deposit) XXX_Unmarshal(b []byte) error
- type DepositParams
- type Deposits
- type GenesisState
- type Handler
- type MsgDeposit
- func (*MsgDeposit) Descriptor() ([]byte, []int)
- func (this *MsgDeposit) Equal(that interface{}) bool
- func (msg MsgDeposit) GetSignBytes() []byte
- func (msg MsgDeposit) GetSigners() []sdk.AccAddress
- func (m *MsgDeposit) Marshal() (dAtA []byte, err error)
- func (m *MsgDeposit) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgDeposit) ProtoMessage()
- func (m *MsgDeposit) Reset()
- func (msg MsgDeposit) Route() string
- func (m *MsgDeposit) Size() (n int)
- func (msg MsgDeposit) String() string
- func (msg MsgDeposit) Type() string
- func (m *MsgDeposit) Unmarshal(dAtA []byte) error
- func (msg MsgDeposit) ValidateBasic() error
- func (m *MsgDeposit) XXX_DiscardUnknown()
- func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgDeposit) XXX_Merge(src proto.Message)
- func (m *MsgDeposit) XXX_Size() int
- func (m *MsgDeposit) XXX_Unmarshal(b []byte) error
- type MsgSubmitProposal
- func (msg MsgSubmitProposal) GetContent() Content
- func (msg MsgSubmitProposal) GetInitialDeposit() sdk.Coins
- func (msg MsgSubmitProposal) GetProposer() sdk.AccAddress
- func (msg MsgSubmitProposal) GetSignBytes() []byte
- func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress
- func (msg MsgSubmitProposal) Route() string
- func (msg *MsgSubmitProposal) SetContent(content Content) error
- func (msg *MsgSubmitProposal) SetInitialDeposit(deposit sdk.Coins)
- func (msg *MsgSubmitProposal) SetProposer(proposer sdk.AccAddress)
- func (msg MsgSubmitProposal) Type() string
- func (msg MsgSubmitProposal) ValidateBasic() error
- type MsgSubmitProposalBase
- func (*MsgSubmitProposalBase) Descriptor() ([]byte, []int)
- func (this *MsgSubmitProposalBase) Equal(that interface{}) bool
- func (msg *MsgSubmitProposalBase) GetInitialDeposit() sdk.Coins
- func (msg *MsgSubmitProposalBase) GetProposer() sdk.AccAddress
- func (msg MsgSubmitProposalBase) GetSignBytes() []byte
- func (msg MsgSubmitProposalBase) GetSigners() []sdk.AccAddress
- func (m *MsgSubmitProposalBase) Marshal() (dAtA []byte, err error)
- func (m *MsgSubmitProposalBase) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgSubmitProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgSubmitProposalBase) ProtoMessage()
- func (m *MsgSubmitProposalBase) Reset()
- func (msg MsgSubmitProposalBase) Route() string
- func (msg *MsgSubmitProposalBase) SetInitialDeposit(coins sdk.Coins)
- func (msg *MsgSubmitProposalBase) SetProposer(address sdk.AccAddress)
- func (m *MsgSubmitProposalBase) Size() (n int)
- func (msg MsgSubmitProposalBase) String() string
- func (msg MsgSubmitProposalBase) Type() string
- func (m *MsgSubmitProposalBase) Unmarshal(dAtA []byte) error
- func (msg MsgSubmitProposalBase) ValidateBasic() error
- func (m *MsgSubmitProposalBase) XXX_DiscardUnknown()
- func (m *MsgSubmitProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgSubmitProposalBase) XXX_Merge(src proto.Message)
- func (m *MsgSubmitProposalBase) XXX_Size() int
- func (m *MsgSubmitProposalBase) XXX_Unmarshal(b []byte) error
- type MsgSubmitProposalI
- type MsgVote
- func (*MsgVote) Descriptor() ([]byte, []int)
- func (this *MsgVote) Equal(that interface{}) bool
- func (msg MsgVote) GetSignBytes() []byte
- func (msg MsgVote) GetSigners() []sdk.AccAddress
- func (m *MsgVote) Marshal() (dAtA []byte, err error)
- func (m *MsgVote) MarshalTo(dAtA []byte) (int, error)
- func (m *MsgVote) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MsgVote) ProtoMessage()
- func (m *MsgVote) Reset()
- func (msg MsgVote) Route() string
- func (m *MsgVote) Size() (n int)
- func (msg MsgVote) String() string
- func (msg MsgVote) Type() string
- func (m *MsgVote) Unmarshal(dAtA []byte) error
- func (msg MsgVote) ValidateBasic() error
- func (m *MsgVote) XXX_DiscardUnknown()
- func (m *MsgVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MsgVote) XXX_Merge(src proto.Message)
- func (m *MsgVote) XXX_Size() int
- func (m *MsgVote) XXX_Unmarshal(b []byte) error
- type ParamSubspace
- type Params
- type Proposal
- type ProposalBase
- func (*ProposalBase) Descriptor() ([]byte, []int)
- func (this *ProposalBase) Equal(that interface{}) bool
- func (this *ProposalBase) GetDepositEndTime() time.Time
- func (this *ProposalBase) GetFinalTallyResult() TallyResult
- func (this *ProposalBase) GetProposalID() uint64
- func (this *ProposalBase) GetStatus() ProposalStatus
- func (this *ProposalBase) GetSubmitTime() time.Time
- func (this *ProposalBase) GetTotalDeposit() github_com_cosmos_cosmos_sdk_types.Coins
- func (this *ProposalBase) GetVotingEndTime() time.Time
- func (this *ProposalBase) GetVotingStartTime() time.Time
- func (m *ProposalBase) Marshal() (dAtA []byte, err error)
- func (m *ProposalBase) MarshalTo(dAtA []byte) (int, error)
- func (m *ProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (this *ProposalBase) Proto() github_com_gogo_protobuf_proto.Message
- func (*ProposalBase) ProtoMessage()
- func (m *ProposalBase) Reset()
- func (m *ProposalBase) Size() (n int)
- func (m *ProposalBase) String() string
- func (this *ProposalBase) TestProto() github_com_gogo_protobuf_proto.Message
- func (m *ProposalBase) Unmarshal(dAtA []byte) error
- func (m *ProposalBase) XXX_DiscardUnknown()
- func (m *ProposalBase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ProposalBase) XXX_Merge(src proto.Message)
- func (m *ProposalBase) XXX_Size() int
- func (m *ProposalBase) XXX_Unmarshal(b []byte) error
- type ProposalBaseFace
- type ProposalQueue
- type ProposalStatus
- func (ProposalStatus) EnumDescriptor() ([]byte, []int)
- func (status ProposalStatus) Format(s fmt.State, verb rune)
- func (status ProposalStatus) Marshal() ([]byte, error)
- func (status ProposalStatus) MarshalJSON() ([]byte, error)
- func (status ProposalStatus) String() string
- func (status *ProposalStatus) Unmarshal(data []byte) error
- func (status *ProposalStatus) UnmarshalJSON(data []byte) error
- type Proposals
- type QueryDepositParams
- type QueryProposalParams
- type QueryProposalVotesParams
- type QueryProposalsParams
- type QueryVoteParams
- type Router
- type StakingKeeper
- type TallyParams
- type TallyResult
- func (*TallyResult) Descriptor() ([]byte, []int)
- func (this *TallyResult) Equal(that interface{}) bool
- func (tr TallyResult) Equals(comp TallyResult) bool
- func (m *TallyResult) Marshal() (dAtA []byte, err error)
- func (m *TallyResult) MarshalTo(dAtA []byte) (int, error)
- func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TallyResult) ProtoMessage()
- func (m *TallyResult) Reset()
- func (m *TallyResult) Size() (n int)
- func (tr TallyResult) String() string
- func (m *TallyResult) Unmarshal(dAtA []byte) error
- func (m *TallyResult) XXX_DiscardUnknown()
- func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TallyResult) XXX_Merge(src proto.Message)
- func (m *TallyResult) XXX_Size() int
- func (m *TallyResult) XXX_Unmarshal(b []byte) error
- type TextProposal
- func (*TextProposal) Descriptor() ([]byte, []int)
- func (this *TextProposal) Equal(that interface{}) bool
- func (tp *TextProposal) GetDescription() string
- func (tp *TextProposal) GetTitle() string
- func (m *TextProposal) Marshal() (dAtA []byte, err error)
- func (m *TextProposal) MarshalTo(dAtA []byte) (int, error)
- func (m *TextProposal) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (tp *TextProposal) ProposalRoute() string
- func (tp *TextProposal) ProposalType() string
- func (*TextProposal) ProtoMessage()
- func (m *TextProposal) Reset()
- func (m *TextProposal) Size() (n int)
- func (tp TextProposal) String() string
- func (m *TextProposal) Unmarshal(dAtA []byte) error
- func (tp *TextProposal) ValidateBasic() error
- func (m *TextProposal) XXX_DiscardUnknown()
- func (m *TextProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TextProposal) XXX_Merge(src proto.Message)
- func (m *TextProposal) XXX_Size() int
- func (m *TextProposal) XXX_Unmarshal(b []byte) error
- type ValidatorGovInfo
- type Vote
- func (*Vote) Descriptor() ([]byte, []int)
- func (v Vote) Empty() bool
- func (this *Vote) Equal(that interface{}) bool
- func (m *Vote) Marshal() (dAtA []byte, err error)
- func (m *Vote) MarshalTo(dAtA []byte) (int, error)
- func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Vote) ProtoMessage()
- func (m *Vote) Reset()
- func (m *Vote) Size() (n int)
- func (v Vote) String() string
- func (m *Vote) Unmarshal(dAtA []byte) error
- func (m *Vote) XXX_DiscardUnknown()
- func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Vote) XXX_Merge(src proto.Message)
- func (m *Vote) XXX_Size() int
- func (m *Vote) XXX_Unmarshal(b []byte) error
- type VoteOption
- func (VoteOption) EnumDescriptor() ([]byte, []int)
- func (vo VoteOption) Format(s fmt.State, verb rune)
- func (vo VoteOption) Marshal() ([]byte, error)
- func (vo VoteOption) MarshalJSON() ([]byte, error)
- func (vo VoteOption) String() string
- func (vo *VoteOption) Unmarshal(data []byte) error
- func (vo *VoteOption) UnmarshalJSON(data []byte) error
- type Votes
- type VotingParams
Constants ¶
const ( MaxDescriptionLength int = 5000 MaxTitleLength int = 140 )
Constants pertaining to a Content object
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
const ( // ModuleName is the name of the module ModuleName = "gov" // 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 )
const ( TypeMsgDeposit = "deposit" TypeMsgVote = "vote" TypeMsgSubmitProposal = "submit_proposal" )
Governance message types and routes
const ( QueryParams = "params" QueryProposals = "proposals" QueryProposal = "proposal" QueryDeposits = "deposits" QueryDeposit = "deposit" QueryVotes = "votes" QueryVote = "vote" QueryTally = "tally" ParamDeposit = "deposit" ParamVoting = "voting" ParamTallying = "tallying" )
query endpoints supported by the governance Querier
const (
DefaultPeriod time.Duration = time.Hour * 24 * 2 // 2 days
)
Default period for deposits & voting
const DefaultStartingProposalID uint64 = 1
DefaultStartingProposalID is 1
const (
ProposalTypeText string = "Text"
)
Proposal types
Variables ¶
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") )
x/gov module sentinel errors
var ( ProposalsKeyPrefix = []byte{0x00} ActiveProposalQueuePrefix = []byte{0x01} InactiveProposalQueuePrefix = []byte{0x02} ProposalIDKey = []byte{0x03} DepositsKeyPrefix = []byte{0x10} VotesKeyPrefix = []byte{0x20} )
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
var ( DefaultMinDepositTokens = sdk.TokensFromConsensusPower(10) DefaultQuorum = sdk.NewDecWithPrec(334, 3) DefaultThreshold = sdk.NewDecWithPrec(5, 1) DefaultVeto = sdk.NewDecWithPrec(334, 3) )
Default governance params
var ( ParamStoreKeyDepositParams = []byte("depositparams") ParamStoreKeyVotingParams = []byte("votingparams") ParamStoreKeyTallyParams = []byte("tallyparams") )
Parameter store key
var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") )
var ( // 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, types.NewInterfaceRegistry()) )
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",
}
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,
}
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",
}
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 ¶
ActiveProposalByTimeKey gets the active proposal queue key by endTime
func ActiveProposalQueueKey ¶
ActiveProposalQueueKey returns the key for a proposalID in the activeProposalQueue
func DepositKey ¶
func DepositKey(proposalID uint64, depositorAddr sdk.AccAddress) []byte
DepositKey key of a specific deposit from the store
func DepositsKey ¶
DepositsKey gets the first part of the deposits key based on the proposalID
func GetProposalIDBytes ¶
GetProposalIDBytes returns the byte representation of the proposalID
func GetProposalIDFromBytes ¶
GetProposalIDFromBytes returns proposalID in uint64 format from a byte array
func InactiveProposalByTimeKey ¶
InactiveProposalByTimeKey gets the inactive proposal queue key by endTime
func InactiveProposalQueueKey ¶
InactiveProposalQueueKey returns the key for a proposalID in the inactiveProposalQueue
func IsValidProposalType ¶
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 ¶
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 ¶
ProposalKey gets a specific proposal from the store
func RegisterCodec ¶
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 ¶
SplitActiveProposalQueueKey split the active proposal key and returns the proposal id and endTime
func SplitInactiveProposalQueueKey ¶
SplitInactiveProposalQueueKey split the inactive proposal key and returns the proposal id and endTime
func SplitKeyDeposit ¶
func SplitKeyDeposit(key []byte) (proposalID uint64, depositorAddr sdk.AccAddress)
SplitKeyDeposit split the deposits key and returns the proposal id and depositor address
func SplitKeyVote ¶
func SplitKeyVote(key []byte) (proposalID uint64, voterAddr sdk.AccAddress)
SplitKeyVote split the votes key and returns the proposal id and voter address
func SplitProposalKey ¶
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 ¶
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
Types ¶
type AccountKeeper ¶
type AccountKeeper interface { GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, name string) authexported.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, authexported.ModuleAccountI) }
AccountKeeper defines the expected account keeper (noalias)
type BankKeeper ¶
type BankKeeper interface { GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin SetBalances(ctx sdk.Context, addr sdk.AccAddress, balances sdk.Coins) error LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error }
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. TODO Try to unify this interface with types/module/simulation https://github.com/cosmos/cosmos-sdk/issues/5853
func ContentFromProposalType ¶
ContentFromProposalType returns a Content object based on the proposal type.
func NewTextProposal ¶
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 github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 126-byte string literal not displayed */ 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 ¶
NewDeposit creates a new Deposit instance
func (*Deposit) Descriptor ¶
func (*Deposit) MarshalToSizedBuffer ¶
func (*Deposit) ProtoMessage ¶
func (*Deposit) ProtoMessage()
func (*Deposit) XXX_DiscardUnknown ¶
func (m *Deposit) XXX_DiscardUnknown()
func (*Deposit) XXX_Marshal ¶
func (*Deposit) XXX_Unmarshal ¶
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
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 ¶
Handler defines a function that handles a proposal after it has passed the governance process.
type MsgDeposit ¶
type MsgDeposit struct { ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id" yaml:"proposal_id"` Depositor github_com_cosmos_cosmos_sdk_types.AccAddress `` /* 126-byte string literal not displayed */ 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 sdk.AccAddress, 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) MarshalToSizedBuffer ¶
func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*MsgDeposit) ProtoMessage ¶
func (*MsgDeposit) ProtoMessage()
func (*MsgDeposit) Reset ¶
func (m *MsgDeposit) Reset()
func (*MsgDeposit) Size ¶
func (m *MsgDeposit) Size() (n int)
func (MsgDeposit) String ¶
func (msg MsgDeposit) String() string
String implements the Stringer interface
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 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 sdk.AccAddress `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 sdk.AccAddress) *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) GetSignBytes ¶
func (msg MsgSubmitProposal) GetSignBytes() []byte
GetSignBytes implements Msg
func (MsgSubmitProposal) GetSigners ¶
func (msg MsgSubmitProposal) GetSigners() []sdk.AccAddress
func (MsgSubmitProposal) Route ¶
func (msg MsgSubmitProposal) Route() string
func (*MsgSubmitProposal) SetContent ¶
func (msg *MsgSubmitProposal) SetContent(content Content) error
func (*MsgSubmitProposal) SetInitialDeposit ¶
func (msg *MsgSubmitProposal) SetInitialDeposit(deposit sdk.Coins)
func (*MsgSubmitProposal) SetProposer ¶
func (msg *MsgSubmitProposal) SetProposer(proposer sdk.AccAddress)
func (MsgSubmitProposal) Type ¶
func (msg MsgSubmitProposal) Type() string
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 github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=proposer,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"proposer,omitempty"` }
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 sdk.AccAddress) 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) GetInitialDeposit ¶
func (msg *MsgSubmitProposalBase) GetInitialDeposit() sdk.Coins
func (*MsgSubmitProposalBase) GetProposer ¶
func (msg *MsgSubmitProposalBase) GetProposer() sdk.AccAddress
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) SetInitialDeposit ¶
func (msg *MsgSubmitProposalBase) SetInitialDeposit(coins sdk.Coins)
func (*MsgSubmitProposalBase) SetProposer ¶
func (msg *MsgSubmitProposalBase) SetProposer(address sdk.AccAddress)
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 ¶
func (msg MsgSubmitProposalBase) Type() string
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 SetContent(Content) error GetInitialDeposit() sdk.Coins SetInitialDeposit(sdk.Coins) GetProposer() sdk.AccAddress SetProposer(sdk.AccAddress) }
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 github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=voter,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"voter,omitempty"` Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos_sdk.x.gov.v1.VoteOption" json:"option,omitempty"` }
MsgVote defines a message to cast a vote
func NewMsgVote ¶
func NewMsgVote(voter sdk.AccAddress, proposalID uint64, option VoteOption) MsgVote
NewMsgVote creates a message to cast a vote on an active proposal
func (*MsgVote) Descriptor ¶
func (MsgVote) GetSigners ¶
func (msg MsgVote) GetSigners() []sdk.AccAddress
GetSigners implements Msg
func (*MsgVote) MarshalToSizedBuffer ¶
func (*MsgVote) ProtoMessage ¶
func (*MsgVote) ProtoMessage()
func (MsgVote) ValidateBasic ¶
ValidateBasic implements Msg
func (*MsgVote) XXX_DiscardUnknown ¶
func (m *MsgVote) XXX_DiscardUnknown()
func (*MsgVote) XXX_Marshal ¶
func (*MsgVote) XXX_Unmarshal ¶
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 NewParams ¶
func NewParams(vp VotingParams, tp TallyParams, dp DepositParams) Params
NewParams creates a new gov Params instance
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 ¶
NewProposal creates a new Proposal instance
type ProposalBase ¶
type ProposalBase struct { ProposalID uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"id" yaml:"id"` Status ProposalStatus `` /* 129-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) MarshalToSizedBuffer ¶
func (m *ProposalBase) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ProposalBase) Proto ¶
func (this *ProposalBase) Proto() github_com_gogo_protobuf_proto.Message
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 (this *ProposalBase) TestProto() github_com_gogo_protobuf_proto.Message
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 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
type QueryDepositParams ¶
type QueryDepositParams struct { ProposalID uint64 Depositor sdk.AccAddress }
QueryDepositParams params for query 'custom/gov/deposit'
func NewQueryDepositParams ¶
func NewQueryDepositParams(proposalID uint64, depositor sdk.AccAddress) 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 ¶
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 sdk.AccAddress Depositor sdk.AccAddress ProposalStatus ProposalStatus }
QueryProposalsParams Params for query 'custom/gov/proposals'
func NewQueryProposalsParams ¶
func NewQueryProposalsParams(page, limit int, status ProposalStatus, voter, depositor sdk.AccAddress) QueryProposalsParams
NewQueryProposalsParams creates a new instance of QueryProposalsParams
type QueryVoteParams ¶
type QueryVoteParams struct { ProposalID uint64 Voter sdk.AccAddress }
QueryVoteParams Params for query 'custom/gov/vote'
func NewQueryVoteParams ¶
func NewQueryVoteParams(proposalID uint64, voter sdk.AccAddress) 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).
type StakingKeeper ¶
type StakingKeeper interface { // iterate through bonded validators by operator address, execute func for each validator IterateBondedValidatorsByPower( sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool), ) TotalBondedTokens(sdk.Context) sdk.Int // total bonded tokens within the validator set IterateDelegations( ctx sdk.Context, delegator sdk.AccAddress, fn func(index int64, delegation stakingexported.DelegationI) (stop bool), ) }
StakingKeeper expected staking keeper (Validator and Delegator sets) (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 }
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) 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) 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) 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 sdk.ValAddress // address of the validator operator BondedTokens sdk.Int // Power of a Validator 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 sdk.ValAddress, 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 github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=voter,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"voter,omitempty"` Option VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos_sdk.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 sdk.AccAddress, option VoteOption) Vote
NewVote creates a new Vote instance
func (*Vote) Descriptor ¶
func (*Vote) ProtoMessage ¶
func (*Vote) ProtoMessage()
func (*Vote) XXX_DiscardUnknown ¶
func (m *Vote) XXX_DiscardUnknown()
func (*Vote) XXX_Unmarshal ¶
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
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