mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-05-21 14:26:39 +00:00
52 lines
1.0 KiB
Go
52 lines
1.0 KiB
Go
package keeper
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/cometbft/cometbft/libs/log"
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
|
|
|
"planetmint-go/x/asset/types"
|
|
)
|
|
|
|
type (
|
|
Keeper struct {
|
|
cdc codec.BinaryCodec
|
|
storeKey storetypes.StoreKey
|
|
memKey storetypes.StoreKey
|
|
paramstore paramtypes.Subspace
|
|
|
|
machineKeeper types.MachineKeeper
|
|
}
|
|
)
|
|
|
|
func NewKeeper(
|
|
cdc codec.BinaryCodec,
|
|
storeKey,
|
|
memKey storetypes.StoreKey,
|
|
ps paramtypes.Subspace,
|
|
|
|
machineKeeper types.MachineKeeper,
|
|
) *Keeper {
|
|
// set KeyTable if it has not already been set
|
|
if !ps.HasKeyTable() {
|
|
ps = ps.WithKeyTable(types.ParamKeyTable())
|
|
}
|
|
|
|
return &Keeper{
|
|
cdc: cdc,
|
|
storeKey: storeKey,
|
|
memKey: memKey,
|
|
paramstore: ps,
|
|
|
|
machineKeeper: machineKeeper,
|
|
}
|
|
}
|
|
|
|
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
|
|
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
|
|
}
|