From cf646b166e492c2a43d9a7fb2b6dd2789b3372d0 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 16:10:56 +0100 Subject: [PATCH] feat(x/bank): update keeper interface to include GetAllDenomMetaData (backport #15265) (#15526) Co-authored-by: Nikhil Suri Co-authored-by: Julien Robert --- CHANGELOG.md | 1 + scripts/mockgen.sh | 2 +- testutil/mock/tendermint_tm_db_DB.go | 2 +- x/bank/keeper/keeper.go | 1 + x/gov/testutil/expected_keepers_mocks.go | 14 ++++++++++++++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5be3585ac3ae..7ebbaa617e99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features +* (x/bank) [#15265](https://github.com/cosmos/cosmos-sdk/pull/15265) Update keeper interface to include `GetAllDenomMetaData`. * (x/groups) [#14879](https://github.com/cosmos/cosmos-sdk/pull/14879) Add `Query/Groups` query to get all the groups. * (x/gov,cli) [#14718](https://github.com/cosmos/cosmos-sdk/pull/14718) Added `AddGovPropFlagsToCmd` and `ReadGovPropFlags` functions. * (cli) [#14655](https://github.com/cosmos/cosmos-sdk/pull/14655) Add a new command to list supported algos. diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh index 0836713a984c..579a3d9cc7df 100755 --- a/scripts/mockgen.sh +++ b/scripts/mockgen.sh @@ -2,7 +2,7 @@ mockgen_cmd="mockgen" $mockgen_cmd -source=client/account_retriever.go -package mock -destination testutil/mock/account_retriever.go -$mockgen_cmd -package mock -destination testutil/mock/tendermint_tm_db_DB.go github.com/tendermint/tm-db DB +$mockgen_cmd -package mock -destination testutil/mock/tendermint_tm_db_DB.go github.com/cometbft/cometbft-db DB $mockgen_cmd -source=types/module/module.go -package mock -destination testutil/mock/types_module_module.go $mockgen_cmd -source=types/module/mock_appmodule_test.go -package mock -destination testutil/mock/types_mock_appmodule.go $mockgen_cmd -source=types/invariant.go -package mock -destination testutil/mock/types_invariant.go diff --git a/testutil/mock/tendermint_tm_db_DB.go b/testutil/mock/tendermint_tm_db_DB.go index aa9ecc423be9..2e6b67d8ae6f 100644 --- a/testutil/mock/tendermint_tm_db_DB.go +++ b/testutil/mock/tendermint_tm_db_DB.go @@ -7,8 +7,8 @@ package mock import ( reflect "reflect" - gomock "github.com/golang/mock/gomock" db "github.com/cometbft/cometbft-db" + gomock "github.com/golang/mock/gomock" ) // MockDB is a mock of DB interface. diff --git a/x/bank/keeper/keeper.go b/x/bank/keeper/keeper.go index 4fbb622ad9e6..1277c5eb3cd6 100644 --- a/x/bank/keeper/keeper.go +++ b/x/bank/keeper/keeper.go @@ -33,6 +33,7 @@ type Keeper interface { GetDenomMetaData(ctx sdk.Context, denom string) (types.Metadata, bool) HasDenomMetaData(ctx sdk.Context, denom string) bool SetDenomMetaData(ctx sdk.Context, denomMetaData types.Metadata) + GetAllDenomMetaData(ctx sdk.Context) []types.Metadata IterateAllDenomMetaData(ctx sdk.Context, cb func(types.Metadata) bool) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error diff --git a/x/gov/testutil/expected_keepers_mocks.go b/x/gov/testutil/expected_keepers_mocks.go index d6ea88c1b679..3492e16a4bc8 100644 --- a/x/gov/testutil/expected_keepers_mocks.go +++ b/x/gov/testutil/expected_keepers_mocks.go @@ -320,6 +320,20 @@ func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gom return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) } +// GetAllDenomMetaData mocks base method. +func (m *MockBankKeeper) GetAllDenomMetaData(ctx types.Context) []types1.Metadata { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllDenomMetaData", ctx) + ret0, _ := ret[0].([]types1.Metadata) + return ret0 +} + +// GetAllDenomMetaData indicates an expected call of GetAllDenomMetaData. +func (mr *MockBankKeeperMockRecorder) GetAllDenomMetaData(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllDenomMetaData", reflect.TypeOf((*MockBankKeeper)(nil).GetAllDenomMetaData), ctx) +} + // GetAllSendEnabledEntries mocks base method. func (m *MockBankKeeper) GetAllSendEnabledEntries(ctx types.Context) []types1.SendEnabled { m.ctrl.T.Helper()