keeper

package
v0.0.0-...-f498596 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0, Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// query balance path
	QueryBalance     = "balances"
	GrpcQueryBalance = "grpc_balances"
)

Variables

This section is empty.

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, ik innertx.InnerTxKeeper)

BeginBlocker check for infraction evidence or downtime of validators on every begin block

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier returns a new sdk.Keeper instance.

func NonnegativeBalanceInvariant

func NonnegativeBalanceInvariant(ak types.AccountKeeper) sdk.Invariant

NonnegativeBalanceInvariant checks that all accounts in the application have non-negative balances

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, ak types.AccountKeeper)

RegisterInvariants registers the bank module invariants

Types

type BaseKeeper

type BaseKeeper struct {
	BaseSendKeeper
	// contains filtered or unexported fields
}

BaseKeeper manages transfers between accounts. It implements the Keeper interface.

func NewBaseKeeper

func NewBaseKeeper(
	ak types.AccountKeeper, paramSpace params.Subspace, blacklistedAddrs map[string]bool,
) BaseKeeper

NewBaseKeeper returns a new BaseKeeper

func NewBaseKeeperWithMarshal

func NewBaseKeeperWithMarshal(ak types.AccountKeeper, marshal *codec.CodecProxy, paramSpace params.Subspace, blacklistedAddrs map[string]bool,
) BaseKeeper

func (BaseKeeper) DelegateCoins

func (keeper BaseKeeper) DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) (err error)

DelegateCoins performs delegation by deducting amt coins from an account with address addr. For vesting accounts, delegations amounts are tracked for both vesting and vested coins. The coins are then transferred from the delegator address to a ModuleAccount address. If any of the delegation amounts are negative, an error is returned.

func (*BaseKeeper) SetInnerTxKeeper

func (k *BaseKeeper) SetInnerTxKeeper(keeper innertx.InnerTxKeeper)

SetInnerTxKeeper set innerTxKeeper

func (BaseKeeper) UndelegateCoins

func (keeper BaseKeeper) UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) (err error)

UndelegateCoins performs undelegation by crediting amt coins to an account with address addr. For vesting accounts, undelegation amounts are tracked for both vesting and vested coins. The coins are then transferred from a ModuleAccount address to the delegator address. If any of the undelegation amounts are negative, an error is returned.

type BaseSendKeeper

type BaseSendKeeper struct {
	BaseViewKeeper
	// contains filtered or unexported fields
}

BaseSendKeeper only allows transfers between accounts without the possibility of creating coins. It implements the SendKeeper interface.

func NewBaseSendKeeper

func NewBaseSendKeeper(
	ak types.AccountKeeper, paramSpace params.Subspace, blacklistedAddrs map[string]bool,
) BaseSendKeeper

NewBaseSendKeeper returns a new BaseSendKeeper.

func (BaseSendKeeper) AddCoins

func (keeper BaseSendKeeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)

AddCoins adds amt to the coins at the addr.

func (BaseSendKeeper) BlacklistedAddr

func (keeper BaseSendKeeper) BlacklistedAddr(addr sdk.AccAddress) bool

BlacklistedAddr checks if a given address is blacklisted (i.e restricted from receiving funds)

func (BaseSendKeeper) GetInnerTxKeeper

func (k BaseSendKeeper) GetInnerTxKeeper() innertx.InnerTxKeeper

func (BaseSendKeeper) GetSendEnabled

func (keeper BaseSendKeeper) GetSendEnabled(ctx sdk.Context) bool

GetSendEnabled returns the current SendEnabled

func (BaseSendKeeper) InputOutputCoins

func (keeper BaseSendKeeper) InputOutputCoins(ctx sdk.Context, inputs []types.Input, outputs []types.Output) (err error)

InputOutputCoins handles a list of inputs and outputs

func (BaseSendKeeper) SendCoins

func (keeper BaseSendKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (err error)

SendCoins moves coins from one account to another

func (BaseSendKeeper) SetCoins

func (keeper BaseSendKeeper) SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) error

SetCoins sets the coins at the addr.

func (*BaseSendKeeper) SetInnerTxKeeper

func (k *BaseSendKeeper) SetInnerTxKeeper(keeper innertx.InnerTxKeeper)

func (BaseSendKeeper) SetSendEnabled

func (keeper BaseSendKeeper) SetSendEnabled(ctx sdk.Context, enabled bool)

SetSendEnabled sets the send enabled

func (BaseSendKeeper) SubtractCoins

func (keeper BaseSendKeeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)

SubtractCoins subtracts amt from the coins at the addr.

CONTRACT: If the account is a vesting account, the amount has to be spendable.

type BaseViewKeeper

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

BaseViewKeeper implements a read only keeper implementation of ViewKeeper.

func NewBaseViewKeeper

func NewBaseViewKeeper(ak types.AccountKeeper) BaseViewKeeper

NewBaseViewKeeper returns a new BaseViewKeeper.

func (BaseViewKeeper) GetCoins

func (keeper BaseViewKeeper) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins

GetCoins returns the coins at the addr.

func (BaseViewKeeper) HasCoins

func (keeper BaseViewKeeper) HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool

HasCoins returns whether or not an account has at least amt coins.

func (BaseViewKeeper) Logger

func (keeper BaseViewKeeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

type Keeper

type Keeper interface {
	SendKeeper

	DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error
	UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error

	GetInnerTxKeeper() innertx.InnerTxKeeper
}

Keeper defines a module interface that facilitates the transfer of coins between accounts.

type SendKeeper

type SendKeeper interface {
	ViewKeeper

	InputOutputCoins(ctx sdk.Context, inputs []types.Input, outputs []types.Output) error
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error

	SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
	AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
	SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) error

	GetSendEnabled(ctx sdk.Context) bool
	SetSendEnabled(ctx sdk.Context, enabled bool)

	BlacklistedAddr(addr sdk.AccAddress) bool
}

SendKeeper defines a module interface that facilitates the transfer of coins between accounts without the possibility of creating coins.

type ViewKeeper

type ViewKeeper interface {
	GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	HasCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) bool
}

ViewKeeper defines a module interface that facilitates read only access to account balances.

Jump to

Keyboard shortcuts

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