cosmos-sdk: github.com/cosmos/cosmos-sdk/x/gov/keeper Index | Files

package keeper

import "github.com/cosmos/cosmos-sdk/x/gov/keeper"

Index

Package Files

deposit.go grpc_query.go invariants.go keeper.go params.go proposal.go querier.go tally.go vote.go

func AllInvariants Uses

func AllInvariants(keeper Keeper, bk types.BankKeeper) sdk.Invariant

AllInvariants runs all invariants of the governance module

func ModuleAccountInvariant Uses

func ModuleAccountInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant

ModuleAccountInvariant checks that the module account coins reflects the sum of deposit amounts held on store

func NewQuerier Uses

func NewQuerier(keeper Keeper, legacyQuerierCdc codec.JSONMarshaler) sdk.Querier

NewQuerier creates a new gov Querier instance

func RegisterInvariants Uses

func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper, bk types.BankKeeper)

RegisterInvariants registers all governance invariants

type Keeper Uses

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

Keeper defines the governance module Keeper

func NewKeeper Uses

func NewKeeper(
    cdc codec.BinaryMarshaler, key sdk.StoreKey, paramSpace types.ParamSubspace,
    authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper, rtr types.Router,
) Keeper

NewKeeper returns a governance keeper. It handles: - submitting governance proposals - depositing funds into proposals, and activating upon sufficient funds being deposited - users voting on proposals, with weight proportional to stake in the system - and tallying the result of the vote.

CONTRACT: the parameter Subspace must have the param key table already initialized

func (Keeper) ActivateVotingPeriod Uses

func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Proposal)

func (Keeper) ActiveProposalQueueIterator Uses

func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

ActiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Active Queue that expire by endTime

func (Keeper) AddDeposit Uses

func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error)

AddDeposit adds or updates a deposit of a specific depositor on a specific proposal Activates voting period when appropriate

func (Keeper) AddVote Uses

func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, option types.VoteOption) error

AddVote adds a vote on a specific proposal

func (Keeper) DeleteDeposits Uses

func (keeper Keeper) DeleteDeposits(ctx sdk.Context, proposalID uint64)

DeleteDeposits deletes all the deposits on a specific proposal without refunding them

func (Keeper) DeleteProposal Uses

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

DeleteProposal deletes a proposal from store

func (Keeper) Deposit Uses

func (q Keeper) Deposit(c context.Context, req *types.QueryDepositRequest) (*types.QueryDepositResponse, error)

Deposit queries single deposit information based proposalID, depositAddr

func (Keeper) Deposits Uses

func (q Keeper) Deposits(c context.Context, req *types.QueryDepositsRequest) (*types.QueryDepositsResponse, error)

Deposits returns single proposal's all deposits

func (Keeper) GetAllDeposits Uses

func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits)

GetAllDeposits returns all the deposits from the store

func (Keeper) GetAllVotes Uses

func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes)

GetAllVotes returns all the votes from the store

func (Keeper) GetDeposit Uses

func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit types.Deposit, found bool)

GetDeposit gets the deposit of a specific depositor on a specific proposal

func (Keeper) GetDepositParams Uses

func (keeper Keeper) GetDepositParams(ctx sdk.Context) types.DepositParams

GetDepositParams returns the current DepositParams from the global param store

func (Keeper) GetDeposits Uses

func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits types.Deposits)

GetDeposits returns all the deposits from a proposal

func (Keeper) GetGovernanceAccount Uses

func (keeper Keeper) GetGovernanceAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetGovernanceAccount returns the governance ModuleAccount

func (Keeper) GetProposal Uses

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

GetProposal get proposal from store by ProposalID

func (Keeper) GetProposalID Uses

func (keeper Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err error)

GetProposalID gets the highest proposal ID

func (Keeper) GetProposals Uses

func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals)

GetProposals returns all the proposals from store

func (Keeper) GetProposalsFiltered Uses

func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) types.Proposals

GetProposalsFiltered retrieves proposals filtered by a given set of params which include pagination parameters along with voter and depositor addresses and a proposal status. The voter address will filter proposals by whether or not that address has voted on proposals. The depositor address will filter proposals by whether or not that address has deposited to them. Finally, status will filter proposals by status.

NOTE: If no filters are provided, all proposals will be returned in paginated form.

func (Keeper) GetTallyParams Uses

func (keeper Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams

GetTallyParams returns the current TallyParam from the global param store

func (Keeper) GetVote Uses

func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote types.Vote, found bool)

GetVote gets the vote from an address on a specific proposal

func (Keeper) GetVotes Uses

func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes)

GetVotes returns all the votes from a proposal

func (Keeper) GetVotingParams Uses

func (keeper Keeper) GetVotingParams(ctx sdk.Context) types.VotingParams

GetVotingParams returns the current VotingParams from the global param store

func (Keeper) InactiveProposalQueueIterator Uses

func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

InactiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Inactive Queue that expire by endTime

func (Keeper) InsertActiveProposalQueue Uses

func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)

InsertActiveProposalQueue inserts a ProposalID into the active proposal queue at endTime

func (Keeper) InsertInactiveProposalQueue Uses

func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)

InsertInactiveProposalQueue Inserts a ProposalID into the inactive proposal queue at endTime

func (Keeper) IterateActiveProposalsQueue Uses

func (keeper Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal types.Proposal) (stop bool))

IterateActiveProposalsQueue iterates over the proposals in the active proposal queue and performs a callback function

func (Keeper) IterateAllDeposits Uses

func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool))

IterateAllDeposits iterates over the all the stored deposits and performs a callback function

func (Keeper) IterateAllVotes Uses

func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))

IterateAllVotes iterates over the all the stored votes and performs a callback function

func (Keeper) IterateDeposits Uses

func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit types.Deposit) (stop bool))

IterateDeposits iterates over the all the proposals deposits and performs a callback function

func (Keeper) IterateInactiveProposalsQueue Uses

func (keeper Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal types.Proposal) (stop bool))

IterateInactiveProposalsQueue iterates over the proposals in the inactive proposal queue and performs a callback function

func (Keeper) IterateProposals Uses

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

IterateProposals iterates over the all the proposals and performs a callback function

func (Keeper) IterateVotes Uses

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

IterateVotes iterates over the all the proposals votes and performs a callback function

func (Keeper) Logger Uses

func (keeper Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MarshalProposal Uses

func (keeper Keeper) MarshalProposal(proposal types.Proposal) ([]byte, error)

func (Keeper) MustMarshalProposal Uses

func (keeper Keeper) MustMarshalProposal(proposal types.Proposal) []byte

func (Keeper) MustUnmarshalProposal Uses

func (keeper Keeper) MustUnmarshalProposal(bz []byte, proposal *types.Proposal)

func (Keeper) Params Uses

func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)

Params queries all params

func (Keeper) Proposal Uses

func (q Keeper) Proposal(c context.Context, req *types.QueryProposalRequest) (*types.QueryProposalResponse, error)

Proposal returns proposal details based on ProposalID

func (Keeper) Proposals Uses

func (q Keeper) Proposals(c context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error)

Proposals implements the Query/Proposals gRPC method

func (Keeper) RefundDeposits Uses

func (keeper Keeper) RefundDeposits(ctx sdk.Context, proposalID uint64)

RefundDeposits refunds and deletes all the deposits on a specific proposal

func (Keeper) RemoveFromActiveProposalQueue Uses

func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)

RemoveFromActiveProposalQueue removes a proposalID from the Active Proposal Queue

func (Keeper) RemoveFromInactiveProposalQueue Uses

func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)

RemoveFromInactiveProposalQueue removes a proposalID from the Inactive Proposal Queue

func (Keeper) Router Uses

func (keeper Keeper) Router() types.Router

Router returns the gov Keeper's Router

func (Keeper) SetDeposit Uses

func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit)

SetDeposit sets a Deposit to the gov store

func (Keeper) SetDepositParams Uses

func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams types.DepositParams)

SetDepositParams sets DepositParams to the global param store

func (Keeper) SetProposal Uses

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

SetProposal set a proposal to store

func (Keeper) SetProposalID Uses

func (keeper Keeper) SetProposalID(ctx sdk.Context, proposalID uint64)

SetProposalID sets the new proposal ID to the store

func (Keeper) SetTallyParams Uses

func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)

SetTallyParams sets TallyParams to the global param store

func (Keeper) SetVote Uses

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

SetVote sets a Vote to the gov store

func (Keeper) SetVotingParams Uses

func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams types.VotingParams)

SetVotingParams sets VotingParams to the global param store

func (Keeper) SubmitProposal Uses

func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (types.Proposal, error)

SubmitProposal create new proposal given a content

func (Keeper) Tally Uses

func (keeper Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, burnDeposits bool, tallyResults types.TallyResult)

Tally iterates over the votes and updates the tally of a proposal based on the voting power of the voters

func (Keeper) TallyResult Uses

func (q Keeper) TallyResult(c context.Context, req *types.QueryTallyResultRequest) (*types.QueryTallyResultResponse, error)

TallyResult queries the tally of a proposal vote

func (Keeper) UnmarshalProposal Uses

func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) error

func (Keeper) Vote Uses

func (q Keeper) Vote(c context.Context, req *types.QueryVoteRequest) (*types.QueryVoteResponse, error)

Vote returns Voted information based on proposalID, voterAddr

func (Keeper) Votes Uses

func (q Keeper) Votes(c context.Context, req *types.QueryVotesRequest) (*types.QueryVotesResponse, error)

Votes returns single proposal's votes

Package keeper imports 16 packages (graph) and is imported by 3 packages. Updated 2020-08-13. Refresh now. Tools for package owners.