v040

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package v040 is taken from: https://github.com/soominhyunwoo/chain-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/soominhyunwoo/chain-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/soominhyunwoo/chain-sdk/blob/v0.41.0/x/gov/types/keys.go

Package v040 is copy-pasted from: https://github.com/soominhyunwoo/chain-sdk/blob/v0.41.1/x/gov/types/vote.go

Index

Constants

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

View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGov        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGov          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group")
)
View Source
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

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 DepositKey

func DepositKey(proposalID uint64, depositorAddr sdk.AccAddress) []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 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 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

func ProposalKey(proposalID uint64) []byte

ProposalKey gets a specific proposal from the store

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

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

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

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.

func VotesKey

func VotesKey(proposalID uint64) []byte

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

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

func (m *GenesisState) MarshalTo(dAtA []byte) (int, 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=soominhyunwoo.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) Empty

func (v Vote) Empty() bool

Empty returns whether a vote is empty.

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

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

Jump to

Keyboard shortcuts

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