Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func NewQuerier(k Keeper, cdc codec.JSONMarshaler) sdk.Querier
- func NonnegativeBalanceInvariant(k ViewKeeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func TotalSupply(k Keeper) sdk.Invariant
- type BaseKeeper
- func (q BaseKeeper) AllBalances(c context.Context, req *types.QueryAllBalancesRequest) (*types.QueryAllBalancesResponse, error)
- func (q BaseKeeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error)
- func (k BaseKeeper) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
- func (k BaseKeeper) DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error
- func (k BaseKeeper) DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, ...) error
- func (k BaseKeeper) ExportGenesis(ctx sdk.Context) types.GenesisState
- func (k BaseKeeper) GetSupply(ctx sdk.Context) exported.SupplyI
- func (k BaseKeeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k BaseKeeper) MarshalSupply(supplyI exported.SupplyI) ([]byte, error)
- func (k BaseKeeper) MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error
- func (k BaseKeeper) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, ...) error
- func (k BaseKeeper) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, ...) error
- func (k BaseKeeper) SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
- func (k BaseKeeper) SetSupply(ctx sdk.Context, supply exported.SupplyI)
- func (q BaseKeeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*types.QuerySupplyOfResponse, error)
- func (q BaseKeeper) TotalSupply(c context.Context, _ *types.QueryTotalSupplyRequest) (*types.QueryTotalSupplyResponse, error)
- func (k BaseKeeper) UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error
- func (k BaseKeeper) UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, ...) error
- func (k BaseKeeper) UnmarshalSupply(bz []byte) (exported.SupplyI, error)
- type BaseSendKeeper
- func (k BaseSendKeeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
- func (k BaseSendKeeper) BlockedAddr(addr sdk.AccAddress) bool
- func (k BaseSendKeeper) ClearBalances(ctx sdk.Context, addr sdk.AccAddress)
- func (k BaseSendKeeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k BaseSendKeeper) InputOutputCoins(ctx sdk.Context, inputs []types.Input, outputs []types.Output) error
- func (k BaseSendKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
- func (k BaseSendKeeper) SendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool
- func (k BaseSendKeeper) SendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error
- func (k BaseSendKeeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, balance sdk.Coin) error
- func (k BaseSendKeeper) SetBalances(ctx sdk.Context, addr sdk.AccAddress, balances sdk.Coins) error
- func (k BaseSendKeeper) SetParams(ctx sdk.Context, params types.Params)
- func (k BaseSendKeeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
- type BaseViewKeeper
- func (k BaseViewKeeper) GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (k BaseViewKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
- func (k BaseViewKeeper) HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool
- func (k BaseViewKeeper) IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(sdk.Coin) bool)
- func (k BaseViewKeeper) IterateAllBalances(ctx sdk.Context, cb func(sdk.AccAddress, sdk.Coin) bool)
- func (k BaseViewKeeper) LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (k BaseViewKeeper) Logger(ctx sdk.Context) log.Logger
- func (k BaseViewKeeper) SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
- func (k BaseViewKeeper) ValidateBalance(ctx sdk.Context, addr sdk.AccAddress) error
- type Keeper
- type SendKeeper
- type ViewKeeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the X/bank module.
func NewQuerier ¶
func NewQuerier(k Keeper, cdc codec.JSONMarshaler) sdk.Querier
NewQuerier returns a new sdk.Keeper instance.
func NonnegativeBalanceInvariant ¶
func NonnegativeBalanceInvariant(k ViewKeeper) sdk.Invariant
NonnegativeBalanceInvariant checks that all accounts in the application have non-negative balances
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers the bank module invariants
func TotalSupply ¶
TotalSupply checks that the total supply reflects all the coins held in accounts
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( cdc codec.BinaryMarshaler, storeKey sdk.StoreKey, ak types.AccountKeeper, paramSpace paramtypes.Subspace, blockedAddrs map[string]bool, ) BaseKeeper
func (BaseKeeper) AllBalances ¶
func (q BaseKeeper) AllBalances(c context.Context, req *types.QueryAllBalancesRequest) (*types.QueryAllBalancesResponse, error)
AllBalances implements the Query/AllBalances gRPC method
func (BaseKeeper) Balance ¶
func (q BaseKeeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error)
Balance implements the Query/Balance gRPC method
func (BaseKeeper) BurnCoins ¶
BurnCoins burns coins deletes coins from the balance of the module account. It will panic if the module account does not exist or is unauthorized.
func (BaseKeeper) DelegateCoins ¶
func (k BaseKeeper) DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) 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) DelegateCoinsFromAccountToModule ¶
func (k BaseKeeper) DelegateCoinsFromAccountToModule( ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, ) error
DelegateCoinsFromAccountToModule delegates coins and transfers them from a delegator account to a module account. It will panic if the module account does not exist or is unauthorized.
func (BaseKeeper) ExportGenesis ¶
func (k BaseKeeper) ExportGenesis(ctx sdk.Context) types.GenesisState
ExportGenesis returns the bank module's genesis state.
func (BaseKeeper) GetSupply ¶
func (k BaseKeeper) GetSupply(ctx sdk.Context) exported.SupplyI
GetSupply retrieves the Supply from store
func (BaseKeeper) InitGenesis ¶
func (k BaseKeeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
InitGenesis initializes the bank module's state from a given genesis state.
func (BaseKeeper) MarshalSupply ¶
func (k BaseKeeper) MarshalSupply(supplyI exported.SupplyI) ([]byte, error)
MarshalSupply marshals a Supply interface. If the given type implements the Marshaler interface, it is treated as a Proto-defined message and serialized that way. Otherwise, it falls back on the internal Amino codec.
func (BaseKeeper) MintCoins ¶
MintCoins creates new coins from thin air and adds it to the module account. It will panic if the module account does not exist or is unauthorized.
func (BaseKeeper) SendCoinsFromAccountToModule ¶
func (k BaseKeeper) SendCoinsFromAccountToModule( ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins, ) error
SendCoinsFromAccountToModule transfers coins from an AccAddress to a ModuleAccount. It will panic if the module account does not exist.
func (BaseKeeper) SendCoinsFromModuleToAccount ¶
func (k BaseKeeper) SendCoinsFromModuleToAccount( ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, ) error
SendCoinsFromModuleToAccount transfers coins from a ModuleAccount to an AccAddress. It will panic if the module account does not exist.
func (BaseKeeper) SendCoinsFromModuleToModule ¶
func (k BaseKeeper) SendCoinsFromModuleToModule( ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins, ) error
SendCoinsFromModuleToModule transfers coins from a ModuleAccount to another. It will panic if either module account does not exist.
func (BaseKeeper) SetSupply ¶
func (k BaseKeeper) SetSupply(ctx sdk.Context, supply exported.SupplyI)
SetSupply sets the Supply to store
func (BaseKeeper) SupplyOf ¶
func (q BaseKeeper) SupplyOf(c context.Context, req *types.QuerySupplyOfRequest) (*types.QuerySupplyOfResponse, error)
SupplyOf implements the Query/SupplyOf gRPC method
func (BaseKeeper) TotalSupply ¶
func (q BaseKeeper) TotalSupply(c context.Context, _ *types.QueryTotalSupplyRequest) (*types.QueryTotalSupplyResponse, error)
TotalSupply implements the Query/TotalSupply gRPC method
func (BaseKeeper) UndelegateCoins ¶
func (k BaseKeeper) UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) 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.
func (BaseKeeper) UndelegateCoinsFromModuleToAccount ¶
func (k BaseKeeper) UndelegateCoinsFromModuleToAccount( ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins, ) error
UndelegateCoinsFromModuleToAccount undelegates the unbonding coins and transfers them from a module account to the delegator account. It will panic if the module account does not exist or is unauthorized.
func (BaseKeeper) UnmarshalSupply ¶
func (k BaseKeeper) UnmarshalSupply(bz []byte) (exported.SupplyI, error)
UnmarshalSupply returns a Supply interface from raw encoded supply bytes of a Proto-based Supply type. An error is returned upon decoding failure.
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( cdc codec.BinaryMarshaler, storeKey sdk.StoreKey, ak types.AccountKeeper, paramSpace paramtypes.Subspace, blockedAddrs map[string]bool, ) BaseSendKeeper
func (BaseSendKeeper) AddCoins ¶
func (k BaseSendKeeper) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
AddCoins adds amt to the account balance given by the provided address. An error is returned if the initial amount is invalid or if any resulting new balance is negative.
func (BaseSendKeeper) BlockedAddr ¶
func (k BaseSendKeeper) BlockedAddr(addr sdk.AccAddress) bool
BlockedAddr checks if a given address is restricted from receiving funds.
func (BaseSendKeeper) ClearBalances ¶
func (k BaseSendKeeper) ClearBalances(ctx sdk.Context, addr sdk.AccAddress)
ClearBalances removes all balances for a given account by address.
func (BaseSendKeeper) GetParams ¶
func (k BaseSendKeeper) GetParams(ctx sdk.Context) (params types.Params)
GetParams returns the total set of bank parameters.
func (BaseSendKeeper) InputOutputCoins ¶
func (k BaseSendKeeper) InputOutputCoins(ctx sdk.Context, inputs []types.Input, outputs []types.Output) error
InputOutputCoins performs multi-send functionality. It accepts a series of inputs that correspond to a series of outputs. It returns an error if the inputs and outputs don't lineup or if any single transfer of tokens fails.
func (BaseSendKeeper) SendCoins ¶
func (k BaseSendKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error
SendCoins transfers amt coins from a sending account to a receiving account. An error is returned upon failure.
func (BaseSendKeeper) SendEnabledCoin ¶
SendEnabledCoin returns the current SendEnabled status of the provided coin's denom
func (BaseSendKeeper) SendEnabledCoins ¶
SendEnabledCoins checks the coins provide and returns an ErrSendDisabled if any of the coins are not configured for sending. Returns nil if sending is enabled for all provided coin
func (BaseSendKeeper) SetBalance ¶
func (k BaseSendKeeper) SetBalance(ctx sdk.Context, addr sdk.AccAddress, balance sdk.Coin) error
SetBalance sets the coin balance for an account by address.
func (BaseSendKeeper) SetBalances ¶
func (k BaseSendKeeper) SetBalances(ctx sdk.Context, addr sdk.AccAddress, balances sdk.Coins) error
SetBalances sets the balance (multiple coins) for an account by address. It will clear out all balances prior to setting the new coins as to set existing balances to zero if they don't exist in amt. An error is returned upon failure.
func (BaseSendKeeper) SetParams ¶
func (k BaseSendKeeper) SetParams(ctx sdk.Context, params types.Params)
SetParams sets the total set of bank parameters.
func (BaseSendKeeper) SubtractCoins ¶
func (k BaseSendKeeper) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error)
SubtractCoins removes amt coins the account by the given address. An error is returned if the resulting balance is negative or the initial amount is invalid.
type BaseViewKeeper ¶
type BaseViewKeeper struct {
// contains filtered or unexported fields
}
BaseViewKeeper implements a read only keeper implementation of ViewKeeper.
func NewBaseViewKeeper ¶
func NewBaseViewKeeper(cdc codec.BinaryMarshaler, storeKey sdk.StoreKey, ak types.AccountKeeper) BaseViewKeeper
NewBaseViewKeeper returns a new BaseViewKeeper.
func (BaseViewKeeper) GetAllBalances ¶
func (k BaseViewKeeper) GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
GetAllBalances returns all the account balances for the given account address.
func (BaseViewKeeper) GetBalance ¶
func (k BaseViewKeeper) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
GetBalance returns the balance of a specific denomination for a given account by address.
func (BaseViewKeeper) HasBalance ¶
func (k BaseViewKeeper) HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool
HasBalance returns whether or not an account has at least amt balance.
func (BaseViewKeeper) IterateAccountBalances ¶
func (k BaseViewKeeper) IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(sdk.Coin) bool)
IterateAccountBalances iterates over the balances of a single account and provides the token balance to a callback. If true is returned from the callback, iteration is halted.
func (BaseViewKeeper) IterateAllBalances ¶
func (k BaseViewKeeper) IterateAllBalances(ctx sdk.Context, cb func(sdk.AccAddress, sdk.Coin) bool)
IterateAllBalances iterates over all the balances of all accounts and denominations that are provided to a callback. If true is returned from the callback, iteration is halted.
func (BaseViewKeeper) LockedCoins ¶
func (k BaseViewKeeper) LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
LockedCoins returns all the coins that are not spendable (i.e. locked) for an account by address. For standard accounts, the result will always be no coins. For vesting accounts, LockedCoins is delegated to the concrete vesting account type.
func (BaseViewKeeper) Logger ¶
func (k BaseViewKeeper) Logger(ctx sdk.Context) log.Logger
Logger returns a module-specific logger.
func (BaseViewKeeper) SpendableCoins ¶
func (k BaseViewKeeper) SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
SpendableCoins returns the total balances of spendable coins for an account by address. If the account has no spendable coins, an empty Coins slice is returned.
func (BaseViewKeeper) ValidateBalance ¶
func (k BaseViewKeeper) ValidateBalance(ctx sdk.Context, addr sdk.AccAddress) error
ValidateBalance validates all balances for a given account address returning an error if any balance is invalid. It will check for vesting account types and validate the balances against the original vesting balances.
CONTRACT: ValidateBalance should only be called upon genesis state. In the case of vesting accounts, balances may change in a valid manner that would otherwise yield an error from this call.
type Keeper ¶
type Keeper interface { SendKeeper InitGenesis(sdk.Context, types.GenesisState) ExportGenesis(sdk.Context) types.GenesisState GetSupply(ctx sdk.Context) exported.SupplyI SetSupply(ctx sdk.Context, supply exported.SupplyI) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error DelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) error UndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error MarshalSupply(supplyI exported.SupplyI) ([]byte, error) UnmarshalSupply(bz []byte) (exported.SupplyI, error) types.QueryServer }
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) SetBalance(ctx sdk.Context, addr sdk.AccAddress, balance sdk.Coin) error SetBalances(ctx sdk.Context, addr sdk.AccAddress, balances sdk.Coins) error GetParams(ctx sdk.Context) types.Params SetParams(ctx sdk.Context, params types.Params) SendEnabledCoin(ctx sdk.Context, coin sdk.Coin) bool SendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error BlockedAddr(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 { ValidateBalance(ctx sdk.Context, addr sdk.AccAddress) error HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin LockedCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins IterateAccountBalances(ctx sdk.Context, addr sdk.AccAddress, cb func(coin sdk.Coin) (stop bool)) IterateAllBalances(ctx sdk.Context, cb func(address sdk.AccAddress, coin sdk.Coin) (stop bool)) }
ViewKeeper defines a module interface that facilitates read only access to account balances.