From 253863c03b7164bb6417837d8a6ffddbe56c2bbb Mon Sep 17 00:00:00 2001 From: "jaeseung.bae" Date: Wed, 7 Feb 2024 15:49:18 +0900 Subject: [PATCH] chore: introduce DeactMultiSend type and DI provider --- simapp/app_config.go | 13 +++++++++++-- x/bankplus/keeper/keeper_test.go | 4 ++-- x/bankplus/module/module.go | 25 +++++++------------------ 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/simapp/app_config.go b/simapp/app_config.go index 3984666a95..561feb2a5e 100644 --- a/simapp/app_config.go +++ b/simapp/app_config.go @@ -73,7 +73,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" foundationmodulev1 "github.com/Finschia/finschia-sdk/api/lbm/foundation/module/v1" - _ "github.com/Finschia/finschia-sdk/x/bankplus/module" // import for side-effects + bankplus "github.com/Finschia/finschia-sdk/x/bankplus/module" "github.com/Finschia/finschia-sdk/x/foundation" _ "github.com/Finschia/finschia-sdk/x/foundation/module" // import for side-effects ) @@ -291,5 +291,14 @@ var ( }, ), }, - )) + ), + depinject.Provide( + ProvideBankPlusDeactMultiSend, + ), + ) ) + +func ProvideBankPlusDeactMultiSend() bankplus.DeactMultiSend { + // FIXME: move to Env or Configuration + return true +} diff --git a/x/bankplus/keeper/keeper_test.go b/x/bankplus/keeper/keeper_test.go index 6af692713c..f765fbdccb 100644 --- a/x/bankplus/keeper/keeper_test.go +++ b/x/bankplus/keeper/keeper_test.go @@ -3,13 +3,12 @@ package keeper import ( "testing" - coreaddress "cosmossdk.io/core/address" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" cmttime "github.com/cometbft/cometbft/types/time" - "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" + coreaddress "cosmossdk.io/core/address" "cosmossdk.io/core/store" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" @@ -23,6 +22,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" "github.com/cosmos/cosmos-sdk/x/bank/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" diff --git a/x/bankplus/module/module.go b/x/bankplus/module/module.go index b19edfc1a1..3a8d7b34f6 100644 --- a/x/bankplus/module/module.go +++ b/x/bankplus/module/module.go @@ -13,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/bank" "github.com/cosmos/cosmos-sdk/x/bank/exported" @@ -84,20 +83,8 @@ func (a AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.R a.bankAppModule.InitGenesis(ctx, cdc, data) } -func (a AppModule) ExportGenesis(ctx sdk.Context, codec codec.JSONCodec) json.RawMessage { - return a.bankAppModule.ExportGenesis(ctx, codec) -} - -func (a AppModule) GenerateGenesisState(simState *module.SimulationState) { - a.bankAppModule.GenerateGenesisState(simState) -} - -func (a AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { - sdr[banktypes.StoreKey] = simtypes.NewStoreDecoderFuncFromCollectionsSchema(a.bankKeeper.(keeper.BaseKeeper).Schema) -} - -func (a AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return a.bankAppModule.WeightedOperations(simState) +func (a AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + return a.bankAppModule.ExportGenesis(ctx, cdc) } func init() { @@ -107,6 +94,8 @@ func init() { ) } +type DeactMultiSend bool + type ModuleInputs struct { depinject.In @@ -115,8 +104,8 @@ type ModuleInputs struct { StoreService store.KVStoreService Logger log.Logger - AccountKeeper banktypes.AccountKeeper - // DeactMultiSend bool // FIXME: inject properly + AccountKeeper banktypes.AccountKeeper + DeactMultiSend DeactMultiSend // LegacySubspace is used solely for migration of x/params managed parameters LegacySubspace exported.Subspace `optional:"true"` @@ -169,7 +158,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { in.StoreService, in.AccountKeeper, blockedAddresses, - true, // in.DeactMultiSend, // FIXME: inject properly + bool(in.DeactMultiSend), authorityString, in.Logger, )