Documentation ¶
Index ¶
- func AllInvariants(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- func ModuleAccountInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- func NewLegacyMsgServerImpl(govAcct string, v1Server v1.MsgServer) v1beta1.MsgServer
- func NewLegacyQueryServer(k Keeper) v1beta1.QueryServer
- func NewMsgServerImpl(keeper Keeper) v1.MsgServer
- func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper, bk types.BankKeeper)
- type Keeper
- func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal v1.Proposal)
- func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, ...) (bool, error)
- func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, ...) error
- func (keeper Keeper) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress)
- func (keeper Keeper) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) AfterProposalSubmission(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress)
- func (keeper Keeper) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DeleteAndBurnDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)
- func (q Keeper) Deposit(c context.Context, req *v1.QueryDepositRequest) (*v1.QueryDepositResponse, error)
- func (q Keeper) Deposits(c context.Context, req *v1.QueryDepositsRequest) (*v1.QueryDepositsResponse, error)
- func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits v1.Deposits)
- func (keeper Keeper) GetAllVotes(ctx sdk.Context) (votes v1.Votes)
- func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit v1.Deposit, found bool)
- func (keeper Keeper) GetDepositParams(ctx sdk.Context) v1.DepositParams
- func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits v1.Deposits)
- func (keeper Keeper) GetGovernanceAccount(ctx sdk.Context) authtypes.ModuleAccountI
- func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1.Proposal, bool)
- func (keeper Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err error)
- func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals v1.Proposals)
- func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params v1.QueryProposalsParams) v1.Proposals
- func (keeper Keeper) GetTallyParams(ctx sdk.Context) v1.TallyParams
- func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote v1.Vote, found bool)
- func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes v1.Votes)
- func (keeper Keeper) GetVotingParams(ctx sdk.Context) v1.VotingParams
- 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) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1.Proposal) (stop bool))
- func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1.Deposit) (stop bool))
- func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote v1.Vote) (stop bool))
- func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit v1.Deposit) (stop bool))
- func (keeper Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1.Proposal) (stop bool))
- func (keeper Keeper) IterateProposals(ctx sdk.Context, cb func(proposal v1.Proposal) (stop bool))
- func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote v1.Vote) (stop bool))
- func (keeper Keeper) LegacyRouter() v1beta1.Router
- func (keeper Keeper) Logger(ctx sdk.Context) log.Logger
- func (keeper Keeper) MarshalProposal(proposal v1.Proposal) ([]byte, error)
- func (q Keeper) Params(c context.Context, req *v1.QueryParamsRequest) (*v1.QueryParamsResponse, error)
- func (q Keeper) Proposal(c context.Context, req *v1.QueryProposalRequest) (*v1.QueryProposalResponse, error)
- func (q Keeper) Proposals(c context.Context, req *v1.QueryProposalsRequest) (*v1.QueryProposalsResponse, error)
- func (keeper Keeper) RefundAndDeleteDeposits(ctx sdk.Context, proposalID uint64)
- 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) Router() *middleware.MsgServiceRouter
- func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit v1.Deposit)
- func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams v1.DepositParams)
- func (keeper *Keeper) SetHooks(gh types.GovHooks) *Keeper
- func (keeper Keeper) SetProposal(ctx sdk.Context, proposal v1.Proposal)
- func (keeper Keeper) SetProposalID(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams v1.TallyParams)
- func (keeper Keeper) SetVote(ctx sdk.Context, vote v1.Vote)
- func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams v1.VotingParams)
- func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata string) (v1.Proposal, error)
- func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, burnDeposits bool, tallyResults v1.TallyResult)
- func (q Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest) (*v1.QueryTallyResultResponse, error)
- func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *v1.Proposal) error
- func (q Keeper) Vote(c context.Context, req *v1.QueryVoteRequest) (*v1.QueryVoteResponse, error)
- func (q Keeper) Votes(c context.Context, req *v1.QueryVotesRequest) (*v1.QueryVotesResponse, error)
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
func AllInvariants(keeper Keeper, bk types.BankKeeper) sdk.Invariant
AllInvariants runs all invariants of the governance module
func ModuleAccountInvariant ¶
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 NewLegacyMsgServerImpl ¶ added in v0.46.0
NewLegacyMsgServerImpl returns an implementation of the v1beta1 legacy MsgServer interface. It wraps around the current MsgServer
func NewLegacyQueryServer ¶ added in v0.46.0
func NewLegacyQueryServer(k Keeper) v1beta1.QueryServer
func NewMsgServerImpl ¶ added in v0.40.0
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 RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper, bk types.BankKeeper)
RegisterInvariants registers all governance invariants
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper defines the governance module Keeper
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace types.ParamSubspace, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, sk types.StakingKeeper, legacyRouter v1beta1.Router, router *middleware.MsgServiceRouter, config types.Config, ) 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 ¶
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.Coins) (bool, error)
AddDeposit adds or updates a deposit of a specific depositor on a specific proposal. Activates voting period when appropriate and returns true in that case, else returns false.
func (Keeper) AddVote ¶
func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress, options v1.WeightedVoteOptions, metadata string) error
AddVote adds a vote on a specific proposal
func (Keeper) AfterProposalDeposit ¶ added in v0.43.0
func (keeper Keeper) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress)
AfterProposalDeposit - call hook if registered
func (Keeper) AfterProposalFailedMinDeposit ¶ added in v0.43.0
AfterProposalFailedMinDeposit - call hook if registered
func (Keeper) AfterProposalSubmission ¶ added in v0.43.0
AfterProposalSubmission - call hook if registered
func (Keeper) AfterProposalVote ¶ added in v0.43.0
func (keeper Keeper) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress)
AfterProposalVote - call hook if registered
func (Keeper) AfterProposalVotingPeriodEnded ¶ added in v0.43.0
AfterProposalVotingPeriodEnded - call hook if registered
func (Keeper) DeleteAndBurnDeposits ¶ added in v0.46.0
DeleteAndBurnDeposits deletes and burn all the deposits on a specific proposal.
func (Keeper) DeleteProposal ¶
DeleteProposal deletes a proposal from store. Panics if the proposal doesn't exist.
func (Keeper) Deposit ¶ added in v0.40.0
func (q Keeper) Deposit(c context.Context, req *v1.QueryDepositRequest) (*v1.QueryDepositResponse, error)
Deposit queries single deposit information based on proposalID, depositAddr.
func (Keeper) Deposits ¶ added in v0.40.0
func (q Keeper) Deposits(c context.Context, req *v1.QueryDepositsRequest) (*v1.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 (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit v1.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) v1.DepositParams
GetDepositParams returns the current DepositParams from the global param store
func (Keeper) GetDeposits ¶
GetDeposits returns all the deposits from a proposal
func (Keeper) GetGovernanceAccount ¶
func (keeper Keeper) GetGovernanceAccount(ctx sdk.Context) authtypes.ModuleAccountI
GetGovernanceAccount returns the governance ModuleAccount
func (Keeper) GetProposal ¶
GetProposal get proposal from store by ProposalID. Panics if can't unmarshal the proposal.
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, params v1.QueryProposalsParams) v1.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 ¶
func (keeper Keeper) GetTallyParams(ctx sdk.Context) v1.TallyParams
GetTallyParams returns the current TallyParam from the global param store
func (Keeper) GetVote ¶
func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress) (vote v1.Vote, found bool)
GetVote gets the vote from an address on a specific proposal
func (Keeper) GetVotingParams ¶
func (keeper Keeper) GetVotingParams(ctx sdk.Context) v1.VotingParams
GetVotingParams returns the current VotingParams from the global param store
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) IterateActiveProposalsQueue ¶
func (keeper Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal v1.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 (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit v1.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 v1.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. Panics when the iterator encounters a proposal which can't be unmarshaled.
func (Keeper) IterateVotes ¶
func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote v1.Vote) (stop bool))
IterateVotes iterates over the all the proposals votes and performs a callback function
func (Keeper) LegacyRouter ¶ added in v0.46.0
LegacyRouter returns the gov keeper's legacy router
func (Keeper) MarshalProposal ¶ added in v0.40.0
func (Keeper) Params ¶ added in v0.40.0
func (q Keeper) Params(c context.Context, req *v1.QueryParamsRequest) (*v1.QueryParamsResponse, error)
Params queries all params
func (Keeper) Proposal ¶ added in v0.40.0
func (q Keeper) Proposal(c context.Context, req *v1.QueryProposalRequest) (*v1.QueryProposalResponse, error)
Proposal returns proposal details based on ProposalID
func (Keeper) Proposals ¶ added in v0.40.0
func (q Keeper) Proposals(c context.Context, req *v1.QueryProposalsRequest) (*v1.QueryProposalsResponse, error)
Proposals implements the Query/Proposals gRPC method
func (Keeper) RefundAndDeleteDeposits ¶ added in v0.46.0
RefundAndDeleteDeposits refunds and deletes all the deposits on a specific proposal.
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) Router ¶
func (keeper Keeper) Router() *middleware.MsgServiceRouter
Router returns the gov keeper's router
func (Keeper) SetDeposit ¶
SetDeposit sets a Deposit to the gov store
func (Keeper) SetDepositParams ¶
func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams v1.DepositParams)
SetDepositParams sets DepositParams to the global param store
func (Keeper) SetProposal ¶
SetProposal set a proposal to store. Panics if can't marshal the proposal.
func (Keeper) SetProposalID ¶
SetProposalID sets the new proposal ID to the store
func (Keeper) SetTallyParams ¶
func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams v1.TallyParams)
SetTallyParams sets TallyParams to the global param store
func (Keeper) SetVotingParams ¶
func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams v1.VotingParams)
SetVotingParams sets VotingParams to the global param store
func (Keeper) SubmitProposal ¶
func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata string) (v1.Proposal, error)
SubmitProposal create new proposal given an array of messages
func (Keeper) Tally ¶
func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, burnDeposits bool, tallyResults v1.TallyResult)
Tally iterates over the votes and updates the tally of a proposal based on the voting power of the voters
func (Keeper) TallyResult ¶ added in v0.40.0
func (q Keeper) TallyResult(c context.Context, req *v1.QueryTallyResultRequest) (*v1.QueryTallyResultResponse, error)
TallyResult queries the tally of a proposal vote
func (Keeper) UnmarshalProposal ¶ added in v0.40.0
func (Keeper) Vote ¶ added in v0.40.0
func (q Keeper) Vote(c context.Context, req *v1.QueryVoteRequest) (*v1.QueryVoteResponse, error)
Vote returns Voted information based on proposalID, voterAddr
func (Keeper) Votes ¶ added in v0.40.0
func (q Keeper) Votes(c context.Context, req *v1.QueryVotesRequest) (*v1.QueryVotesResponse, error)
Votes returns single proposal's votes
type Migrator ¶ added in v0.43.0
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
func NewMigrator ¶ added in v0.43.0
NewMigrator returns a new Migrator.
func (Migrator) Migrate1to2 ¶ added in v0.43.0
Migrate1to2 migrates from version 1 to 2.