keeper

package
v0.46.33 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Group Table
	GroupTablePrefix        byte = 0x0
	GroupTableSeqPrefix     byte = 0x1
	GroupByAdminIndexPrefix byte = 0x2

	// Group Member Table
	GroupMemberTablePrefix         byte = 0x10
	GroupMemberByGroupIndexPrefix  byte = 0x11
	GroupMemberByMemberIndexPrefix byte = 0x12

	// Group Policy Table
	GroupPolicyTablePrefix        byte = 0x20
	GroupPolicyTableSeqPrefix     byte = 0x21
	GroupPolicyByGroupIndexPrefix byte = 0x22
	GroupPolicyByAdminIndexPrefix byte = 0x23

	// Proposal Table
	ProposalTablePrefix              byte = 0x30
	ProposalTableSeqPrefix           byte = 0x31
	ProposalByGroupPolicyIndexPrefix byte = 0x32
	ProposalsByVotingPeriodEndPrefix byte = 0x33

	// Vote Table
	VoteTablePrefix           byte = 0x40
	VoteByProposalIndexPrefix byte = 0x41
	VoteByVoterIndexPrefix    byte = 0x42
)

Variables

This section is empty.

Functions

func GroupTotalWeightInvariant

func GroupTotalWeightInvariant(keeper Keeper) sdk.Invariant

GroupTotalWeightInvariant checks that group's TotalWeight must be equal to the sum of its members.

func GroupTotalWeightInvariantHelper

func GroupTotalWeightInvariantHelper(ctx sdk.Context, key storetypes.StoreKey, groupTable orm.AutoUInt64Table, groupMemberByGroupIndex orm.Index) (string, bool)

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper)

RegisterInvariants registers all group invariants.

Types

type Keeper

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

func NewKeeper

func NewKeeper(storeKey storetypes.StoreKey, cdc codec.Codec, router *baseapp.MsgServiceRouter, accKeeper group.AccountKeeper, config group.Config) Keeper

NewKeeper creates a new group keeper.

func (Keeper) CreateGroup

func (Keeper) CreateGroupPolicy

func (Keeper) Exec

func (k Keeper) Exec(goCtx context.Context, req *group.MsgExec) (*group.MsgExecResponse, error)

Exec executes the messages from a proposal.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx types.Context, cdc codec.JSONCodec) *group.GenesisState

func (Keeper) GetGroupSequence

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

GetGroupSequence returns the current value of the group table sequence

func (Keeper) GroupInfo

GroupInfo queries info about a group.

func (Keeper) GroupMembers

GroupMembers queries all members of a group.

func (Keeper) GroupPoliciesByAdmin

GroupPoliciesByAdmin queries all groups policies where a given address is admin.

func (Keeper) GroupPoliciesByGroup

GroupPoliciesByGroup queries all groups policies of a given group.

func (Keeper) GroupPolicyInfo

GroupPolicyInfo queries info about a group policy.

func (Keeper) GroupsByAdmin

GroupsByAdmin queries all groups where a given address is admin.

func (Keeper) GroupsByMember

GroupsByMember queries all groups where the given address is a member of.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx types.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate

func (Keeper) LeaveGroup

func (k Keeper) LeaveGroup(goCtx context.Context, req *group.MsgLeaveGroup) (*group.MsgLeaveGroupResponse, error)

LeaveGroup implements the MsgServer/LeaveGroup method.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) Proposal

Proposal queries a proposal.

func (Keeper) ProposalsByGroupPolicy

Proposal queries all proposals of a group policy.

func (Keeper) PruneProposals

func (k Keeper) PruneProposals(ctx sdk.Context) error

PruneProposals prunes all proposals that are expired, i.e. whose `voting_period + max_execution_period` is greater than the current block time.

func (Keeper) SubmitProposal

func (Keeper) Tally

func (k Keeper) Tally(ctx sdk.Context, p group.Proposal, groupID uint64) (group.TallyResult, error)

Tally is a function that tallies a proposal by iterating through its votes, and returns the tally result without modifying the proposal or any state.

func (Keeper) TallyProposalsAtVPEnd

func (k Keeper) TallyProposalsAtVPEnd(ctx sdk.Context) error

TallyProposalsAtVPEnd iterates over all proposals whose voting period has ended, tallies their votes, prunes them, and updates the proposal's `FinalTallyResult` field.

func (Keeper) TallyResult

TallyResult computes the live tally result of a proposal.

func (Keeper) UpdateGroupAdmin

func (Keeper) UpdateGroupMembers

func (Keeper) Vote

func (k Keeper) Vote(goCtx context.Context, req *group.MsgVote) (*group.MsgVoteResponse, error)

func (Keeper) VoteByProposalVoter

VoteByProposalVoter queries a vote given a voter and a proposal ID.

func (Keeper) VotesByProposal

VotesByProposal queries all votes on a proposal.

func (Keeper) VotesByVoter

VotesByProposal queries all votes of a voter.

func (Keeper) WithdrawProposal

Jump to

Keyboard shortcuts

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