keeper

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier creates a new gov Querier instance

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all committee invariants

func ValidCommitteesInvariant

func ValidCommitteesInvariant(k Keeper) sdk.Invariant

ValidCommitteesInvariant verifies that all committees in the store are independently valid

func ValidProposalsInvariant

func ValidProposalsInvariant(k Keeper) sdk.Invariant

ValidProposalsInvariant verifies that all proposals in the store are valid

func ValidVotesInvariant

func ValidVotesInvariant(k Keeper) sdk.Invariant

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 NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, router govtypes.Router, paramKeeper types.ParamKeeper) Keeper

func (Keeper) AddVote

func (k Keeper) AddVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress) error

AddVote submits a vote on a proposal.

func (Keeper) CloseExpiredProposals

func (k Keeper) CloseExpiredProposals(ctx sdk.Context)

CloseExpiredProposals removes proposals (and associated votes) that have past their deadline.

func (Keeper) DeleteCommittee

func (k Keeper) DeleteCommittee(ctx sdk.Context, committeeID uint64)

DeleteCommittee removes a committee from the store.

func (Keeper) DeleteProposal

func (k Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)

DeleteProposal removes a proposal from the store.

func (Keeper) DeleteProposalAndVotes

func (k Keeper) DeleteProposalAndVotes(ctx sdk.Context, proposalID uint64)

DeleteProposalAndVotes removes a proposal and its associated votes.

func (Keeper) DeleteVote

func (k Keeper) DeleteVote(ctx sdk.Context, proposalID uint64, voter sdk.AccAddress)

DeleteVote removes a Vote from the store.

func (Keeper) EnactPassedProposals

func (k Keeper) EnactPassedProposals(ctx sdk.Context)

EnactPassedProposals puts in place the changes proposed in any proposal that has enough votes

func (Keeper) EnactProposal

func (k Keeper) EnactProposal(ctx sdk.Context, proposal types.Proposal) error

EnactProposal makes the changes proposed in a proposal.

func (Keeper) GetCommittee

func (k Keeper) GetCommittee(ctx sdk.Context, committeeID uint64) (types.Committee, bool)

GetCommittee gets a committee from the store.

func (Keeper) GetCommittees

func (k Keeper) GetCommittees(ctx sdk.Context) []types.Committee

GetCommittees returns all stored committees.

func (Keeper) GetNextProposalID

func (k Keeper) GetNextProposalID(ctx sdk.Context) (uint64, error)

GetNextProposalID reads the next available global ID from store

func (Keeper) GetProposal

func (k Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Proposal, bool)

GetProposal gets a proposal from the store.

func (Keeper) GetProposalResult

func (k Keeper) GetProposalResult(ctx sdk.Context, proposalID uint64) (bool, error)

GetProposalResult calculates if a proposal currently has enough votes to pass.

func (Keeper) GetProposals

func (k Keeper) GetProposals(ctx sdk.Context) []types.Proposal

GetProposals returns all stored proposals.

func (Keeper) GetProposalsByCommittee

func (k Keeper) GetProposalsByCommittee(ctx sdk.Context, committeeID uint64) []types.Proposal

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

func (k Keeper) GetVotes(ctx sdk.Context) []types.Vote

GetVotes returns all stored votes.

func (Keeper) GetVotesByProposal

func (k Keeper) GetVotesByProposal(ctx sdk.Context, proposalID uint64) []types.Vote

GetVotesByProposal returns all votes for one proposal.

func (Keeper) IncrementNextProposalID

func (k Keeper) IncrementNextProposalID(ctx sdk.Context) error

IncrementNextProposalID increments the next proposal ID in the store by 1.

func (Keeper) IterateCommittees

func (k Keeper) IterateCommittees(ctx sdk.Context, cb func(committee types.Committee) (stop bool))

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

func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))

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

func (k Keeper) IterateVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))

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

func (k Keeper) SetCommittee(ctx sdk.Context, committee types.Committee)

SetCommittee puts a committee into the store.

func (Keeper) SetNextProposalID

func (k Keeper) SetNextProposalID(ctx sdk.Context, id uint64)

SetNextProposalID stores an ID to be used for the next created proposal

func (Keeper) SetProposal

func (k Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal)

SetProposal puts a proposal into the store.

func (Keeper) SetVote

func (k Keeper) SetVote(ctx sdk.Context, vote types.Vote)

SetVote puts a vote 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

func (k Keeper) TallyVotes(ctx sdk.Context, proposalID uint64) int64

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.

Jump to

Keyboard shortcuts

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