-
Notifications
You must be signed in to change notification settings - Fork 1
/
keeper.go
61 lines (53 loc) · 2.11 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
package keeper
import (
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
transfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
"github.com/tendermint/tendermint/libs/log"
"github.com/pundix/pundix/x/ibc/applications/transfer/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
host "github.com/cosmos/ibc-go/v3/modules/core/24-host"
)
// Keeper defines the IBC fungible transfer keeper
type Keeper struct {
ibctransferkeeper.Keeper
storeKey sdk.StoreKey
cdc codec.BinaryCodec
paramSpace paramtypes.Subspace
ics4Wrapper porttypes.ICS4Wrapper
channelKeeper transfertypes.ChannelKeeper
portKeeper transfertypes.PortKeeper
authKeeper transfertypes.AccountKeeper
bankKeeper transfertypes.BankKeeper
scopedKeeper capabilitykeeper.ScopedKeeper
}
// NewKeeper creates a new IBC transfer Keeper instance
func NewKeeper(keeper ibctransferkeeper.Keeper,
cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace,
ics4Wrapper porttypes.ICS4Wrapper, channelKeeper transfertypes.ChannelKeeper, portKeeper transfertypes.PortKeeper,
authKeeper transfertypes.AccountKeeper, bankKeeper transfertypes.BankKeeper, scopedKeeper capabilitykeeper.ScopedKeeper,
) Keeper {
// ensure ibc transfer module account is set
if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil {
panic("the FX IBC transfer module account has not been set")
}
return Keeper{
Keeper: keeper,
cdc: cdc,
storeKey: key,
paramSpace: paramSpace,
ics4Wrapper: ics4Wrapper,
channelKeeper: channelKeeper,
portKeeper: portKeeper,
authKeeper: authKeeper,
bankKeeper: bankKeeper,
scopedKeeper: scopedKeeper,
}
}
// Logger returns a module-specific logger.
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", "x/"+host.ModuleName+"-"+types.CompatibleModuleName)
}