Documentation ¶
Overview ¶
Package keeper specifies the keeper for the gov module.
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func ProposalKey(proposalID uint64) []byte
- func SecurityTally(ctx sdk.Context, k Keeper, proposal types.Proposal) (bool, bool, govtypes.TallyResult)
- func Tally(ctx sdk.Context, k Keeper, proposal types.Proposal) (pass bool, veto bool, tallyResults govtypes.TallyResult)
- type Keeper
- func (k Keeper) ActivateCouncilProposalVotingPeriod(ctx sdk.Context, proposal types.Proposal) bool
- func (k Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Proposal)
- func (k Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, ...) (bool, error)
- func (k Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, ...) error
- func (k Keeper) BondDenom(ctx sdk.Context) string
- func (k Keeper) DeleteAllVotes(ctx sdk.Context, proposalID uint64)
- func (k Keeper) DeleteDepositsByProposalID(ctx sdk.Context, proposalID uint64)
- func (k Keeper) DeleteProposalByProposalID(ctx sdk.Context, proposalID uint64)
- func (q Keeper) Deposit(c context.Context, req *types.QueryDepositRequest) (*types.QueryDepositResponse, error)
- func (q Keeper) Deposits(c context.Context, req *types.QueryDepositsRequest) (*types.QueryDepositsResponse, error)
- func (k Keeper) GetAllDeposits(ctx sdk.Context) (deposits govtypes.Deposits)
- func (k Keeper) GetAllVotes(ctx sdk.Context) (votes govtypes.Votes)
- func (k Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit govtypes.Deposit, found bool)
- func (k Keeper) GetDepositParams(ctx sdk.Context) types.DepositParams
- func (k Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits govtypes.Deposits)
- func (k Keeper) GetDepositsByProposalID(ctx sdk.Context, proposalID uint64) (deposits govtypes.Deposits)
- func (k Keeper) GetDepositsIteratorByProposalID(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (k Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Proposal, bool)
- func (k Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals)
- func (k Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) []types.Proposal
- func (k Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams
- func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote govtypes.Vote, found bool)
- func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes govtypes.Votes)
- func (k Keeper) GetVotesIterator(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (k Keeper) GetVotesIteratorPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) sdk.Iterator
- func (k Keeper) GetVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) (votes govtypes.Votes)
- func (k Keeper) IsCertifiedIdentity(ctx sdk.Context, addr sdk.AccAddress) bool
- func (k Keeper) IsCertifier(ctx sdk.Context, addr sdk.AccAddress) bool
- func (k Keeper) IsCouncilMember(ctx sdk.Context, addr sdk.AccAddress) bool
- func (k Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, ...)
- func (k Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit govtypes.Deposit) (stop bool))
- func (k Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote govtypes.Vote) (stop bool))
- func (k Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, ...)
- func (k Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, ...)
- func (k Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))
- func (k Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote govtypes.Vote) (stop bool))
- func (k Keeper) IterateVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint, ...)
- func (keeper Keeper) MarshalProposal(proposal types.Proposal) ([]byte, error)
- func (keeper Keeper) MustMarshalProposal(proposal types.Proposal) []byte
- func (keeper Keeper) MustUnmarshalProposal(bz []byte, proposal *types.Proposal)
- func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (q Keeper) Proposal(c context.Context, req *types.QueryProposalRequest) (*types.QueryProposalResponse, error)
- func (q Keeper) Proposals(c context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error)
- func (k Keeper) RefundDepositsByProposalID(ctx sdk.Context, proposalID uint64)
- func (k Keeper) SetDeposit(ctx sdk.Context, deposit govtypes.Deposit)
- func (k Keeper) SetDepositParams(ctx sdk.Context, depositParams types.DepositParams)
- func (k Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal)
- func (k Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)
- func (k Keeper) SetVote(ctx sdk.Context, vote govtypes.Vote)
- func (k Keeper) SubmitProposal(ctx sdk.Context, content govtypes.Content, addr sdk.AccAddress) (types.Proposal, error)
- func (k Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, burnDeposits bool, tallyResults govtypes.TallyResult)
- func (q Keeper) TallyResult(c context.Context, req *types.QueryTallyResultRequest) (*types.QueryTallyResultResponse, error)
- func (k Keeper) TotalBondedByCertifiedIdentities(ctx sdk.Context) sdk.Int
- func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) error
- func (q Keeper) Vote(c context.Context, req *types.QueryVoteRequest) (*types.QueryVoteResponse, error)
- func (q Keeper) Votes(c context.Context, req *types.QueryVotesRequest) (*types.QueryVotesResponse, error)
- type Migrator
- type QueryResProposals
- type TallyHelper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the gov MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
NewQuerier creates a new gov Querier instance.
func ProposalKey ¶
ProposalKey gets a specific proposal from the store.
func SecurityTally ¶
func SecurityTally(ctx sdk.Context, k Keeper, proposal types.Proposal) (bool, bool, govtypes.TallyResult)
SecurityTally only gets called if the proposal is a software upgrade or certifier update and if it is the certifier round. If the proposal passes, we setup the validator voting round and the calling function EndBlocker continues to the next iteration. If it fails, the proposal is removed by the logic in EndBlocker.
Types ¶
type Keeper ¶
type Keeper struct { govkeeper.Keeper // the reference to get information about certifiers CertKeeper types.CertKeeper // the reference to get claim proposal parameters ShieldKeeper types.ShieldKeeper // contains filtered or unexported fields }
Keeper implements keeper for the governance module.
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace types.ParamSubspace, bankKeeper govtypes.BankKeeper, stakingKeeper types.StakingKeeper, certKeeper types.CertKeeper, shieldKeeper types.ShieldKeeper, authKeeper govtypes.AccountKeeper, router govtypes.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.
func (Keeper) ActivateCouncilProposalVotingPeriod ¶
ActivateCouncilProposalVotingPeriod only switches proposals of council members.
func (Keeper) ActivateVotingPeriod ¶
ActivateVotingPeriod switches proposals from deposit period to voting period.
func (Keeper) AddDeposit ¶
func (k 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. When proposer is a council member, it's not depositable. Activates voting period when appropriate.
func (Keeper) AddVote ¶
func (k Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options govtypes.WeightedVoteOptions) error
AddVote Adds a vote on a specific proposal.
func (Keeper) DeleteAllVotes ¶
DeleteAllVotes deletes all votes for a proposal.
func (Keeper) DeleteDepositsByProposalID ¶
DeleteDepositsByProposalID deletes all the deposits on a specific proposal without refunding them.
func (Keeper) DeleteProposalByProposalID ¶
DeleteProposalByProposalID deletes a proposal from store.
func (Keeper) Deposit ¶
func (q Keeper) Deposit(c context.Context, req *types.QueryDepositRequest) (*types.QueryDepositResponse, error)
Deposit queries single deposit information based proposalID, depositAddr
func (Keeper) Deposits ¶
func (q Keeper) Deposits(c context.Context, req *types.QueryDepositsRequest) (*types.QueryDepositsResponse, error)
Deposits returns single proposal's all deposits
func (Keeper) GetAllDeposits ¶
GetAllDeposits returns all the deposits from the store.
func (Keeper) GetAllVotes ¶
GetAllVotes returns all the votes from the store.
func (Keeper) GetDeposit ¶
func (k Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit govtypes.Deposit, found bool)
GetDeposit gets the deposit of a specific depositor on a specific proposal.
func (Keeper) GetDepositParams ¶
func (k Keeper) GetDepositParams(ctx sdk.Context) types.DepositParams
GetDepositParams returns the current DepositParams from the global param store.
func (Keeper) GetDeposits ¶
GetDeposits returns all the deposits from a proposal.
func (Keeper) GetDepositsByProposalID ¶
func (k Keeper) GetDepositsByProposalID(ctx sdk.Context, proposalID uint64) (deposits govtypes.Deposits)
GetDepositsByProposalID returns all the deposits from a proposal.
func (Keeper) GetDepositsIteratorByProposalID ¶
GetDepositsIteratorByProposalID gets all the deposits on a specific proposal as an sdk.Iterator.
func (Keeper) GetProposal ¶
GetProposal get Proposal from store by ProposalID.
func (Keeper) GetProposals ¶
GetProposals returns all the proposals from store.
func (Keeper) GetProposalsFiltered ¶
func (k Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) []types.Proposal
GetProposalsFiltered returns proposals filtered.
func (Keeper) GetTallyParams ¶
func (k Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams
GetTallyParams returns the current TallyParams from the global param store.
func (Keeper) GetVote ¶
func (k Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote govtypes.Vote, found bool)
GetVote gets the vote from an address on a specific proposal.
func (Keeper) GetVotesIterator ¶
GetVotesIterator returns an iterator to go over all votes on a given proposal.
func (Keeper) GetVotesIteratorPaginated ¶
func (k Keeper) GetVotesIteratorPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) sdk.Iterator
GetVotesIteratorPaginated returns an iterator to go over votes on a given proposal based on pagination parameters.
func (Keeper) GetVotesPaginated ¶
func (k Keeper) GetVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) (votes govtypes.Votes)
GetVotesPaginated performs paginated query of votes on a given proposal.
func (Keeper) IsCertifiedIdentity ¶
IsCertifiedIdentity checks if the input address is a certified identity.
func (Keeper) IsCertifier ¶
isCertifier checks if the input address is a certifier.
func (Keeper) IsCouncilMember ¶
IsCouncilMember checks if the address is either a validator or a certifier.
func (Keeper) IterateActiveProposalsQueue ¶
func (k 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 ¶
IterateAllDeposits iterates over the all the stored deposits and performs a callback function.
func (Keeper) IterateAllVotes ¶
IterateAllVotes iterates over the all the stored votes and performs a callback function.
func (Keeper) IterateDeposits ¶
func (k Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit govtypes.Deposit) (stop bool))
IterateDeposits iterates over the all the proposals deposits and performs a callback function.
func (Keeper) IterateInactiveProposalsQueue ¶
func (k 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 ¶
IterateProposals iterates over the all the proposals and performs a callback function.
func (Keeper) IterateVotes ¶
func (k Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote govtypes.Vote) (stop bool))
IterateVotes iterates over the all votes on a given proposal and performs a callback function.
func (Keeper) IterateVotesPaginated ¶
func (k Keeper) IterateVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint, cb func(vote govtypes.Vote) (stop bool))
IterateVotesPaginated iterates over votes on a given proposal based on pagination parameters and performs a callback function.
func (Keeper) MarshalProposal ¶
func (Keeper) MustMarshalProposal ¶
func (Keeper) MustUnmarshalProposal ¶
func (Keeper) Params ¶
func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries all params
func (Keeper) Proposal ¶
func (q Keeper) Proposal(c context.Context, req *types.QueryProposalRequest) (*types.QueryProposalResponse, error)
Proposal returns proposal details based on ProposalID
func (Keeper) Proposals ¶
func (q Keeper) Proposals(c context.Context, req *types.QueryProposalsRequest) (*types.QueryProposalsResponse, error)
Proposals implements the Query/Proposals gRPC method
func (Keeper) RefundDepositsByProposalID ¶
RefundDepositsByProposalID refunds and deletes all the deposits on a specific proposal.
func (Keeper) SetDeposit ¶
SetDeposit sets the deposit to KVStore.
func (Keeper) SetDepositParams ¶
func (k Keeper) SetDepositParams(ctx sdk.Context, depositParams types.DepositParams)
SetDepositParams sets parameters space for deposits.
func (Keeper) SetProposal ¶
SetProposal sets a proposal to store.
func (Keeper) SetTallyParams ¶
func (k Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)
SetTallyParams sets parameters space for tally period.
func (Keeper) SubmitProposal ¶
func (k Keeper) SubmitProposal(ctx sdk.Context, content govtypes.Content, addr sdk.AccAddress) (types.Proposal, error)
SubmitProposal creates a new proposal with given content.
func (Keeper) Tally ¶
func (k Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, burnDeposits bool, tallyResults govtypes.TallyResult)
Tally counts the votes and returns whether the proposal passes and/or if tokens should be burned.
func (Keeper) TallyResult ¶
func (q Keeper) TallyResult(c context.Context, req *types.QueryTallyResultRequest) (*types.QueryTallyResultResponse, error)
TallyResult queries the tally of a proposal vote
func (Keeper) TotalBondedByCertifiedIdentities ¶
TotalBondedByCertifiedIdentities calculates the amount of total bonded stakes by certified identities.
func (Keeper) UnmarshalProposal ¶
func (Keeper) Vote ¶
func (q Keeper) Vote(c context.Context, req *types.QueryVoteRequest) (*types.QueryVoteResponse, error)
Vote returns Voted information based on proposalID, voterAddr
func (Keeper) Votes ¶
func (q Keeper) Votes(c context.Context, req *types.QueryVotesRequest) (*types.QueryVotesResponse, error)
Votes returns single proposal's votes
type Migrator ¶ added in v2.3.0
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶ added in v2.3.0
NewMigrator returns a new Migrator.
type QueryResProposals ¶
type QueryResProposals struct { Total int `json:"total"` Proposals []types.Proposal `json:"proposals"` }
func (QueryResProposals) UnpackInterfaces ¶
func (q QueryResProposals) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error
UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
type TallyHelper ¶
type TallyHelper struct {
// contains filtered or unexported fields
}
TallyHelper reduces number of arguments passed to passAndVetoStakeResult.