Documentation ¶
Index ¶
- Constants
- func NewQuerier(k Keeper) sdk.Querier
- func NonnegativeBalanceInvariant(ak types.AccountKeeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, ak types.AccountKeeper)
- type BaseKeeper
- type BaseSendKeeper
- func (keeper BaseSendKeeper) AddTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) (sdk.Tokens, sdk.Error)
- func (keeper BaseSendKeeper) BlacklistedAddr(addr sdk.AccAddress) bool
- func (keeper BaseSendKeeper) GetSendEnabled(ctx sdk.Context) bool
- func (keeper BaseSendKeeper) InputOutputTokens(ctx sdk.Context, inputs []types.Input, outputs []types.Output) sdk.Error
- func (keeper BaseSendKeeper) SendTokens(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, ...) sdk.Error
- func (keeper BaseSendKeeper) SetSendEnabled(ctx sdk.Context, enabled bool)
- func (keeper BaseSendKeeper) SetTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) sdk.Error
- func (keeper BaseSendKeeper) SubtractTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) (sdk.Tokens, sdk.Error)
- type BaseViewKeeper
- func (keeper BaseViewKeeper) Codespace() sdk.CodespaceType
- func (keeper BaseViewKeeper) GetTokens(ctx sdk.Context, addr sdk.AccAddress) sdk.Tokens
- func (keeper BaseViewKeeper) HasTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) bool
- func (keeper BaseViewKeeper) Logger(ctx sdk.Context) log.Logger
- type Keeper
- type SendKeeper
- type ViewKeeper
Constants ¶
const (
// query balance path
QueryBalance = "balances"
)
Variables ¶
This section is empty.
Functions ¶
func NewQuerier ¶
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) DelegateTokens ¶
func (keeper BaseKeeper) DelegateTokens(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Tokens) sdk.Error
DelegateTokens performs delegation by deducting amt tokens from an account with address addr. For vesting accounts, delegations amounts are tracked for both vesting and vested tokens. The tokens 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) UndelegateTokens ¶
func (keeper BaseKeeper) UndelegateTokens(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Tokens) sdk.Error
UndelegateTokens performs undelegation by crediting amt tokens to an account with address addr. For vesting accounts, undelegation amounts are tracked for both vesting and vested tokens. The tokens 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 tokens. 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) AddTokens ¶
func (keeper BaseSendKeeper) AddTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) (sdk.Tokens, sdk.Error)
AddTokens adds amt to the tokens 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) InputOutputTokens ¶
func (keeper BaseSendKeeper) InputOutputTokens(ctx sdk.Context, inputs []types.Input, outputs []types.Output) sdk.Error
InputOutputTokens handles a list of inputs and outputs
func (BaseSendKeeper) SendTokens ¶
func (keeper BaseSendKeeper) SendTokens(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Tokens) sdk.Error
SendTokens moves tokens from one account to another
func (BaseSendKeeper) SetSendEnabled ¶
func (keeper BaseSendKeeper) SetSendEnabled(ctx sdk.Context, enabled bool)
SetSendEnabled sets the send enabled
func (BaseSendKeeper) SetTokens ¶
func (keeper BaseSendKeeper) SetTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) sdk.Error
SetTokens sets the tokens at the addr.
func (BaseSendKeeper) SubtractTokens ¶
func (keeper BaseSendKeeper) SubtractTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) (sdk.Tokens, sdk.Error)
SubtractTokens subtracts amt from the tokens 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) GetTokens ¶
func (keeper BaseViewKeeper) GetTokens(ctx sdk.Context, addr sdk.AccAddress) sdk.Tokens
GetTokens returns the tokens at the addr.
func (BaseViewKeeper) HasTokens ¶
func (keeper BaseViewKeeper) HasTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) bool
HasTokens returns whether or not an account has at least amt tokens.
type Keeper ¶
type Keeper interface { SendKeeper DelegateTokens(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Tokens) sdk.Error UndelegateTokens(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Tokens) sdk.Error }
Keeper defines a module interface that facilitates the transfer of tokens between accounts.
type SendKeeper ¶
type SendKeeper interface { ViewKeeper InputOutputTokens(ctx sdk.Context, inputs []types.Input, outputs []types.Output) sdk.Error SendTokens(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Tokens) sdk.Error SubtractTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) (sdk.Tokens, sdk.Error) AddTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) (sdk.Tokens, sdk.Error) SetTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) 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 tokens between accounts without the possibility of creating tokens.
type ViewKeeper ¶
type ViewKeeper interface { GetTokens(ctx sdk.Context, addr sdk.AccAddress) sdk.Tokens HasTokens(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Tokens) bool Codespace() sdk.CodespaceType }
ViewKeeper defines a module interface that facilitates read only access to account balances.