The bank module provides these exported keeper interfaces that can be passed to other modules that read or update account balances. Modules should use the least-permissive interface that provides the functionality they require.
Best practices dictate careful review of bank module code to ensure that permissions are limited in the way that you expect.
Blocklisting Addresses
The x/bank module accepts a map of addresses that are considered blocklisted from directly and explicitly receiving funds through means such as MsgSend and MsgMultiSend and direct API calls like SendCoinsFromModuleToAccount.
Typically, these addresses are module accounts. If these addresses receive funds outside the expected rules of the state machine, invariants are likely to be broken and could result in a halted network.
By providing the x/bank module with a blocklisted set of addresses, an error occurs for the operation if a user or client attempts to directly or indirectly send funds to a blocklisted account, for example, by using IBC.
The base keeper provides full-permission access: the ability to arbitrary modify any account's balance and mint or burn coins.
Restricted permission to mint per module could be achieved by using baseKeeper with WithMintCoinsRestriction to give specific restrictions to mint (e.g. only minting certain denom).
// Keeper defines a module interface that facilitates the transfer of coins// between accounts.typeKeeperinterface {SendKeeperWithMintCoinsRestriction(MintingRestrictionFn) BaseKeeperInitGenesis(sdk.Context, *types.GenesisState)ExportGenesis(sdk.Context) *types.GenesisStateGetSupply(ctx sdk.Context, denom string) sdk.CoinHasSupply(ctx sdk.Context, denom string) boolGetPaginatedTotalSupply(ctx sdk.Context, pagination *query.PageRequest) (sdk.Coins, *query.PageResponse, error)IterateTotalSupply(ctx sdk.Context, cb func(sdk.Coin) bool)GetDenomMetaData(ctx sdk.Context, denom string) (types.Metadata, bool)HasDenomMetaData(ctx sdk.Context, denom string) boolSetDenomMetaData(ctx sdk.Context, denomMetaData types.Metadata)IterateAllDenomMetaData(ctx sdk.Context, cb func(types.Metadata) bool)SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) errorSendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) errorSendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) errorDelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) errorUndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) errorMintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) errorBurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) errorDelegateCoins(ctx sdk.Context, delegatorAddr, moduleAccAddr sdk.AccAddress, amt sdk.Coins) errorUndelegateCoins(ctx sdk.Context, moduleAccAddr, delegatorAddr sdk.AccAddress, amt sdk.Coins) error// GetAuthority gets the address capable of executing governance proposal messages. Usually the gov module account.GetAuthority() stringtypes.QueryServer}
SendKeeper
The send keeper provides access to account balances and the ability to transfer coins between accounts. The send keeper does not alter the total supply (mint or burn coins).
// SendKeeper defines a module interface that facilitates the transfer of coins// between accounts without the possibility of creating coins.typeSendKeeperinterface {ViewKeeperInputOutputCoins(ctx sdk.Context, inputs []types.Input, outputs []types.Output) errorSendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) errorGetParams(ctx sdk.Context) types.ParamsSetParams(ctx sdk.Context, params types.Params) errorIsSendEnabledDenom(ctx sdk.Context, denom string) boolSetSendEnabled(ctx sdk.Context, denom string, value bool)SetAllSendEnabled(ctx sdk.Context, sendEnableds []*types.SendEnabled)DeleteSendEnabled(ctx sdk.Context, denom string)IterateSendEnabledEntries(ctx sdk.Context, cb func(denom string, sendEnabled bool) (stop bool))GetAllSendEnabledEntries(ctx sdk.Context) []types.SendEnabledIsSendEnabledCoin(ctx sdk.Context, coin sdk.Coin) boolIsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) errorBlockedAddr(addr sdk.AccAddress) bool}
ViewKeeper
The view keeper provides read-only access to account balances. The view keeper does not have balance alteration functionality. All balance lookups are O(1).