From 7a463853efb9a2f952e14c5cade7020fd2d4683f Mon Sep 17 00:00:00 2001 From: Runchao Han Date: Tue, 3 Dec 2024 11:50:39 +1100 Subject: [PATCH] pass concrete keeper --- x/babylon/keeper/keeper.go | 5 +++-- x/babylon/keeper/keeper_test.go | 2 +- x/babylon/keeper/options.go | 4 ++-- x/babylon/keeper/wasm.go | 4 ++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/x/babylon/keeper/keeper.go b/x/babylon/keeper/keeper.go index 188c3d0..3fff6b3 100644 --- a/x/babylon/keeper/keeper.go +++ b/x/babylon/keeper/keeper.go @@ -5,6 +5,7 @@ import ( "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,7 +22,7 @@ type Keeper struct { cdc codec.Codec bank types.BankKeeper Staking types.StakingKeeper - wasm types.WasmKeeper + wasm *wasmkeeper.Keeper // the address capable of executing a MsgUpdateParams message. Typically, this // should be the x/gov module account. authority string @@ -34,7 +35,7 @@ func NewKeeper( memoryStoreKey storetypes.StoreKey, bank types.BankKeeper, staking types.StakingKeeper, - wasm types.WasmKeeper, + wasm *wasmkeeper.Keeper, authority string, opts ...Option, ) *Keeper { diff --git a/x/babylon/keeper/keeper_test.go b/x/babylon/keeper/keeper_test.go index 3bb2123..e69bd37 100644 --- a/x/babylon/keeper/keeper_test.go +++ b/x/babylon/keeper/keeper_test.go @@ -279,7 +279,7 @@ func NewTestKeepers(t testing.TB, opts ...keeper.Option) TestKeepers { memKeys[types.MemStoreKey], bankKeeper, stakingKeeper, - wasmKeeper, + &wasmKeeper, authority, opts..., ) diff --git a/x/babylon/keeper/options.go b/x/babylon/keeper/options.go index 322f869..0b6f151 100644 --- a/x/babylon/keeper/options.go +++ b/x/babylon/keeper/options.go @@ -1,6 +1,6 @@ package keeper -import "github.com/babylonlabs-io/babylon-sdk/x/babylon/types" +import wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" // option that is applied after keeper is setup with the VM. Used for decorators mainly. type postOptsFn func(*Keeper) @@ -10,7 +10,7 @@ func (f postOptsFn) apply(keeper *Keeper) { } // WithWasmKeeperDecorated can set a decorator to the wasm keeper -func WithWasmKeeperDecorated(cb func(types.WasmKeeper) types.WasmKeeper) Option { +func WithWasmKeeperDecorated(cb func(*wasmkeeper.Keeper) *wasmkeeper.Keeper) Option { return postOptsFn(func(keeper *Keeper) { keeper.wasm = cb(keeper.wasm) }) diff --git a/x/babylon/keeper/wasm.go b/x/babylon/keeper/wasm.go index 60bad02..3e316d9 100644 --- a/x/babylon/keeper/wasm.go +++ b/x/babylon/keeper/wasm.go @@ -11,6 +11,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +func (k Keeper) StoreBabylonContracts(ctx sdk.Context) error { + return nil +} + func (k Keeper) getBTCStakingContractAddr(ctx sdk.Context) sdk.AccAddress { // get address of the BTC staking contract addrStr := k.GetParams(ctx).BtcStakingContractAddress