keeper

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the committee MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier creates a new gov Querier instance

func NewQueryServerImpl

func NewQueryServerImpl(k Keeper) types.QueryServer

NewQueryServerImpl creates a new server for handling gRPC queries.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey, router govv1beta1.Router,
	paramKeeper types.ParamKeeper, ak types.AccountKeeper, sk types.BankKeeper,
) Keeper

func (Keeper) AddVote

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

AddVote submits a vote on a proposal.

func (Keeper) CloseProposal

func (k Keeper) CloseProposal(ctx sdk.Context, proposal types.Proposal, outcome types.ProposalOutcome)

CloseProposal deletes proposals and their votes, emitting an event denoting the final status of the proposal

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) 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.Committees

GetCommittees returns all stored committees.

func (Keeper) GetMemberCommitteeProposalResult

func (k Keeper) GetMemberCommitteeProposalResult(ctx sdk.Context, proposalID uint64, committee types.Committee) bool

GetMemberCommitteeProposalResult gets the result of a member committee proposal

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, committee types.Committee) bool

func (Keeper) GetProposalTallyResponse

func (k Keeper) GetProposalTallyResponse(ctx sdk.Context, proposalID uint64) (*types.QueryTallyResponse, bool)

GetProposalTallyResponse returns the tally results of a proposal.

func (Keeper) GetProposals

func (k Keeper) GetProposals(ctx sdk.Context) types.Proposals

GetProposals returns all stored proposals.

func (Keeper) GetProposalsByCommittee

func (k Keeper) GetProposalsByCommittee(ctx sdk.Context, committeeID uint64) types.Proposals

GetProposalsByCommittee returns all proposals for one committee.

func (Keeper) GetTokenCommitteeProposalResult

func (k Keeper) GetTokenCommitteeProposalResult(ctx sdk.Context, proposalID uint64, committee *types.TokenCommittee) bool

GetTokenCommitteeProposalResult gets the result of a token committee proposal

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

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

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

func (k Keeper) TallyMemberCommitteeVotes(ctx sdk.Context, proposalID uint64) (totalVotes sdk.Dec)

TallyMemberCommitteeVotes returns the polling status of a member committee vote

func (Keeper) TallyTokenCommitteeVotes

func (k Keeper) TallyTokenCommitteeVotes(ctx sdk.Context, proposalID uint64,
	tallyDenom string,
) (yesVotes, noVotes, totalVotes, possibleVotes sdk.Dec)

TallyMemberCommitteeVotes returns the polling status of a token committee vote. Returns yes votes, total current votes, total possible votes (equal to token supply), vote threshold (yes vote ratio required for proposal to pass), and quorum (votes tallied at this percentage).

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