keeper

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 23 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BalancesPrefix       = collections.NewPrefix([]byte{0x01, 0x00})
	PendingWalletsPrefix = collections.NewPrefix([]byte{0x01, 0x01})

	ParamsKey = collections.NewPrefix(0x09) // key for hold module params
)
View Source
var CoinsValue collcodec.ValueCodec[sdk.Coins] = coinsValue{}

CoinsValue stores sdk.Coins as a proto-encoded types.Balance with only the coins set; the map key already names the wallet.

Functions

func Address

func Address() sdk.AccAddress

Address returns the hold module account address.

Types

type AccountKeeper

type AccountKeeper interface {
	GetModuleAccount(context.Context, string) sdk.ModuleAccountI
}

AccountKeeper creates and returns the hold module account.

type BankKeeper

type BankKeeper interface {
	SendCoinsFromAccountToModule(context.Context, sdk.AccAddress, string, sdk.Coins) error
	GetAllBalances(context.Context, sdk.AccAddress) sdk.Coins
	IterateAccountBalances(context.Context, sdk.AccAddress, func(sdk.Coin) bool)
}

BankKeeper moves the unbonded coins of pending wallets into the hold module account, reports what that account holds at genesis, and tells whether a wallet holds any coins.

type DistributionKeeper

type DistributionKeeper interface {
	GetDelegatorWithdrawAddr(context.Context, sdk.AccAddress) (sdk.AccAddress, error)
	DeleteDelegatorWithdrawAddr(context.Context, sdk.AccAddress, sdk.AccAddress) error
}

DistributionKeeper clears the custom withdraw address of a wallet that becomes pending, so its rewards are paid to the wallet and redirected.

type Keeper

type Keeper interface {
	Schema() collections.Schema
	StoreKey() storetypes.StoreKey
	Codec() codec.BinaryCodec
	GetAuthority() string

	NewQuerier() Querier

	EndBlocker(ctx context.Context) error
	GetParams(sdk.Context) (types.Params, error)
	SetParams(sdk.Context, types.Params) error

	IsPending(context.Context, sdk.AccAddress) (bool, error)
	AddPendingWallets(sdk.Context, []sdk.AccAddress) error
	GetBalance(context.Context, sdk.AccAddress) (sdk.Coins, error)
	SendRestriction(ctx context.Context, from, to sdk.AccAddress, amt sdk.Coins) (sdk.AccAddress, error)

	InitGenesis(sdk.Context, *types.GenesisState) error
	ExportGenesis(sdk.Context) (*types.GenesisState, error)
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	skey *storetypes.KVStoreKey,
	tkey *storetypes.TransientStoreKey,
	accounts AccountKeeper,
	bank BankKeeper,
	distr DistributionKeeper,
	staking StakingKeeper,
	authority string,
) Keeper

NewKeeper creates and returns an instance of hold keeper

type Querier

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

Querier serves the hold gRPC queries.

func (Querier) Balance

Balance returns the coins held for one wallet and whether its payouts are held. A wallet with nothing held gets empty coins, not an error.

func (Querier) Balances

Balances returns a page of held balances in key order.

func (Querier) Params

func (Querier) PendingWallets

PendingWallets returns a page of pending wallets in key order.

type StakingKeeper

type StakingKeeper interface {
	GetDelegatorDelegations(context.Context, sdk.AccAddress, uint16) ([]stakingtypes.Delegation, error)
	GetUnbondingDelegations(context.Context, sdk.AccAddress, uint16) ([]stakingtypes.UnbondingDelegation, error)
	GetValidator(context.Context, sdk.ValAddress) (stakingtypes.Validator, error)
}

StakingKeeper reports whether a wallet has anything left in staking for hold to capture.

type WithdrawAddressDecorator

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

WithdrawAddressDecorator rejects a transaction that changes the withdraw address of a pending wallet, directly, inside authz MsgExec, or inside a governance proposal, at any depth. A pending wallet's rewards must keep going to the wallet itself, where the send restriction redirects them to hold. Proposal messages run in gov's EndBlocker, past the ante chain, so they are checked when the proposal is submitted. The wasm message filter blocks distribution, authz and gov messages from contracts.

func NewWithdrawAddressDecorator

func NewWithdrawAddressDecorator(k Keeper) WithdrawAddressDecorator

func (WithdrawAddressDecorator) AnteHandle

func (d WithdrawAddressDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error)

Jump to

Keyboard shortcuts

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