gpu-compute-chain/x/colinear-core/keeper/keeper.go

49 lines
943 B
Go
Raw Normal View History

2022-08-25 16:51:14 -07:00
package keeper
import (
"fmt"
"github.com/tendermint/tendermint/libs/log"
"colinear/x/colinear-core/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))
}