forked from osmosis-labs/osmosis
/
keeper.go
63 lines (52 loc) · 1.68 KB
/
keeper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package keeper
import (
"fmt"
"github.com/PaddyMc/osmosis/v8/x/superfluid/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)
// Keeper provides a way to manage module storage.
type Keeper struct {
cdc codec.Codec
storeKey sdk.StoreKey
paramSpace paramtypes.Subspace
ak authkeeper.AccountKeeper
bk types.BankKeeper
sk types.StakingKeeper
dk types.DistrKeeper
ek types.EpochKeeper
lk types.LockupKeeper
gk types.GammKeeper
ik types.IncentivesKeeper
lms types.LockupMsgServer
}
var _ govtypes.StakingKeeper = (*Keeper)(nil)
// NewKeeper returns an instance of Keeper.
func NewKeeper(cdc codec.Codec, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, ak authkeeper.AccountKeeper, bk types.BankKeeper, sk types.StakingKeeper, dk types.DistrKeeper, ek types.EpochKeeper, lk types.LockupKeeper, gk types.GammKeeper, ik types.IncentivesKeeper, lms types.LockupMsgServer) *Keeper {
// set KeyTable if it has not already been set
if !paramSpace.HasKeyTable() {
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable())
}
return &Keeper{
cdc: cdc,
storeKey: storeKey,
paramSpace: paramSpace,
ak: ak,
bk: bk,
sk: sk,
dk: dk,
ek: ek,
lk: lk,
gk: gk,
ik: ik,
lms: lms,
}
}
// Logger returns a logger instance.
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}