From 96739800b2f555d82cbf61760bb2e47635e7c718 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Tue, 9 Apr 2024 16:04:17 +0200 Subject: [PATCH] feat(auction): add bank interface --- app/app.go | 1 + x/auction/expected_keepers.go | 13 +++++++++++-- x/auction/keeper/keeper.go | 7 +++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index c15e9a5fcf..48395c5f8b 100644 --- a/app/app.go +++ b/app/app.go @@ -510,6 +510,7 @@ func New( app.AuctionKeeperB = auctionkeeper.NewBuilder( appCodec, keys[auction.StoreKey], + app.BankKeeper, ) // register the staking hooks diff --git a/x/auction/expected_keepers.go b/x/auction/expected_keepers.go index 22d7036807..da4bdb242d 100644 --- a/x/auction/expected_keepers.go +++ b/x/auction/expected_keepers.go @@ -1,4 +1,13 @@ package auction -// TODO: create a shared interface for bank keeper in /sdkutils -type BankKeeper interface{} +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BankKeeper defines the expected x/bank keeper interface. +type BankKeeper interface { + SendCoinsFromModuleToAccount(ctx sdk.Context, fromModule string, toAddr sdk.AccAddress, coins sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, fromAddr sdk.AccAddress, toModule string, coins sdk.Coins) error + SendCoinsFromModuleToModule(ctx sdk.Context, fromModule string, toModule string, coins sdk.Coins) error + SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins +} diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index c086b5b474..2f957c4ce6 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -4,15 +4,18 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/umee-network/umee/v6/x/auction" ) type Builder struct { cdc codec.Codec storeKey storetypes.StoreKey + bank auction.BankKeeper } -func NewBuilder(cdc codec.Codec, key storetypes.StoreKey) Builder { - return Builder{cdc: cdc, storeKey: key} +func NewBuilder(cdc codec.Codec, key storetypes.StoreKey, b auction.BankKeeper) Builder { + return Builder{cdc: cdc, storeKey: key, bank: b} } func (kb Builder) Keeper(ctx *sdk.Context) Keeper {