keeper

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0 Imports: 24 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 NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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 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 {
	govkeeper.Keeper

	// the reference to get information about certifiers
	CertKeeper types.CertKeeper

	// the reference to get claim proposal parameters
	ShieldKeeper types.ShieldKeeper
	// contains filtered or unexported fields
}

Keeper implements keeper for the governance module.

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace types.ParamSubspace, bankKeeper govtypes.BankKeeper,
	stakingKeeper types.StakingKeeper, certKeeper types.CertKeeper, shieldKeeper types.ShieldKeeper,
	authKeeper govtypes.AccountKeeper, 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, options govtypes.WeightedVoteOptions) error

AddVote Adds a vote on a specific proposal.

func (Keeper) BondDenom

func (k Keeper) BondDenom(ctx sdk.Context) string

BondDenom returns the staking denom.

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

Deposit queries single deposit information based proposalID, depositAddr

func (Keeper) Deposits

Deposits returns single proposal's all deposits

func (Keeper) GetAllDeposits

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

GetAllDeposits returns all the deposits from the store.

func (Keeper) GetAllVotes

func (k Keeper) GetAllVotes(ctx sdk.Context) (votes govtypes.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 govtypes.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 govtypes.Deposits)

GetDeposits returns all the deposits from a proposal.

func (Keeper) GetDepositsByProposalID

func (k Keeper) GetDepositsByProposalID(ctx sdk.Context, proposalID uint64) (deposits govtypes.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) (types.Proposal, 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 govtypes.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 govtypes.Votes)

GetVotes returns all votes on a given proposal.

func (Keeper) GetVotesIterator

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

GetVotesIterator returns an iterator to go over all votes on a given proposal.

func (Keeper) GetVotesIteratorPaginated

func (k Keeper) GetVotesIteratorPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) sdk.Iterator

GetVotesIteratorPaginated returns an iterator to go over votes on a given proposal based on pagination parameters.

func (Keeper) GetVotesPaginated

func (k Keeper) GetVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint) (votes govtypes.Votes)

GetVotesPaginated performs paginated query of votes on a given proposal.

func (Keeper) IsCertifiedIdentity

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

IsCertifiedIdentity checks if the input address is a certified identity.

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 govtypes.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 govtypes.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 govtypes.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 govtypes.Vote) (stop bool))

IterateVotes iterates over the all votes on a given proposal and performs a callback function.

func (Keeper) IterateVotesPaginated

func (k Keeper) IterateVotesPaginated(ctx sdk.Context, proposalID uint64, page, limit uint, cb func(vote govtypes.Vote) (stop bool))

IterateVotesPaginated iterates over votes on a given proposal based on pagination parameters and performs a callback function.

func (Keeper) MarshalProposal

func (keeper Keeper) MarshalProposal(proposal types.Proposal) ([]byte, error)

func (Keeper) MustMarshalProposal

func (keeper Keeper) MustMarshalProposal(proposal types.Proposal) []byte

func (Keeper) MustUnmarshalProposal

func (keeper Keeper) MustUnmarshalProposal(bz []byte, proposal *types.Proposal)

func (Keeper) Params

Params queries all params

func (Keeper) Proposal

Proposal returns proposal details based on ProposalID

func (Keeper) Proposals

Proposals implements the Query/Proposals gRPC method

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

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

func (Keeper) TallyResult

TallyResult queries the tally of a proposal vote

func (Keeper) TotalBondedByCertifiedIdentities

func (k Keeper) TotalBondedByCertifiedIdentities(ctx sdk.Context) sdk.Int

TotalBondedByCertifiedIdentities calculates the amount of total bonded stakes by certified identities.

func (Keeper) UnmarshalProposal

func (keeper Keeper) UnmarshalProposal(bz []byte, proposal *types.Proposal) error

func (Keeper) Vote

Vote returns Voted information based on proposalID, voterAddr

func (Keeper) Votes

Votes returns single proposal's votes

type Migrator added in v2.3.0

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v2.3.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v2.3.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

type QueryResProposals

type QueryResProposals struct {
	Total     int              `json:"total"`
	Proposals []types.Proposal `json:"proposals"`
}

func (QueryResProposals) UnpackInterfaces

func (q QueryResProposals) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

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