Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ExtraAccountTypes map[reflect.Type]struct{}
ExtraAccountTypes is a map of extra account types that can be overridden. This is defined as a global variable so it can be modified in the chain's app.go and used here without having to import the chain. Specifically, this is used for compatibility with Osmosis' Cosmos SDK fork
Functions ¶
func CanCreateModuleAccountAtAddr ¶
func CanCreateModuleAccountAtAddr(ctx sdk.Context, ak types.AccountKeeper, addr sdk.AccAddress) error
CanCreateModuleAccountAtAddr tells us if we can safely make a module account at a given address. By collision resistance of the address (given API safe construction), the only way for an account to be already be at this address is if its claimed by the same pre-image from the correct module, or some SDK command breaks assumptions and creates an account at designated address. This function checks if there is an account at that address, and runs some safety checks to be extra-sure its not a user account (e.g. non-zero sequence, pubkey, of fore-seen account types). If there is no account, or if we believe its not a user-spendable account, we allow module account creation at the address. else, we do not.
TODO: This is generally from an SDK design flaw code based off wasmd code: https://github.com/CosmWasm/wasmd/pull/996 Its _mandatory_ that the caller do the API safe construction to generate a module account addr, namely, address.Module(ModuleName, {key})
func CreateModuleAccount ¶
func CreateModuleAccount(ctx sdk.Context, ak types.AccountKeeper, addr sdk.AccAddress) error
CreateModuleAccount creates a module account at the provided address. It overrides an account if it exists at that address, with a non-zero sequence number & pubkey Contract: addr is derived from `address.Module(ModuleName, key)`
Types ¶
This section is empty.