Skip to content

Commit

Permalink
chore: introduce DeactMultiSend type and DI provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeseung-bae committed Feb 7, 2024
1 parent d5d6bb0 commit 253863c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
13 changes: 11 additions & 2 deletions simapp/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -291,5 +291,14 @@ var (
},
),
},
))
),
depinject.Provide(
ProvideBankPlusDeactMultiSend,
),
)
)

func ProvideBankPlusDeactMultiSend() bankplus.DeactMultiSend {
// FIXME: move to Env or Configuration
return true
}
4 changes: 2 additions & 2 deletions x/bankplus/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
25 changes: 7 additions & 18 deletions x/bankplus/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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() {
Expand All @@ -107,6 +94,8 @@ func init() {
)
}

type DeactMultiSend bool

type ModuleInputs struct {
depinject.In

Expand All @@ -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"`
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit 253863c

Please sign in to comment.