keeper

package
v0.0.0-...-a6871c7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 27 Imported by: 1

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, storeService storetypes.KVStoreService, 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 {
	appmodule.Environment
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(env appmodule.Environment, cdc codec.Codec, accKeeper group.AccountKeeper, config group.Config) Keeper

NewKeeper creates a new group keeper.

func (Keeper) CreateGroup

func (Keeper) CreateGroupPolicy

func (Keeper) CreateGroupWithPolicy

func (Keeper) EndBlocker

func (k Keeper) EndBlocker(ctx context.Context) error

EndBlocker called at every block, updates proposal's `FinalTallyResult` and prunes expired proposals.

func (Keeper) Exec

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

Exec executes the messages from a proposal.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx context.Context, _ codec.JSONCodec) (*group.GenesisState, error)

ExportGenesis returns the group module's exported genesis.

func (Keeper) GetGroupPolicySeq

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

GetGroupPolicySeq returns the current value of the group policy table sequence

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

Groups returns all the groups present in the state.

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 context.Context, cdc codec.JSONCodec, data json.RawMessage) error

InitGenesis initializes the group module's genesis state.

func (Keeper) LeaveGroup

LeaveGroup implements the MsgServer/LeaveGroup method.

func (Keeper) Proposal

Proposal queries a proposal.

func (Keeper) ProposalsByGroupPolicy

ProposalsByGroupPolicy queries all proposals of a group policy.

func (Keeper) PruneProposals

func (k Keeper) PruneProposals(ctx context.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 context.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 context.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) UpdateGroupMetadata

func (Keeper) UpdateGroupPolicyAdmin

func (Keeper) UpdateGroupPolicyDecisionPolicy

func (Keeper) UpdateGroupPolicyMetadata

func (Keeper) Vote

func (k Keeper) Vote(ctx context.Context, msg *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

VotesByVoter queries all votes of a voter.

func (Keeper) WithdrawProposal

type Migrator

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

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

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2

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

Migrate1to2 migrates from version 1 to 2.

Jump to

Keyboard shortcuts

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