Documentation ¶
Overview ¶
Package v040 is taken from: https://github.com/cosmos/cosmos-sdk/blob/v0.42.1/x/gov/types/genesis.pb.go by copy-pasted only the relevants parts for Genesis. nolint
Package v040 is taken from: https://github.com/cosmos/cosmos-sdk/blob/v0.41.1/x/gov/types/gov.pb.go by copy-pasted only the relevants parts for Vote.
Package v040 is copy-pasted from: https://github.com/cosmos/cosmos-sdk/blob/v0.41.0/x/gov/types/keys.go
Package v040 is copy-pasted from: https://github.com/cosmos/cosmos-sdk/blob/v0.41.1/x/gov/types/vote.go
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 Migrate(oldGovState v036gov.GenesisState) *v040gov.GenesisState
- func ProposalKey(proposalID uint64) []byte
- 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 ValidVoteOption(option types.VoteOption) bool
- func VoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte
- func VoteOptionFromString(str string) (types.VoteOption, error)
- func VotesKey(proposalID uint64) []byte
- type GenesisState
- func (m *GenesisState) GetDepositParams() types.DepositParams
- func (m *GenesisState) GetDeposits() types.Deposits
- func (m *GenesisState) GetProposals() types.Proposals
- func (m *GenesisState) GetStartingProposalId() uint64
- func (m *GenesisState) GetTallyParams() types.TallyParams
- func (m *GenesisState) GetVotes() Votes
- func (m *GenesisState) GetVotingParams() types.VotingParams
- func (m *GenesisState) Marshal() (dAtA []byte, err error)
- func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)
- func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*GenesisState) ProtoMessage()
- func (m *GenesisState) Reset()
- func (m *GenesisState) Size() (n int)
- func (m *GenesisState) String() string
- func (m *GenesisState) Unmarshal(dAtA []byte) error
- type Vote
- func (v Vote) Empty() 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
- type Votes
Constants ¶
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 )
Variables ¶
var ( ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") )
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
Functions ¶
func ActiveProposalByTimeKey ¶ added in v0.43.0
ActiveProposalByTimeKey gets the active proposal queue key by endTime
func ActiveProposalQueueKey ¶ added in v0.43.0
ActiveProposalQueueKey returns the key for a proposalID in the activeProposalQueue
func DepositKey ¶ added in v0.43.0
func DepositKey(proposalID uint64, depositorAddr sdk.AccAddress) []byte
DepositKey key of a specific deposit from the store
func DepositsKey ¶ added in v0.43.0
DepositsKey gets the first part of the deposits key based on the proposalID
func GetProposalIDBytes ¶ added in v0.43.0
GetProposalIDBytes returns the byte representation of the proposalID
func GetProposalIDFromBytes ¶ added in v0.43.0
GetProposalIDFromBytes returns proposalID in uint64 format from a byte array
func InactiveProposalByTimeKey ¶ added in v0.43.0
InactiveProposalByTimeKey gets the inactive proposal queue key by endTime
func InactiveProposalQueueKey ¶ added in v0.43.0
InactiveProposalQueueKey returns the key for a proposalID in the inactiveProposalQueue
func Migrate ¶
func Migrate(oldGovState v036gov.GenesisState) *v040gov.GenesisState
Migrate accepts exported v0.36 x/gov genesis state and migrates it to v0.40 x/gov genesis state. The migration includes:
- Convert vote option & proposal status from byte to enum. - Migrate proposal content to Any. - Convert addresses from bytes to bech32 strings. - Re-encode in v0.40 GenesisState.
func ProposalKey ¶ added in v0.43.0
ProposalKey gets a specific proposal from the store
func SplitActiveProposalQueueKey ¶ added in v0.43.0
SplitActiveProposalQueueKey split the active proposal key and returns the proposal id and endTime
func SplitInactiveProposalQueueKey ¶ added in v0.43.0
SplitInactiveProposalQueueKey split the inactive proposal key and returns the proposal id and endTime
func SplitKeyDeposit ¶ added in v0.43.0
func SplitKeyDeposit(key []byte) (proposalID uint64, depositorAddr sdk.AccAddress)
SplitKeyDeposit split the deposits key and returns the proposal id and depositor address
func SplitKeyVote ¶ added in v0.43.0
func SplitKeyVote(key []byte) (proposalID uint64, voterAddr sdk.AccAddress)
SplitKeyVote split the votes key and returns the proposal id and voter address
func SplitProposalKey ¶ added in v0.43.0
SplitProposalKey split the proposal key and returns the proposal id
func ValidVoteOption ¶
func ValidVoteOption(option types.VoteOption) bool
ValidVoteOption returns true if the vote option is valid and false otherwise.
func VoteKey ¶ added in v0.43.0
func VoteKey(proposalID uint64, voterAddr sdk.AccAddress) []byte
VoteKey key of a specific vote from the store
func VoteOptionFromString ¶
func VoteOptionFromString(str string) (types.VoteOption, error)
VoteOptionFromString returns a VoteOption from a string. It returns an error if the string is invalid.
Types ¶
type GenesisState ¶
type GenesisState struct { // starting_proposal_id is the ID of the starting proposal. StartingProposalId uint64 `` /* 146-byte string literal not displayed */ // deposits defines all the deposits present at genesis. Deposits types.Deposits `protobuf:"bytes,2,rep,name=deposits,proto3,castrepeated=Deposits" json:"deposits"` // votes defines all the votes present at genesis. Votes Votes `protobuf:"bytes,3,rep,name=votes,proto3,castrepeated=Votes" json:"votes"` // proposals defines all the proposals present at genesis. Proposals types.Proposals `protobuf:"bytes,4,rep,name=proposals,proto3,castrepeated=Proposals" json:"proposals"` // params defines all the paramaters of related to deposit. DepositParams types.DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params" yaml:"deposit_params"` // params defines all the paramaters of related to voting. VotingParams types.VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params" yaml:"voting_params"` // params defines all the paramaters of related to tally. TallyParams types.TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params" yaml:"tally_params"` }
GenesisState defines the gov module's genesis state.
func (*GenesisState) GetDepositParams ¶
func (m *GenesisState) GetDepositParams() types.DepositParams
func (*GenesisState) GetDeposits ¶
func (m *GenesisState) GetDeposits() types.Deposits
func (*GenesisState) GetProposals ¶
func (m *GenesisState) GetProposals() types.Proposals
func (*GenesisState) GetStartingProposalId ¶
func (m *GenesisState) GetStartingProposalId() uint64
func (*GenesisState) GetTallyParams ¶
func (m *GenesisState) GetTallyParams() types.TallyParams
func (*GenesisState) GetVotes ¶
func (m *GenesisState) GetVotes() Votes
func (*GenesisState) GetVotingParams ¶
func (m *GenesisState) GetVotingParams() types.VotingParams
func (*GenesisState) Marshal ¶
func (m *GenesisState) Marshal() (dAtA []byte, err error)
func (*GenesisState) MarshalToSizedBuffer ¶
func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*GenesisState) ProtoMessage ¶
func (*GenesisState) ProtoMessage()
func (*GenesisState) Reset ¶
func (m *GenesisState) Reset()
func (*GenesisState) Size ¶
func (m *GenesisState) Size() (n int)
func (*GenesisState) String ¶
func (m *GenesisState) String() string
func (*GenesisState) Unmarshal ¶
func (m *GenesisState) Unmarshal(dAtA []byte) error
type Vote ¶
type Vote struct { ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty" yaml:"proposal_id"` //nolint:golint Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` Option types.VoteOption `protobuf:"varint,3,opt,name=option,proto3,enum=cosmos.gov.v1beta1.VoteOption" json:"option,omitempty"` }
func NewVote ¶
func NewVote(proposalID uint64, voter sdk.AccAddress, option types.VoteOption) Vote
NewVote creates a new Vote instance
func (*Vote) ProtoMessage ¶
func (*Vote) ProtoMessage()