keeper

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTFDenomStore

func NewTFDenomStore(
	storeKey storetypes.StoreKey, cdc sdkcodec.BinaryCodec,
) collections.IndexedMap[storePKType, storeVType, IndexesTokenFactory]

NewTFDenomStore: Creates an indexed map over token facotry denoms indexed by creator address.

Types

type IndexesTokenFactory

type IndexesTokenFactory struct {
	// Creator MultiIndex:
	//  - indexing key (IK): bech32 address of the creator of TF denom.
	//  - primary key (PK): full TF denom of the form 'factory/{creator}/{subdenom}'
	//  - value (V): struct version of TF denom with validate function
	Creator collections.MultiIndex[string, string, storeVType]
}

IndexesTokenFactory: Abstraction for indexing over the TF denom store.

func (IndexesTokenFactory) IndexerList

func (idxs IndexesTokenFactory) IndexerList() []collections.Indexer[string, storeVType]

type Keeper

type Keeper struct {
	Store StoreAPI
	// contains filtered or unexported fields
}

Keeper of this module maintains collections of feeshares for contracts registered to receive Nibiru Chain gas fees.

func NewKeeper

func NewKeeper(
	storeKey storetypes.StoreKey,
	cdc codec.BinaryCodec,
	bk tftypes.BankKeeper,
	ak tftypes.AccountKeeper,
	communityPoolKeeper tftypes.CommunityPoolKeeper,
	authority string,
) Keeper

NewKeeper: creates a Keeper instance for the module.

func (Keeper) Burn

func (k Keeper) Burn(
	goCtx context.Context, txMsg *types.MsgBurn,
) (resp *types.MsgBurnResponse, err error)

Burn: Message handler for the abci.Msg: MsgBurn

func (Keeper) ChangeAdmin

func (k Keeper) ChangeAdmin(
	goCtx context.Context, txMsg *types.MsgChangeAdmin,
) (resp *types.MsgChangeAdminResponse, err error)

func (Keeper) CreateDenom

func (k Keeper) CreateDenom(
	goCtx context.Context, txMsg *types.MsgCreateDenom,
) (resp *types.MsgCreateDenomResponse, err error)

func (Keeper) CreateModuleAccount

func (k Keeper) CreateModuleAccount(ctx sdk.Context)

CreateModuleAccount creates a module account with minting and burning capabilities This account isn't intended to store any coins, it purely mints and burns them on behalf of the admin of respective denoms, and sends to the relevant address.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the tokenfactory module's exported genesis.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/feeshare module's authority.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)

InitGenesis initializes the tokenfactory module's state from a provided genesis state.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) Mint

func (k Keeper) Mint(
	goCtx context.Context, txMsg *types.MsgMint,
) (resp *types.MsgMintResponse, err error)

Mint: Message handler for the abci.Msg: MsgMint

func (Keeper) Querier

func (k Keeper) Querier() Querier

func (Keeper) QueryDenomInfo

func (k Keeper) QueryDenomInfo(
	ctx sdk.Context, denom string,
) (resp *types.QueryDenomInfoResponse, err error)

QueryDenomInfo: Returns bank and tokenfactory metadata for a registered denom.

func (Keeper) QueryDenoms

func (k Keeper) QueryDenoms(ctx sdk.Context, creator string) []string

QueryDenoms: Returns all registered denoms for a given creator.

func (Keeper) SetDenomMetadata

func (k Keeper) SetDenomMetadata(
	goCtx context.Context, txMsg *types.MsgSetDenomMetadata,
) (resp *types.MsgSetDenomMetadataResponse, err error)

SetDenomMetadata: Message handler for the abci.Msg: MsgSetDenomMetadata

func (Keeper) UpdateModuleParams

func (k Keeper) UpdateModuleParams(
	goCtx context.Context, txMsg *types.MsgUpdateModuleParams,
) (resp *types.MsgUpdateModuleParamsResponse, err error)

UpdateModuleParams: Message handler for the abci.Msg: MsgUpdateModuleParams

type Querier

type Querier struct {
	Keeper
}

Querier defines a wrapper around the keeper with functions for gRPC queries.

func (Querier) DenomInfo

func (q Querier) DenomInfo(
	goCtx context.Context,
	req *types.QueryDenomInfoRequest,
) (resp *types.QueryDenomInfoResponse, err error)

DenomInfo: Returns bank and tokenfactory metadata for a registered denom.

func (Querier) Denoms

func (q Querier) Denoms(
	goCtx context.Context,
	req *types.QueryDenomsRequest,
) (resp *types.QueryDenomsResponse, err error)

Denoms: Returns all registered denoms for a given creator.

func (Querier) Params

Params: Returns the module parameters.

type StoreAPI

type StoreAPI struct {
	// Denoms: IndexedMap
	//  - primary key (PK): Token factory denom (TFDenom) as a string
	//  - value (V): TFDenom payload with validation
	//  - indexers (I): Indexed by creator for easy querying
	Denoms       collections.IndexedMap[storePKType, storeVType, IndexesTokenFactory]
	ModuleParams collections.Item[tftypes.ModuleParams]
	// contains filtered or unexported fields
}

StoreAPI isolates the collections for the x/tokenfactory module. Ultimately, the denoms are registered in the x/bank module if valid. Because of this, a denom cannot be deleted once it exists.

The StoreAPI hides private methods to make the developer experience less error-prone when working on the module.

func (StoreAPI) GetAdmin

func (api StoreAPI) GetAdmin(
	ctx sdk.Context, denom string,
) (string, error)

func (StoreAPI) GetDenomAuthorityMetadata

func (api StoreAPI) GetDenomAuthorityMetadata(
	ctx sdk.Context, denom string,
) (tftypes.DenomAuthorityMetadata, error)

GetDenomAuthorityMetadata returns the admin (authority metadata) for a specific denom. This differs from the x/bank metadata.

func (StoreAPI) HasCreator

func (api StoreAPI) HasCreator(ctx sdk.Context, creator string) bool

func (StoreAPI) HasDenom

func (api StoreAPI) HasDenom(
	ctx sdk.Context, denom tftypes.TFDenom,
) bool

HasDenom: True if the denom has already been registered.

func (StoreAPI) InsertDenom

func (api StoreAPI) InsertDenom(
	ctx sdk.Context, denom tftypes.TFDenom,
) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL