keeper

package
v0.0.0-...-f2ae4c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package keeper specifies the keeper for the gov module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier creates a new gov Querier instance.

func ProposalKey

func ProposalKey(proposalID uint64) []byte

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.

func Tally

func Tally(ctx sdk.Context, k Keeper, proposal types.Proposal) (pass bool, veto bool, tallyResults govTypes.TallyResult)

Tally counts the votes and returns whether the proposal passes and/or if tokens should be burned.

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

func (k Keeper) ActivateCouncilProposalVotingPeriod(ctx sdk.Context, proposal types.Proposal) bool

ActivateCouncilProposalVotingPeriod only switches proposals of council members.

func (Keeper) ActivateVotingPeriod

func (k Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Proposal)

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

func (k Keeper) DeleteAllVotes(ctx sdk.Context, proposalID uint64)

deleteAllVotes deletes all votes for a proposal.

func (Keeper) DeleteDepositsByProposalID

func (k Keeper) DeleteDepositsByProposalID(ctx sdk.Context, proposalID uint64)

DeleteDepositsByProposalID deletes all the deposits on a specific proposal without refunding them.

func (Keeper) DeleteProposalByProposalID

func (k Keeper) DeleteProposalByProposalID(ctx sdk.Context, proposalID uint64)

DeleteProposalByProposalID deletes a proposal from store.

func (Keeper) GetAllDeposits

func (k Keeper) GetAllDeposits(ctx sdk.Context) (deposits types.Deposits)

GetAllDeposits returns all the deposits from the store.

func (Keeper) GetAllVotes

func (k Keeper) GetAllVotes(ctx sdk.Context) (votes types.Votes)

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

func (k Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits types.Deposits)

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

func (k Keeper) GetDepositsIteratorByProposalID(ctx sdk.Context, proposalID uint64) sdk.Iterator

GetDepositsIteratorByProposalID gets all the deposits on a specific proposal as an sdk.Iterator.

func (Keeper) GetProposal

func (k Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (proposal types.Proposal, ok bool)

GetProposal get Proposal from store by ProposalID.

func (Keeper) GetProposals

func (k Keeper) GetProposals(ctx sdk.Context) (proposals types.Proposals)

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) GetVotes

func (k Keeper) GetVotes(ctx sdk.Context, proposalID uint64) (votes types.Votes)

GetVotes returns all the votes from a proposal.

func (Keeper) GetVotesIterator

func (k Keeper) GetVotesIterator(ctx sdk.Context, proposalID uint64) sdk.Iterator

GetVotesIterator gets all the votes on a specific proposal as an sdk.Iterator.

func (Keeper) IsCertifier

func (k Keeper) IsCertifier(ctx sdk.Context, addr sdk.AccAddress) bool

isCertifier checks if the input address is a certifier.

func (Keeper) IsCouncilMember

func (k Keeper) IsCouncilMember(ctx sdk.Context, addr sdk.AccAddress) bool

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

func (k 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

func (k Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote types.Vote) (stop bool))

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

func (k 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 (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

func (k Keeper) RefundDepositsByProposalID(ctx sdk.Context, proposalID uint64)

RefundDepositsByProposalID refunds and deletes all the deposits on a specific proposal.

func (Keeper) SetDeposit

func (k Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit)

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

func (k Keeper) SetProposal(ctx sdk.Context, proposal types.Proposal)

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) SetVote

func (k Keeper) SetVote(ctx sdk.Context, vote types.Vote)

SetVote set a vote.

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 gov.TallyResult)

Tally counts the votes and returns whether the proposal passes and/or if tokens should be burned.

type TallyHelper

type TallyHelper struct {
	// contains filtered or unexported fields
}

TallyHelper reduces number of arguments passed to passAndVetoStakeResult.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL