Documentation ¶
Index ¶
- func AllInvariants(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- func ModuleAccountInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- func NewQuerier(keeper Keeper) sdk.Querier
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper, bk types.BankKeeper)
- type Keeper
- func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Proposal)
- func (keeper Keeper) ActiveProposalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr chaintype.AccountID, ...) (bool, error)
- func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr chaintype.AccountID, ...) error
- func (keeper Keeper) DeleteDeposits(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DeleteProposal(ctx sdk.Context, proposalID uint64)
- func (keeper Keeper) DowntimeJailDuration(ctx sdk.Context) (res time.Duration)
- func (keeper Keeper) EmergencyPass(ctx sdk.Context, proposalID uint64) (passes bool, tallyResults types.TallyResult)
- 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 chaintype.AccountID) (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) GetGovernanceAccount(ctx sdk.Context) external.SupplyModuleAccount
- func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (types.Proposal, bool)
- func (keeper Keeper) GetProposalID(ctx sdk.Context) (proposalID uint64, err error)
- func (keeper Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals)
- func (keeper Keeper) GetProposalsFiltered(ctx sdk.Context, params types.QueryProposalsParams) []types.Proposal
- func (keeper Keeper) GetPunishValidator(ctx sdk.Context, validatorAccount chaintype.AccountID) (punishValidator types.PunishValidator, found bool)
- func (keeper Keeper) GetPunishValidators(ctx sdk.Context) (punishValidators types.Punishvalidators)
- func (keeper Keeper) GetSlashFraction(ctx sdk.Context) (res sdk.Dec)
- func (keeper Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams
- func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr chaintype.AccountID) (vote types.Vote, found bool)
- func (keeper Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes)
- func (keeper Keeper) GetVotingParams(ctx sdk.Context) types.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, ...)
- func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit types.Deposit) (stop bool))
- func (keeper Keeper) IterateAllPunishValidators(ctx sdk.Context, cb func(validator types.PunishValidator) (stop bool))
- func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))
- 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) Jail(ctx sdk.Context, validatorAccount chaintype.AccountID, proposalID uint64)
- func (keeper Keeper) Logger(ctx sdk.Context) log.Logger
- func (keeper Keeper) RefundDeposits(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() types.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) SetPunishValidator(ctx sdk.Context, validator_to_punish types.PunishValidator)
- func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)
- func (keeper Keeper) SetVote(ctx sdk.Context, vote types.Vote)
- func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams types.VotingParams)
- func (keeper Keeper) Slash(ctx sdk.Context)
- func (keeper Keeper) SlashValidator(ctx sdk.Context, validatorAccount chaintype.AccountID)
- func (keeper Keeper) SubmitProposal(ctx sdk.Context, content types.Content) (types.Proposal, error)
- func (keeper Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, burnDeposits bool, tallyResults types.TallyResult, ...)
- func (keeper Keeper) UnJail(ctx sdk.Context, validatorAccount chaintype.AccountID) error
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 NewQuerier ¶
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 types.Codec, key sdk.StoreKey, paramSpace types.ParamSubspace, supplyKeeper types.SupplyKeeper, sk types.StakingKeeper, distributionKeeper types.DistributionKeeper, 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 ¶
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 chaintype.AccountID, 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 ¶
func (keeper Keeper) AddVote(ctx sdk.Context, proposalID uint64, voterAddr chaintype.AccountID, option types.VoteOption) error
AddVote adds a vote on a specific proposal
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) DowntimeJailDuration ¶
func (Keeper) EmergencyPass ¶
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 chaintype.AccountID) (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) GetGovernanceAccount ¶
func (keeper Keeper) GetGovernanceAccount(ctx sdk.Context) external.SupplyModuleAccount
GetGovernanceAccount returns the governance ModuleAccount
func (Keeper) GetProposal ¶
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, params types.QueryProposalsParams) []types.Proposal
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) GetPunishValidator ¶
func (Keeper) GetPunishValidators ¶
func (keeper Keeper) GetPunishValidators(ctx sdk.Context) (punishValidators types.Punishvalidators)
func (Keeper) GetSlashFraction ¶
func (Keeper) GetTallyParams ¶
func (keeper Keeper) GetTallyParams(ctx sdk.Context) types.TallyParams
GetTallyParams returns the current TallyParam from the global param store
func (Keeper) GetVote ¶
func (keeper Keeper) GetVote(ctx sdk.Context, proposalID uint64, voterAddr chaintype.AccountID) (vote types.Vote, found bool)
GetVote gets the vote from an address on a specific proposal
func (Keeper) GetVotingParams ¶
func (keeper Keeper) GetVotingParams(ctx sdk.Context) types.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 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) IterateAllPunishValidators ¶
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 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) RefundDeposits ¶
RefundDeposits 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) SetDeposit ¶
SetDeposit sets a Deposit to the gov store
func (Keeper) SetDepositParams ¶
func (keeper Keeper) SetDepositParams(ctx sdk.Context, depositParams types.DepositParams)
SetDepositParams sets DepositParams to the global param store
func (Keeper) SetProposal ¶
SetProposal set a proposal to store
func (Keeper) SetProposalID ¶
SetProposalID sets the new proposal ID to the store
func (Keeper) SetPunishValidator ¶
func (keeper Keeper) SetPunishValidator(ctx sdk.Context, validator_to_punish types.PunishValidator)
func (Keeper) SetTallyParams ¶
func (keeper Keeper) SetTallyParams(ctx sdk.Context, tallyParams types.TallyParams)
SetTallyParams sets TallyParams to the global param store
func (Keeper) SetVotingParams ¶
func (keeper Keeper) SetVotingParams(ctx sdk.Context, votingParams types.VotingParams)
SetVotingParams sets VotingParams to the global param store
func (Keeper) SlashValidator ¶
func (Keeper) SubmitProposal ¶
SubmitProposal create new proposal given a content
func (Keeper) Tally ¶
func (keeper Keeper) Tally(ctx sdk.Context, proposal types.Proposal) (passes bool, burnDeposits bool, tallyResults types.TallyResult, punishBp []chaintype.AccountID, punish bool, vetobp []chaintype.AccountID)
Tally iterates over the votes and updates the tally of a proposal based on the voting power of the voters