gpu-compute-chain/x/colinearcore/keeper/keeper.go

49 lines
942 B
Go
Raw Normal View History

2022-08-25 16:51:14 -07:00
package keeper
import (
"fmt"
"github.com/tendermint/tendermint/libs/log"
2022-09-06 15:18:09 -07:00
"colinear/x/colinearcore/types"
2022-08-25 16:51:14 -07:00
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)
type (
Keeper struct {
cdc codec.BinaryCodec
storeKey sdk.StoreKey
memKey sdk.StoreKey
paramstore paramtypes.Subspace
bank types.BankKeeper
2022-08-25 16:51:14 -07:00
}
)
func NewKeeper(
cdc codec.BinaryCodec,
storeKey,
memKey sdk.StoreKey,
ps paramtypes.Subspace,
bank types.BankKeeper,
2022-08-25 16:51:14 -07:00
) *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,
bank: bank,
2022-08-25 16:51:14 -07:00
}
}
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}