Documentation ¶
Overview ¶
Package keeper specifies the keeper for the gov module.
Index ¶
- func NewQuerier(keeper Keeper) 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) 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 (k Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits)
- func (k Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes)
- func (k Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit types.Deposit, found bool)
- func (k Keeper) GetDepositParams(ctx sdk.Context) types.DepositParams
- func (k Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits types.Deposits)
- func (k Keeper) GetDepositsByProposalID(ctx sdk.Context, proposalID uint64) (deposits types.Deposits)
- func (k Keeper) GetDepositsIteratorByProposalID(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (k Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (proposal types.Proposal, ok 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 types.Vote, found bool)
- func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes)
- func (k Keeper) GetVotesIterator(ctx sdk.Context, proposalID uint64) sdk.Iterator
- 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 types.Deposit) (stop bool))
- func (k Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))
- func (k Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit types.Deposit) (stop bool))
- 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 types.Vote) (stop bool))
- func (k Keeper) RefundDepositsByProposalID(ctx sdk.Context, proposalID uint64)
- func (k Keeper) SetDeposit(ctx sdk.Context, deposit types.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 types.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 gov.TallyResult)
- type TallyHelper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewQuerier ¶
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 { gov.Keeper // the reference to get information about certifiers CertKeeper types.CertKeeper // for ValidatePlan UpgradeKeeper types.UpgradeKeeper // contains filtered or unexported fields }
Keeper implements keeper for the governance module.
func NewKeeper ¶
func NewKeeper( cdc *codec.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, supplyKeeper govTypes.SupplyKeeper, stakingKeeper govTypes.StakingKeeper, certKeeper types.CertKeeper, upgradeKeeper types.UpgradeKeeper, 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, option govTypes.VoteOption) 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) 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 types.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 types.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 types.Vote, found bool)
GetVote gets the vote from an address on a specific proposal.
func (Keeper) GetVotesIterator ¶
GetVotesIterator gets all the votes on a specific proposal as an sdk.Iterator.
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 types.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 types.Vote) (stop bool))
IterateVotes iterates over the all votes for a proposal and performs a callback function.
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.
type TallyHelper ¶
type TallyHelper struct {
// contains filtered or unexported fields
}
TallyHelper reduces number of arguments passed to passAndVetoStakeResult.