Skip to content

Commit

Permalink
feat(auction): add bank interface
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Apr 11, 2024
1 parent 3b3461c commit 9673980
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ func New(
app.AuctionKeeperB = auctionkeeper.NewBuilder(
appCodec,
keys[auction.StoreKey],
app.BankKeeper,
)

// register the staking hooks
Expand Down
13 changes: 11 additions & 2 deletions x/auction/expected_keepers.go
Original file line number Diff line number Diff line change
@@ -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
}
7 changes: 5 additions & 2 deletions x/auction/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9673980

Please sign in to comment.