keeper

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

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 MsgServer interface for the provided Keeper.

Types

type CombinedTallyResults

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

CombinedTallyResults is a struct containing the results of a tally of both guardian and regular member votes

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ps paramtypes.Subspace,

	ak types.AccountKeeper,
	gk types.GovKeeper,

) *Keeper

func (Keeper) AppendMember

func (k Keeper) AppendMember(ctx sdk.Context, address sdk.AccAddress, newMember types.Member)

func (Keeper) DeleteAndBurnDeposits

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

DeleteAndBurnDeposits deletes and burns all the deposits on a specific proposal.

func (Keeper) DeleteProposal

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

DeleteProposal deletes a proposal from store. Panics if the proposal doesn't exist.

func (Keeper) GetGovParams

func (k Keeper) GetGovParams(ctx sdk.Context) (params govtypes_v1.Params)

GetGovParams gets the governance parameters from the global param store

func (Keeper) GetGuardianAddresses

func (k Keeper) GetGuardianAddresses(ctx sdk.Context) []sdk.AccAddress

GetGuardianAddresses returns all guardian addresses

func (Keeper) GetGuardianWhitelist

func (k Keeper) GetGuardianWhitelist(ctx sdk.Context) (res string)

Returns the guardian addresses defined in param NOTE: these addresses must still be validated against the electorate

func (Keeper) GetGuardians

func (k Keeper) GetGuardians(ctx sdk.Context) []*types.Member

GetGuardians returns all guardians of the electorate NOTE: Only valid members with membership status of MemberElectorate are returned

func (Keeper) GetMemberAccount

func (k Keeper) GetMemberAccount(ctx sdk.Context, address sdk.AccAddress) (types.Member, bool)

func (Keeper) GetMemberCount

func (k Keeper) GetMemberCount(ctx sdk.Context) uint64

func (Keeper) GetMemberStatusCount

func (k Keeper) GetMemberStatusCount(ctx sdk.Context, s types.MembershipStatus) uint64

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams get all parameters as types.Params

func (Keeper) GetTotalVotingWeight

func (k Keeper) GetTotalVotingWeight(ctx sdk.Context) (res sdk.Dec)

func (*Keeper) GovHooks

func (k *Keeper) GovHooks() govtypes.GovHooks

Hooks gets the hooks for governance Keeper

func (*Keeper) GovRouter

func (k *Keeper) GovRouter() *baseapp.MsgServiceRouter

Router returns the gov keeper's router

func (Keeper) Guardians

func (Keeper) IsLegitimateProposal

func (k Keeper) IsLegitimateProposal(ctx sdk.Context, proposal govtypes_v1.Proposal) bool

IsLegitimateProposal returns true if this proposal was created by an electorate member

func (Keeper) IsMember

func (k Keeper) IsMember(ctx sdk.Context, address sdk.AccAddress) bool

func (Keeper) IsMemberByBech32Address

func (k Keeper) IsMemberByBech32Address(ctx sdk.Context, bech32Address string) bool

func (Keeper) IsWhitelistedGuardian

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

IsGuardian check if the given address is a whitelisted guardian NOTE: It does not check if this address represents a member or if the member has a status of MemberElectorate

func (Keeper) IterateActiveProposalsQueue

func (k Keeper) IterateActiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal govtypes_v1.Proposal) (stop bool))

IterateActiveProposalsQueue cycle through proposals that have ended their voting period

func (Keeper) IterateInactiveProposalsQueue

func (k Keeper) IterateInactiveProposalsQueue(ctx sdk.Context, endTime time.Time, cb func(proposal govtypes_v1.Proposal) (stop bool))

IterateInactiveProposalsQueue iterates over the proposals in the inactive proposal queue and performs a callback function

func (Keeper) IterateVotes

func (k Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote govtypes_v1.Vote) (stop bool))

IterateVotes iterates over the all the proposals votes and performs a callback function

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) Member

func (Keeper) Members

func (Keeper) Params

func (Keeper) RefundAndDeleteDeposits

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

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

func (Keeper) RemoveFromActiveProposalQueue

func (k Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)

RemoveFromActiveProposalQueue removes a proposalID from the Active Proposal Queue

func (Keeper) SetMemberCount

func (k Keeper) SetMemberCount(ctx sdk.Context, count uint64)

func (Keeper) SetMemberStatusCount

func (k Keeper) SetMemberStatusCount(ctx sdk.Context, s types.MembershipStatus, count uint64)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams set the params

func (Keeper) SetProposal

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

SetProposal writes the updated proposal to the store

func (Keeper) Tally

func (k Keeper) Tally(ctx sdk.Context, proposal govtypes_v1.Proposal) (passes bool, burnDeposits bool, tallyResults govtypes_v1.TallyResult)

Tally iterates over the votes and updates the tally of a proposal based on the voting power of the voters

func (Keeper) UpdateMemberStatus

func (k Keeper) UpdateMemberStatus(ctx sdk.Context, target sdk.AccAddress, s types.MembershipStatus) error

type VoteOptions

type VoteOptions map[govtypes_v1.VoteOption]math.Int

VoteOptions is a map of vote options to the number of votes for that option

func NewEmptyVoteOptions

func NewEmptyVoteOptions() VoteOptions

makeResultMap returns a map with all the vote options set to 0

Jump to

Keyboard shortcuts

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