From e90941bdc8f173806d87ced97a4f354847599037 Mon Sep 17 00:00:00 2001 From: lxgr-linux Date: Tue, 17 Dec 2024 04:14:03 +0100 Subject: [PATCH] feat(#242): Added bankkeeper --- x/cardchain/keeper/keeper.go | 5 +++++ x/cardchain/module/module.go | 1 + x/cardchain/types/expected_keepers.go | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/x/cardchain/keeper/keeper.go b/x/cardchain/keeper/keeper.go index d5ec4748..0ee57428 100644 --- a/x/cardchain/keeper/keeper.go +++ b/x/cardchain/keeper/keeper.go @@ -32,6 +32,8 @@ type ( // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string + + BankKeeper types.BankKeeper } ) @@ -40,6 +42,7 @@ func NewKeeper( storeService store.KVStoreService, logger log.Logger, authority string, + bankKeeper types.BankKeeper, ) Keeper { if _, err := sdk.AccAddressFromBech32(authority); err != nil { @@ -62,6 +65,8 @@ func NewKeeper( Images: gtk.NewGTK[*types.Image]("Images", storeService, cdc, gtk.GetEmpty[types.Image]), Servers: gtk.NewGTK[*types.Server]("Servers", storeService, cdc, gtk.GetEmpty[types.Server]), Encounters: gtk.NewGTK[*types.Encounter]("Encounters", storeService, cdc, gtk.GetEmpty[types.Encounter]), + + BankKeeper: bankKeeper, } } diff --git a/x/cardchain/module/module.go b/x/cardchain/module/module.go index e15265a3..dcff5bfe 100644 --- a/x/cardchain/module/module.go +++ b/x/cardchain/module/module.go @@ -202,6 +202,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { in.StoreService, in.Logger, authority.String(), + in.BankKeeper, ) m := NewAppModule( in.Cdc, diff --git a/x/cardchain/types/expected_keepers.go b/x/cardchain/types/expected_keepers.go index 4a50d01a..94466ccd 100644 --- a/x/cardchain/types/expected_keepers.go +++ b/x/cardchain/types/expected_keepers.go @@ -15,6 +15,12 @@ type AccountKeeper interface { // BankKeeper defines the expected interface for the Bank module. type BankKeeper interface { SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromModuleToModule(ctx context.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error // Methods imported from bank should be defined here }