Documentation ¶
Index ¶
- func NewQuerier(keeper Keeper) sdk.Querier
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func ValidCommitteesInvariant(k Keeper) sdk.Invariant
- func ValidProposalsInvariant(k Keeper) sdk.Invariant
- func ValidVotesInvariant(k Keeper) sdk.Invariant
- type Keeper
- func (k Keeper) AddVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress) error
- func (k Keeper) CloseExpiredProposals(ctx sdk.Context)
- func (k Keeper) DeleteCommittee(ctx sdk.Context, committeeID uint64)
- func (k Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)
- func (k Keeper) DeleteProposalAndVotes(ctx sdk.Context, proposalID uint64)
- func (k Keeper) DeleteVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress)
- func (k Keeper) EnactPassedProposals(ctx sdk.Context)
- func (k Keeper) EnactProposal(ctx sdk.Context, proposal types.Proposal) error
- func (k Keeper) GetCommittee(ctx sdk.Context, committeeID uint64) (types.Committee, bool)
- func (k Keeper) GetCommittees(ctx sdk.Context) []types.Committee
- func (k Keeper) GetNextProposalID(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Proposal, bool)
- func (k Keeper) GetProposalResult(ctx sdk.Context, proposalID uint64) (bool, error)
- func (k Keeper) GetProposals(ctx sdk.Context) []types.Proposal
- func (k Keeper) GetProposalsByCommittee(ctx sdk.Context, committeeID uint64) []types.Proposal
- func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress) (types.Vote, bool)
- func (k Keeper) GetVotes(ctx sdk.Context) []types.Vote
- func (k Keeper) GetVotesByProposal(ctx sdk.Context, proposalID uint64) []types.Vote
- func (k Keeper) IncrementNextProposalID(ctx sdk.Context) error
- func (k Keeper) IterateCommittees(ctx sdk.Context, cb func(committee types.Committee) (stop bool))
- func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))
- func (k Keeper) IterateVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))
- func (k Keeper) SetCommittee(ctx sdk.Context, committee types.Committee)
- func (k Keeper) SetNextProposalID(ctx sdk.Context, id uint64)
- func (k Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal)
- func (k Keeper) SetVote(ctx sdk.Context, vote types.Vote)
- func (k Keeper) StoreNewProposal(ctx sdk.Context, pubProposal types.PubProposal, committeeID uint64, ...) (uint64, error)
- func (k Keeper) SubmitProposal(ctx sdk.Context, proposer sdk.AccAddress, committeeID uint64, ...) (uint64, error)
- func (k Keeper) TallyVotes(ctx sdk.Context, proposalID uint64) int64
- func (k Keeper) ValidatePubProposal(ctx sdk.Context, pubProposal types.PubProposal) (returnErr error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewQuerier ¶
NewQuerier creates a new gov Querier instance
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all committee invariants
func ValidCommitteesInvariant ¶
ValidCommitteesInvariant verifies that all committees in the store are independently valid
func ValidProposalsInvariant ¶
ValidProposalsInvariant verifies that all proposals in the store are valid
func ValidVotesInvariant ¶
ValidVotesInvariant verifies that all votes in the store are valid
Types ¶
type Keeper ¶
type Keeper struct { ParamKeeper types.ParamKeeper // TODO ideally don't export, only sims need it exported // contains filtered or unexported fields }
func (Keeper) CloseExpiredProposals ¶
CloseExpiredProposals removes proposals (and associated votes) that have past their deadline.
func (Keeper) DeleteCommittee ¶
DeleteCommittee removes a committee from the store.
func (Keeper) DeleteProposal ¶
DeleteProposal removes a proposal from the store.
func (Keeper) DeleteProposalAndVotes ¶
DeleteProposalAndVotes removes a proposal and its associated votes.
func (Keeper) DeleteVote ¶
DeleteVote removes a Vote from the store.
func (Keeper) EnactPassedProposals ¶
EnactPassedProposals puts in place the changes proposed in any proposal that has enough votes
func (Keeper) EnactProposal ¶
EnactProposal makes the changes proposed in a proposal.
func (Keeper) GetCommittee ¶
GetCommittee gets a committee from the store.
func (Keeper) GetCommittees ¶
GetCommittees returns all stored committees.
func (Keeper) GetNextProposalID ¶
GetNextProposalID reads the next available global ID from store
func (Keeper) GetProposal ¶
GetProposal gets a proposal from the store.
func (Keeper) GetProposalResult ¶
GetProposalResult calculates if a proposal currently has enough votes to pass.
func (Keeper) GetProposals ¶
GetProposals returns all stored proposals.
func (Keeper) GetProposalsByCommittee ¶
GetProposalsByCommittee returns all proposals for one committee.
func (Keeper) GetVote ¶
func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress) (types.Vote, bool)
GetVote gets a vote from the store.
func (Keeper) GetVotesByProposal ¶
GetVotesByProposal returns all votes for one proposal.
func (Keeper) IncrementNextProposalID ¶
IncrementNextProposalID increments the next proposal ID in the store by 1.
func (Keeper) IterateCommittees ¶
IterateCommittees provides an iterator over all stored committees. For each committee, cb will be called. If cb returns true, the iterator will close and stop.
func (Keeper) IterateProposals ¶
IterateProposals provides an iterator over all stored proposals. For each proposal, cb will be called. If cb returns true, the iterator will close and stop.
func (Keeper) IterateVotes ¶
IterateVotes provides an iterator over all stored votes. For each vote, cb will be called. If cb returns true, the iterator will close and stop.
func (Keeper) SetCommittee ¶
SetCommittee puts a committee into the store.
func (Keeper) SetNextProposalID ¶
SetNextProposalID stores an ID to be used for the next created proposal
func (Keeper) SetProposal ¶
SetProposal puts a proposal into the store.
func (Keeper) StoreNewProposal ¶
func (k Keeper) StoreNewProposal(ctx sdk.Context, pubProposal types.PubProposal, committeeID uint64, deadline time.Time) (uint64, error)
StoreNewProposal stores a proposal, adding a new ID
func (Keeper) SubmitProposal ¶
func (k Keeper) SubmitProposal(ctx sdk.Context, proposer sdk.AccAddress, committeeID uint64, pubProposal types.PubProposal) (uint64, error)
SubmitProposal adds a proposal to a committee so that it can be voted on.
func (Keeper) TallyVotes ¶
TallyVotes counts all the votes on a proposal
func (Keeper) ValidatePubProposal ¶
func (k Keeper) ValidatePubProposal(ctx sdk.Context, pubProposal types.PubProposal) (returnErr error)
ValidatePubProposal checks if a pubproposal is valid.