keeper

package
v0.0.0-...-bed5261 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

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,
	codespace sdk.CodespaceType, blacklistedAddrs map[string]bool) BaseKeeper

NewBaseKeeper returns a new BaseKeeper

func (BaseKeeper) DelegateCoins

func (keeper BaseKeeper) DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) sdk.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) UndelegateCoins

func (keeper BaseKeeper) UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) sdk.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, codespace sdk.CodespaceType, 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, sdk.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) GetSendEnabled

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

GetSendEnabled returns the current SendEnabled nolint: errcheck

func (BaseSendKeeper) InputOutputCoins

func (keeper BaseSendKeeper) InputOutputCoins(ctx sdk.Context, inputs []types.Input, outputs []types.Output) sdk.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) sdk.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) sdk.Error

SetCoins sets the coins at the addr.

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, sdk.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, codespace sdk.CodespaceType) BaseViewKeeper

NewBaseViewKeeper returns a new BaseViewKeeper.

func (BaseViewKeeper) Codespace

func (keeper BaseViewKeeper) Codespace() sdk.CodespaceType

Codespace returns the keeper's codespace.

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) sdk.Error
	UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) sdk.Error
}

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) sdk.Error
	SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) sdk.Error

	SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Error)
	AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Error)
	SetCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) sdk.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

	Codespace() sdk.CodespaceType
}

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