keeper

package
v0.0.0-...-143fca7 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLegacyMsgServerImpl

func NewLegacyMsgServerImpl(govAcct string, server govv1.MsgServer) govv1beta1.MsgServer

NewMsgServerImpl creates an implementation of the gov v1 MsgServer interface for the given keeper.

func NewLegacyQueryServerImpl

func NewLegacyQueryServerImpl(qs govv1.QueryServer) govv1beta1.QueryServer

NewQueryServerImpl creates an implementation of the QueryServer interface for the given keeper

func NewMsgServerImpl

func NewMsgServerImpl(k Keeper) govv1.MsgServer

NewMsgServerImpl creates an implementation of the gov v1 MsgServer interface for the given keeper.

func NewQueryServerImpl

func NewQueryServerImpl(k Keeper) govv1.QueryServer

NewQueryServerImpl creates an implementation of the QueryServer interface for the given keeper.

Types

type Keeper

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

Keeper defines the governance module Keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace govtypes.ParamSubspace,
	accountKeeper govtypes.AccountKeeper, bankKeeper govtypes.BankKeeper, stakingKeeper govtypes.StakingKeeper,
	legacyRouter govv1beta1.Router, router *baseapp.MsgServiceRouter,
	config customtypes.Config,
) 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.

CONTRACT: the parameter Subspace must have the param key table already initialized

func (Keeper) ActivateVotingPeriod

func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal v1.Proposal)

func (Keeper) AddDeposit

func (keeper 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. Activates voting period when appropriate and returns true in that case, else returns false.

func (Keeper) DeleteAndBurnDeposits

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

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

func (Keeper) DetermineProposalVote

func (keeper Keeper) DetermineProposalVote(proposal v1.Proposal) (v1.VoteOption, string, error)

DetermineProposalVote determines if we should vote Yes, No or No With Veto on the given proposal. It submits our rules together with the summary and details to OpenAI

func (Keeper) GetAllDeposits

func (keeper Keeper) GetAllDeposits(ctx sdk.Context) (deposits v1.Deposits)

GetAllDeposits returns all the deposits from the store

func (Keeper) GetDeposit

func (keeper Keeper) GetDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress) (deposit v1.Deposit, found bool)

GetDeposit gets the deposit of a specific depositor on a specific proposal

func (Keeper) GetDeposits

func (keeper Keeper) GetDeposits(ctx sdk.Context, proposalID uint64) (deposits v1.Deposits)

GetDeposits returns all the deposits from a proposal

func (Keeper) IterateAllDeposits

func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1.Deposit) (stop bool))

IterateAllDeposits iterates over all the stored deposits and performs a callback function

func (Keeper) IterateDeposits

func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit v1.Deposit) (stop bool))

IterateDeposits iterates over all the proposals deposits and performs a callback function

func (Keeper) RefundAndDeleteDeposits

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

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

func (Keeper) SetDeposit

func (keeper Keeper) SetDeposit(ctx sdk.Context, deposit v1.Deposit)

SetDeposit sets a Deposit to the gov store

Jump to

Keyboard shortcuts

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