Documentation
¶
Index ¶
- Variables
- func Address() sdk.AccAddress
- type AccountKeeper
- type BankKeeper
- type DistributionKeeper
- type Keeper
- type Querier
- func (q Querier) Balance(ctx context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error)
- func (q Querier) Balances(ctx context.Context, req *types.QueryBalancesRequest) (*types.QueryBalancesResponse, error)
- func (q Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (q Querier) PendingWallets(ctx context.Context, req *types.QueryPendingWalletsRequest) (*types.QueryPendingWalletsResponse, error)
- type StakingKeeper
- type WithdrawAddressDecorator
Constants ¶
This section is empty.
Variables ¶
var ( BalancesPrefix = collections.NewPrefix([]byte{0x01, 0x00}) PendingWalletsPrefix = collections.NewPrefix([]byte{0x01, 0x01}) ParamsKey = collections.NewPrefix(0x09) // key for hold module params )
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 ¶
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 ¶
func (q Querier) Balance(ctx context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error)
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 ¶
func (q Querier) Balances(ctx context.Context, req *types.QueryBalancesRequest) (*types.QueryBalancesResponse, error)
Balances returns a page of held balances in key order.
func (Querier) Params ¶
func (q Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Querier) PendingWallets ¶
func (q Querier) PendingWallets(ctx context.Context, req *types.QueryPendingWalletsRequest) (*types.QueryPendingWalletsResponse, error)
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