Documentation ¶
Index ¶
- func NewQuerier(keeper Keeper) sdk.Querier
- func Tally(ctx sdk.Context, keeper Keeper, proposal types.Proposal, ...) (types.ProposalStatus, bool, types.TallyResult)
- type BankKeeper
- type Keeper
- func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, ...) sdk.Error
- func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, ...) (sdk.Error, string)
- func (keeper Keeper) AfterDepositPeriodPassed(ctx sdk.Context, proposal types.Proposal)
- func (keeper Keeper) AfterSubmitProposalHandler(ctx sdk.Context, proposal types.Proposal)
- func (keeper Keeper) BankKeeper() BankKeeper
- func (keeper Keeper) Cdc() *codec.Codec
- func (keeper Keeper) CheckMsgSubmitProposal(ctx sdk.Context, msg types.MsgSubmitProposal) sdk.Error
- func (keeper Keeper) DeleteDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DeleteVotes(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DistributeDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) FeeCollectorName() string
- func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits)
- func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes)
- func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit types.Deposit, found bool)
- func (keeper Keeper) GetDepositParams(ctx sdk.Context) types.DepositParams
- func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits types.Deposits)
- func (keeper Keeper) GetDepositsIterator(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (keeper Keeper) GetGovernanceAccount(ctx sdk.Context) supplyexported.ModuleAccountI
- func (keeper Keeper) GetMaxDepositPeriod(ctx sdk.Context, content types.Content) time.Duration
- func (keeper Keeper) GetMinDeposit(ctx sdk.Context, content types.Content) sdk.SysCoins
- func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (proposal types.Proposal, ok bool)
- func (keeper Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err sdk.Error)
- func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals)
- func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, voterAddr sdk.AccAddress, depositorAddr sdk.AccAddress, ...) []types.Proposal
- func (keeper Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams
- func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote types.Vote, found bool)
- func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes)
- func (keeper Keeper) GetVotesIterator(ctx sdk.Context, proposalID uint64) sdk.Iterator
- func (keeper Keeper) GetVotingParams(ctx sdk.Context) types.VotingParams
- func (keeper Keeper) GetVotingPeriod(ctx sdk.Context, content types.Content) time.Duration
- func (keeper Keeper) InactiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (keeper Keeper) InsertActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
- func (keeper Keeper) InsertInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
- func (keeper Keeper) InsertWaitingProposalQueue(ctx sdk.Context, blockHeight, proposalID uint64)
- func (keeper Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, ...)
- func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool))
- func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))
- func (keeper Keeper) IterateAllWaitingProposals(ctx sdk.Context, ...)
- func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit types.Deposit) (stop bool))
- func (keeper Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, ...)
- func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal types.Proposal) (stop bool))
- func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote types.Vote) (stop bool))
- func (keeper Keeper) IterateWaitingProposalsQueue(ctx sdk.Context, height uint64, cb func(proposal types.Proposal) (stop bool))
- func (keeper Keeper) Logger(ctx sdk.Context) log.Logger
- func (keeper Keeper) ProposalHandlerRouter() ProposalHandlerRouter
- func (keeper Keeper) RefundDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) RejectedHandler(ctx sdk.Context, content types.Content)
- func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
- func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
- func (keeper Keeper) RemoveFromWaitingProposalQueue(ctx sdk.Context, blockHeight, proposalID uint64)
- func (keeper Keeper) Router() Router
- func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit)
- func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams types.DepositParams)
- func (keeper Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal)
- func (keeper Keeper) SetProposalID(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)
- func (keeper Keeper) SetVote(ctx sdk.Context, proposalID uint64, vote types.Vote)
- func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams types.VotingParams)
- func (keeper Keeper) StoreKey() sdk.StoreKey
- func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (types.Proposal, sdk.Error)
- func (keeper Keeper) SupplyKeeper() SupplyKeeper
- func (keeper Keeper) TotalPower(ctx sdk.Context) sdk.Dec
- func (keeper Keeper) VoteHandler(ctx sdk.Context, proposal types.Proposal, vote types.Vote) (string, sdk.Error)
- func (keeper Keeper) WaitingProposalQueueIterator(ctx sdk.Context, blockHeight uint64) sdk.Iterator
- type ProposalHandler
- type ProposalHandlerRouter
- type Router
- type StakingKeeper
- type SupplyKeeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BankKeeper ¶
type BankKeeper interface { GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins // TODO remove once governance doesn't require use of accounts SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) sdk.Error SetSendEnabled(ctx sdk.Context, enabled bool) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Error) }
BankKeeper defines expected bank keeper
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper defines governance keeper
func NewKeeper ¶
func NewKeeper( cdc *codec.Codec, key sdk.StoreKey, paramsKeeper params.Keeper, paramSpace params.Subspace, supplyKeeper SupplyKeeper, sk StakingKeeper, codespace string, rtr Router, ck BankKeeper, phr ProposalHandlerRouter, feeCollectorName string, ) 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) ActiveProposalQueueIterator ¶
ActiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Active Queue that expire by endTime
func (Keeper) AddDeposit ¶
func (keeper Keeper) AddDeposit( ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.SysCoins, eventType string, ) sdk.Error
AddDeposit adds or updates a deposit of a specific depositor on a specific proposal Activates voting period when appropriate
func (Keeper) AddVote ¶
func (keeper Keeper) AddVote( ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, option types.VoteOption, ) (sdk.Error, string)
AddVote adds a vote on a specific proposal
func (Keeper) AfterDepositPeriodPassed ¶
nolint
func (Keeper) AfterSubmitProposalHandler ¶
nolint
func (Keeper) BankKeeper ¶
func (keeper Keeper) BankKeeper() BankKeeper
BankKeeper returns bank keeper in gov keeper
func (Keeper) CheckMsgSubmitProposal ¶
nolint
func (Keeper) DeleteDeposits ¶
DeleteDeposits deletes all the deposits on a specific proposal without refunding them
func (Keeper) DeleteProposal ¶
DeleteProposal deletes a proposal from store
func (Keeper) DeleteVotes ¶
DeleteVotes deletes the votes of a specific proposal
func (Keeper) DistributeDeposits ¶
DistributeDeposits distributes and deletes all the deposits on a specific proposal
func (Keeper) FeeCollectorName ¶
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 (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 ¶
func (keeper 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) GetDepositsIterator ¶
GetDepositsIterator gets all the deposits on a specific proposal as an sdk.Iterator
func (Keeper) GetGovernanceAccount ¶
func (keeper Keeper) GetGovernanceAccount(ctx sdk.Context) supplyexported.ModuleAccountI
GetGovernanceAccount returns the governance ModuleAccount
func (Keeper) GetMaxDepositPeriod ¶
nolint
func (Keeper) GetMinDeposit ¶
GetMinDeposit implement ProposalHandler nolint
func (Keeper) GetProposal ¶
func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (proposal types.Proposal, ok bool)
GetProposal get Proposal from store by ProposalID
func (Keeper) GetProposalID ¶
GetProposalID gets the highest proposal ID
func (Keeper) GetProposals ¶
GetProposals returns all the proposals from store
func (Keeper) GetProposalsFiltered ¶
func (keeper Keeper) GetProposalsFiltered( ctx sdk.Context, voterAddr sdk.AccAddress, depositorAddr sdk.AccAddress, status types.ProposalStatus, numLatest uint64, ) []types.Proposal
GetProposalsFiltered get Proposals from store by ProposalID voterAddr will filter proposals by whether or not that address has voted on them depositorAddr will filter proposals by whether or not that address has deposited to them status will filter proposals by status numLatest will fetch a specified number of the most recent proposals, or 0 for all proposals
func (Keeper) GetTallyParams ¶
func (keeper Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams
GetTallyParams returns the current TallyParams from the global param store
func (Keeper) GetVote ¶
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) GetVotesIterator ¶
GetVotesIterator gets all the votes on a specific proposal as an sdk.Iterator
func (Keeper) GetVotingParams ¶
func (keeper Keeper) GetVotingParams(ctx sdk.Context) types.VotingParams
GetVotingParams returns the current VotingParams from the global param store
func (Keeper) GetVotingPeriod ¶
nolint
func (Keeper) InactiveProposalQueueIterator ¶
InactiveProposalQueueIterator returns an sdk.Iterator for all the proposals in the Inactive Queue that expire by endTime
func (Keeper) InsertActiveProposalQueue ¶
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 ¶
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) InsertWaitingProposalQueue ¶
InsertWaitingProposalQueue inserts a ProposalID into the waiting proposal queue at endTime
func (Keeper) IterateActiveProposalsQueue ¶
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 ¶
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 ¶
IterateAllVotes iterates over the all the stored votes and performs a callback function
func (Keeper) IterateAllWaitingProposals ¶
func (keeper Keeper) IterateAllWaitingProposals(ctx sdk.Context, cb func(proposal types.Proposal, proposalID, height uint64) (stop bool))
IterateAllWaitingProposals iterates over the all proposals in the waiting proposal queue and performs a callback function
func (Keeper) IterateDeposits ¶
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 ¶
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 ¶
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 ¶
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) IterateWaitingProposalsQueue ¶
func (keeper Keeper) IterateWaitingProposalsQueue( ctx sdk.Context, height uint64, cb func(proposal types.Proposal, ) (stop bool))
IterateWaitingProposalsQueue iterates over the proposals in the waiting proposal queue and performs a callback function
func (Keeper) ProposalHandlerRouter ¶
func (keeper Keeper) ProposalHandlerRouter() ProposalHandlerRouter
ProposalHandlerRouter returns proposal handler router in gov keeper
func (Keeper) RefundDeposits ¶
RefundDeposits refunds and deletes all the deposits on a specific proposal
func (Keeper) RejectedHandler ¶
nolint
func (Keeper) RemoveFromActiveProposalQueue ¶
func (keeper Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
RemoveFromActiveProposalQueue removes a proposalID from the Active Proposal Queue
func (Keeper) RemoveFromInactiveProposalQueue ¶
func (keeper Keeper) RemoveFromInactiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
RemoveFromInactiveProposalQueue removes a proposalID from the Inactive Proposal Queue
func (Keeper) RemoveFromWaitingProposalQueue ¶
func (keeper Keeper) RemoveFromWaitingProposalQueue(ctx sdk.Context, blockHeight, proposalID uint64)
RemoveFromWaitingProposalQueue removes a proposalID from the waiting Proposal Queue
func (Keeper) SetDeposit ¶
SetDeposit sets the deposit of a specific depositor on a specific proposal
func (Keeper) SetDepositParams ¶
func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams types.DepositParams)
SetDepositParams sets the current DepositParams to the global param store
func (Keeper) SetProposal ¶
SetProposal set a proposal to store
func (Keeper) SetProposalID ¶
SetProposalID sets the proposal ID to gov store
func (Keeper) SetTallyParams ¶
func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)
SetTallyParams sets the current TallyParams to the global param store
func (Keeper) SetVotingParams ¶
func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams types.VotingParams)
SetVotingParams sets the current VotingParams to the global param store
func (Keeper) SubmitProposal ¶
func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (types.Proposal, sdk.Error)
SubmitProposal creates new proposal given a content
func (Keeper) SupplyKeeper ¶
func (keeper Keeper) SupplyKeeper() SupplyKeeper
func (Keeper) TotalPower ¶
get all current validators except candidate votes
type ProposalHandler ¶
type ProposalHandler interface { GetMinDeposit(ctx sdk.Context, content types.Content) sdk.SysCoins GetMaxDepositPeriod(ctx sdk.Context, content types.Content) time.Duration GetVotingPeriod(ctx sdk.Context, content types.Content) time.Duration CheckMsgSubmitProposal(ctx sdk.Context, msg types.MsgSubmitProposal) sdk.Error AfterSubmitProposalHandler(ctx sdk.Context, proposal types.Proposal) VoteHandler(ctx sdk.Context, proposal types.Proposal, vote types.Vote) (string, sdk.Error) AfterDepositPeriodPassed(ctx sdk.Context, proposal types.Proposal) RejectedHandler(ctx sdk.Context, content types.Content) }
ProposalHandler defines the interface handler in different periods of proposal
type ProposalHandlerRouter ¶
type ProposalHandlerRouter interface { AddRoute(r string, mp ProposalHandler) (mpr ProposalHandlerRouter) HasRoute(r string) bool GetRoute(path string) (h ProposalHandler) Seal() }
ProposalHandlerRouter defines the interface of managing the proposal handler of proposal
type Router ¶
type Router interface { AddRoute(r string, h types.Handler) (rtr Router) HasRoute(r string) bool GetRoute(path string) (h types.Handler) Seal() }
Router implements a governance Handler router.
TODO: Use generic router (ref #3976).
type StakingKeeper ¶
type StakingKeeper interface { // iterate through bonded validators by operator address, execute func for each validator // gov use it for getting votes of validator IterateBondedValidatorsByPower(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool)) // gov use it for getting votes of delegator which has been voted to validator Delegator(ctx sdk.Context, delAddr sdk.AccAddress) stakingexported.DelegatorI }
StakingKeeper defines expected staking keeper (Validator and Delegator sets)
type SupplyKeeper ¶
type SupplyKeeper interface { GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) sdk.Error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) sdk.Error }
SupplyKeeper defines the supply Keeper for module accounts