Skip to content

Commit

Permalink
feat(#242): Added bankkeeper
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux committed Dec 17, 2024
1 parent a19e9be commit e90941b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/cardchain/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
)

Expand All @@ -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 {
Expand All @@ -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,
}
}

Expand Down
1 change: 1 addition & 0 deletions x/cardchain/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
in.StoreService,
in.Logger,
authority.String(),
in.BankKeeper,
)
m := NewAppModule(
in.Cdc,
Expand Down
6 changes: 6 additions & 0 deletions x/cardchain/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit e90941b

Please sign in to comment.