diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh index 2c0fcc42e84..dae680dff9c 100755 --- a/scripts/mockgen.sh +++ b/scripts/mockgen.sh @@ -17,5 +17,6 @@ $mockgen_cmd -source=x/params/proposal_handler_test.go -package testutil -destin $mockgen_cmd -source=x/crisis/types/expected_keepers.go -package testutil -destination x/crisis/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/auth/types/expected_keepers.go -package testutil -destination x/auth/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/auth/ante/expected_keepers.go -package testutil -destination x/auth/ante/testutil/expected_keepers_mocks.go +$mockgen_cmd -source=x/authz/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/bank/types/expected_keepers.go -package testutil -destination x/bank/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/evidence/types/expected_keepers.go -package testutil -destination x/evidence/testutil/expected_keepers_mocks.go diff --git a/x/authz/keeper/genesis_test.go b/x/authz/keeper/genesis_test.go index d651aa68c5b..f474fef5406 100644 --- a/x/authz/keeper/genesis_test.go +++ b/x/authz/keeper/genesis_test.go @@ -5,31 +5,55 @@ import ( "time" "github.com/stretchr/testify/suite" + "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/x/authz/keeper" - "github.com/cosmos/cosmos-sdk/x/authz/testutil" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + authztestutil "github.com/cosmos/cosmos-sdk/x/authz/testutil" bank "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/golang/mock/gomock" ) type GenesisTestSuite struct { suite.Suite - ctx sdk.Context - keeper keeper.Keeper + ctx sdk.Context + keeper keeper.Keeper + baseApp *baseapp.BaseApp + accountKeeper *authztestutil.MockAccountKeeper + encCfg moduletestutil.TestEncodingConfig } func (suite *GenesisTestSuite) SetupTest() { - app, err := simtestutil.Setup( - testutil.AppConfig, - &suite.keeper, + key := sdk.NewKVStoreKey(keeper.StoreKey) + testCtx := testutil.DefaultContextWithDB(suite.T(), key, sdk.NewTransientStoreKey("transient_test")) + suite.ctx = testCtx.Ctx.WithBlockHeader(tmproto.Header{Height: 1}) + suite.encCfg = moduletestutil.MakeTestEncodingConfig(authzmodule.AppModuleBasic{}) + + // gomock initializations + ctrl := gomock.NewController(suite.T()) + suite.accountKeeper = authztestutil.NewMockAccountKeeper(ctrl) + + suite.baseApp = baseapp.NewBaseApp( + "authz", + log.NewNopLogger(), + testCtx.DB, + suite.encCfg.TxConfig.TxDecoder(), ) - suite.Require().NoError(err) + suite.baseApp.SetCMS(testCtx.CMS) + + bank.RegisterInterfaces(suite.encCfg.InterfaceRegistry) + + msr := suite.baseApp.MsgServiceRouter() + msr.SetInterfaceRegistry(suite.encCfg.InterfaceRegistry) - suite.ctx = app.BaseApp.NewContext(false, tmproto.Header{Height: 1}) + suite.keeper = keeper.NewKeeper(key, suite.encCfg.Codec, msr, suite.accountKeeper) } var ( diff --git a/x/authz/keeper/grpc_query_test.go b/x/authz/keeper/grpc_query_test.go index d924118f9fc..fc33b5f6e7d 100644 --- a/x/authz/keeper/grpc_query_test.go +++ b/x/authz/keeper/grpc_query_test.go @@ -69,7 +69,7 @@ func (suite *TestSuite) TestGRPCQueryAuthorization() { func(require *require.Assertions, res *authz.QueryGrantsResponse) { var auth authz.Authorization require.Equal(1, len(res.Grants)) - err := suite.interfaceRegistry.UnpackAny(res.Grants[0].Authorization, &auth) + err := suite.encCfg.InterfaceRegistry.UnpackAny(res.Grants[0].Authorization, &auth) require.NoError(err) require.NotNil(auth) require.Equal(auth.String(), expAuthorization.String()) @@ -135,7 +135,7 @@ func (suite *TestSuite) TestGRPCQueryAuthorizations() { func(res *authz.QueryGrantsResponse) { var auth authz.Authorization suite.Require().Equal(1, len(res.Grants)) - err := suite.interfaceRegistry.UnpackAny(res.Grants[0].Authorization, &auth) + err := suite.encCfg.InterfaceRegistry.UnpackAny(res.Grants[0].Authorization, &auth) suite.Require().NoError(err) suite.Require().NotNil(auth) suite.Require().Equal(auth.String(), expAuthorization.String()) diff --git a/x/authz/keeper/keeper_test.go b/x/authz/keeper/keeper_test.go index 4083888440d..2391dc6f87c 100644 --- a/x/authz/keeper/keeper_test.go +++ b/x/authz/keeper/keeper_test.go @@ -4,21 +4,23 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/suite" tmtime "github.com/tendermint/tendermint/libs/time" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/testutil" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/x/authz" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - "github.com/cosmos/cosmos-sdk/x/authz/testutil" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + authztestutil "github.com/cosmos/cosmos-sdk/x/authz/testutil" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/tendermint/tendermint/libs/log" ) var ( @@ -34,34 +36,46 @@ type TestSuite struct { ctx sdk.Context addrs []sdk.AccAddress authzKeeper authzkeeper.Keeper - bankKeeper bankkeeper.Keeper + accountKeeper *authztestutil.MockAccountKeeper + bankKeeper *authztestutil.MockBankKeeper interfaceRegistry codectypes.InterfaceRegistry + baseApp *baseapp.BaseApp + encCfg moduletestutil.TestEncodingConfig queryClient authz.QueryClient } func (s *TestSuite) SetupTest() { - var stakingKeeper *stakingkeeper.Keeper - - app, err := simtestutil.Setup( - testutil.AppConfig, - &s.bankKeeper, - &stakingKeeper, - &s.authzKeeper, - &s.interfaceRegistry, + key := sdk.NewKVStoreKey(authzkeeper.StoreKey) + testCtx := testutil.DefaultContextWithDB(s.T(), key, sdk.NewTransientStoreKey("transient_test")) + s.ctx = testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) + s.encCfg = moduletestutil.MakeTestEncodingConfig(authzmodule.AppModuleBasic{}) + + s.baseApp = baseapp.NewBaseApp( + "authz", + log.NewNopLogger(), + testCtx.DB, + s.encCfg.TxConfig.TxDecoder(), ) - s.Require().NoError(err) + s.baseApp.SetCMS(testCtx.CMS) + s.baseApp.SetInterfaceRegistry(s.encCfg.InterfaceRegistry) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - now := tmtime.Now() - ctx = ctx.WithBlockHeader(tmproto.Header{Time: now}) - queryHelper := baseapp.NewQueryServerTestHelper(ctx, s.interfaceRegistry) + s.addrs = simtestutil.CreateIncrementalAccounts(3) + + // gomock initializations + ctrl := gomock.NewController(s.T()) + s.accountKeeper = authztestutil.NewMockAccountKeeper(ctrl) + s.bankKeeper = authztestutil.NewMockBankKeeper(ctrl) + banktypes.RegisterInterfaces(s.encCfg.InterfaceRegistry) + banktypes.RegisterMsgServer(s.baseApp.MsgServiceRouter(), s.bankKeeper) + + s.authzKeeper = authzkeeper.NewKeeper(key, s.encCfg.Codec, s.baseApp.MsgServiceRouter(), s.accountKeeper) + + queryHelper := baseapp.NewQueryServerTestHelper(s.ctx, s.encCfg.InterfaceRegistry) authz.RegisterQueryServer(queryHelper, s.authzKeeper) queryClient := authz.NewQueryClient(queryHelper) s.queryClient = queryClient - s.ctx = ctx s.queryClient = queryClient - s.addrs = simtestutil.AddTestAddrsIncremental(s.bankKeeper, stakingKeeper, ctx, 3, sdk.NewInt(30000000)) } func (s *TestSuite) TestKeeper() { @@ -147,8 +161,6 @@ func (s *TestSuite) TestDispatchAction() { recipientAddr := addrs[2] a := banktypes.NewSendAuthorization(coins100, nil) - require.NoError(banktestutil.FundAccount(s.bankKeeper, s.ctx, granterAddr, coins1000)) - testCases := []struct { name string req authz.MsgExec @@ -291,7 +303,6 @@ func (s *TestSuite) TestDispatchedEvents() { granterAddr := addrs[0] granteeAddr := addrs[1] recipientAddr := addrs[2] - require.NoError(banktestutil.FundAccount(s.bankKeeper, s.ctx, granterAddr, coins1000)) expiration := s.ctx.BlockTime().Add(1 * time.Second) // must be in the future msgs := authz.NewMsgExec(granteeAddr, []sdk.Msg{ @@ -321,13 +332,11 @@ func (s *TestSuite) TestDispatchedEvents() { events := s.ctx.EventManager().Events() // get last 5 events (events that occur *after* the grant) - events = events[len(events)-5:] + events = events[len(events)-2:] requiredEvents := map[string]bool{ - "coin_spent": false, - "coin_received": false, - "transfer": false, - "message": false, + "cosmos.authz.v1beta1.EventGrant": true, + "cosmos.authz.v1beta1.EventRevoke": true, } for _, e := range events { requiredEvents[e.Type] = true diff --git a/x/authz/module/abci_test.go b/x/authz/module/abci_test.go index cc6deae50a8..f8e5b3e820b 100644 --- a/x/authz/module/abci_test.go +++ b/x/authz/module/abci_test.go @@ -5,37 +5,42 @@ import ( "time" "github.com/cosmos/cosmos-sdk/baseapp" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/testutil" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/authz" "github.com/cosmos/cosmos-sdk/x/authz/keeper" authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" - "github.com/cosmos/cosmos-sdk/x/authz/testutil" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + authztestutil "github.com/cosmos/cosmos-sdk/x/authz/testutil" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + "github.com/tendermint/tendermint/proto/tendermint/types" ) func TestExpiredGrantsQueue(t *testing.T) { - var interfaceRegistry codectypes.InterfaceRegistry - var authzKeeper keeper.Keeper - var bankKeeper bankkeeper.Keeper - var stakingKeeper *stakingkeeper.Keeper - - app, err := simtestutil.Setup( - testutil.AppConfig, - &interfaceRegistry, - &authzKeeper, - &bankKeeper, - &stakingKeeper, + + key := sdk.NewKVStoreKey(keeper.StoreKey) + testCtx := testutil.DefaultContextWithDB(t, key, sdk.NewTransientStoreKey("transient_test")) + encCfg := moduletestutil.MakeTestEncodingConfig(authzmodule.AppModuleBasic{}) + ctx := testCtx.Ctx.WithBlockHeader(types.Header{}) + + baseApp := baseapp.NewBaseApp( + "authz", + log.NewNopLogger(), + testCtx.DB, + encCfg.TxConfig.TxDecoder(), ) - require.NoError(t, err) + baseApp.SetCMS(testCtx.CMS) + baseApp.SetInterfaceRegistry(encCfg.InterfaceRegistry) - ctx := app.BaseApp.NewContext(false, types.Header{}) - addrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 5, sdk.NewInt(30000000)) + banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) + + addrs := simtestutil.CreateIncrementalAccounts(5) granter := addrs[0] grantee1 := addrs[1] grantee2 := addrs[2] @@ -46,6 +51,16 @@ func TestExpiredGrantsQueue(t *testing.T) { smallCoins := sdk.NewCoins(sdk.NewInt64Coin("stake", 10)) sendAuthz := banktypes.NewSendAuthorization(smallCoins, nil) + ctrl := gomock.NewController(t) + accountKeeper := authztestutil.NewMockAccountKeeper(ctrl) + accountKeeper.EXPECT().GetAccount(gomock.Any(), granter).Return(authtypes.NewBaseAccountWithAddress(granter)).AnyTimes() + accountKeeper.EXPECT().GetAccount(gomock.Any(), grantee1).Return(authtypes.NewBaseAccountWithAddress(grantee1)).AnyTimes() + accountKeeper.EXPECT().GetAccount(gomock.Any(), grantee2).Return(authtypes.NewBaseAccountWithAddress(grantee2)).AnyTimes() + accountKeeper.EXPECT().GetAccount(gomock.Any(), grantee3).Return(authtypes.NewBaseAccountWithAddress(grantee3)).AnyTimes() + accountKeeper.EXPECT().GetAccount(gomock.Any(), grantee4).Return(authtypes.NewBaseAccountWithAddress(grantee4)).AnyTimes() + + authzKeeper := keeper.NewKeeper(key, encCfg.Codec, baseApp.MsgServiceRouter(), accountKeeper) + save := func(grantee sdk.AccAddress, exp *time.Time) { err := authzKeeper.SaveGrant(ctx, grantee, granter, sendAuthz, exp) require.NoError(t, err, "Grant from %s", grantee.String()) @@ -55,7 +70,7 @@ func TestExpiredGrantsQueue(t *testing.T) { save(grantee3, &expiration2) save(grantee4, nil) - queryHelper := baseapp.NewQueryServerTestHelper(ctx, interfaceRegistry) + queryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry) authz.RegisterQueryServer(queryHelper, authzKeeper) queryClient := authz.NewQueryClient(queryHelper) diff --git a/x/authz/simulation/decoder_test.go b/x/authz/simulation/decoder_test.go index f197ac8c371..0b854bf76a9 100644 --- a/x/authz/simulation/decoder_test.go +++ b/x/authz/simulation/decoder_test.go @@ -7,28 +7,28 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" "github.com/cosmos/cosmos-sdk/x/authz" "github.com/cosmos/cosmos-sdk/x/authz/keeper" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/cosmos/cosmos-sdk/x/authz/simulation" - "github.com/cosmos/cosmos-sdk/x/authz/testutil" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" ) func TestDecodeStore(t *testing.T) { - var cdc codec.Codec - depinject.Inject(testutil.AppConfig, &cdc) + encCfg := moduletestutil.MakeTestEncodingConfig(authzmodule.AppModuleBasic{}) + banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) - dec := simulation.NewDecodeStore(cdc) + dec := simulation.NewDecodeStore(encCfg.Codec) now := time.Now().UTC() e := now.Add(1) sendAuthz := banktypes.NewSendAuthorization(sdk.NewCoins(sdk.NewInt64Coin("foo", 123)), nil) grant, _ := authz.NewGrant(now, sendAuthz, &e) - grantBz, err := cdc.Marshal(&grant) + grantBz, err := encCfg.Codec.Marshal(&grant) require.NoError(t, err) kvPairs := kv.Pairs{ Pairs: []kv.Pair{ diff --git a/x/authz/simulation/genesis_test.go b/x/authz/simulation/genesis_test.go index a6ad0e39953..f0dd86fa4db 100644 --- a/x/authz/simulation/genesis_test.go +++ b/x/authz/simulation/genesis_test.go @@ -7,26 +7,27 @@ import ( "github.com/stretchr/testify/require" - "cosmossdk.io/depinject" sdkmath "cosmossdk.io/math" - "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/authz" + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" "github.com/cosmos/cosmos-sdk/x/authz/simulation" - "github.com/cosmos/cosmos-sdk/x/authz/testutil" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" ) func TestRandomizedGenState(t *testing.T) { - var cdc codec.Codec - depinject.Inject(testutil.AppConfig, &cdc) + encCfg := moduletestutil.MakeTestEncodingConfig(authzmodule.AppModuleBasic{}) + banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) s := rand.NewSource(1) r := rand.New(s) simState := module.SimulationState{ AppParams: make(simtypes.AppParams), - Cdc: cdc, + Cdc: encCfg.Codec, Rand: r, NumBonded: 3, Accounts: simtypes.RandomAccounts(r, 3), diff --git a/x/authz/simulation/operations_test.go b/x/authz/simulation/operations_test.go index f2e1ce6dc50..481fec1a828 100644 --- a/x/authz/simulation/operations_test.go +++ b/x/authz/simulation/operations_test.go @@ -23,7 +23,6 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktestutil "github.com/cosmos/cosmos-sdk/x/bank/testutil" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) type SimTestSuite struct { @@ -37,7 +36,6 @@ type SimTestSuite struct { interfaceRegistry codectypes.InterfaceRegistry accountKeeper authkeeper.AccountKeeper bankKeeper bankkeeper.Keeper - stakingKeeper *stakingkeeper.Keeper authzKeeper authzkeeper.Keeper } @@ -49,7 +47,6 @@ func (suite *SimTestSuite) SetupTest() { &suite.interfaceRegistry, &suite.accountKeeper, &suite.bankKeeper, - &suite.stakingKeeper, &suite.authzKeeper, ) suite.Require().NoError(err) @@ -98,7 +95,7 @@ func (suite *SimTestSuite) TestWeightedOperations() { func (suite *SimTestSuite) getTestingAccounts(r *rand.Rand, n int) []simtypes.Account { accounts := simtypes.RandomAccounts(r, n) - initAmt := suite.stakingKeeper.TokensFromConsensusPower(suite.ctx, 200000) + initAmt := sdk.TokensFromConsensusPower(200000, sdk.DefaultPowerReduction) initCoins := sdk.NewCoins(sdk.NewCoin("stake", initAmt)) // add coins to the accounts @@ -156,7 +153,7 @@ func (suite *SimTestSuite) TestSimulateRevoke() { }, }) - initAmt := suite.stakingKeeper.TokensFromConsensusPower(suite.ctx, 200000) + initAmt := sdk.TokensFromConsensusPower(200000, sdk.DefaultPowerReduction) initCoins := sdk.NewCoins(sdk.NewCoin("stake", initAmt)) granter := accounts[0] @@ -191,7 +188,7 @@ func (suite *SimTestSuite) TestSimulateExec() { // begin a new block suite.app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: suite.app.LastBlockHeight() + 1, AppHash: suite.app.LastCommitID().Hash}}) - initAmt := suite.stakingKeeper.TokensFromConsensusPower(suite.ctx, 200000) + initAmt := sdk.TokensFromConsensusPower(200000, sdk.DefaultPowerReduction) initCoins := sdk.NewCoins(sdk.NewCoin("stake", initAmt)) granter := accounts[0] diff --git a/x/authz/testutil/bank_helpers.go b/x/authz/testutil/bank_helpers.go new file mode 100644 index 00000000000..91327139385 --- /dev/null +++ b/x/authz/testutil/bank_helpers.go @@ -0,0 +1,21 @@ +package testutil + +import ( + "context" + + bank "github.com/cosmos/cosmos-sdk/x/bank/types" +) + +var _ bank.MsgServer = MockBankKeeper{} + +func (k MockBankKeeper) Send(goCtx context.Context, msg *bank.MsgSend) (*bank.MsgSendResponse, error) { + return nil, nil +} + +func (k MockBankKeeper) MultiSend(goCtx context.Context, msg *bank.MsgMultiSend) (*bank.MsgMultiSendResponse, error) { + return nil, nil +} + +func (k MockBankKeeper) UpdateParams(goCtx context.Context, req *bank.MsgUpdateParams) (*bank.MsgUpdateParamsResponse, error) { + return nil, nil +} diff --git a/x/authz/testutil/expected_keepers_mocks.go b/x/authz/testutil/expected_keepers_mocks.go new file mode 100644 index 00000000000..f5bb29a5f8c --- /dev/null +++ b/x/authz/testutil/expected_keepers_mocks.go @@ -0,0 +1,132 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/authz/expected_keepers.go + +// Package testutil is a generated GoMock package. +package testutil + +import ( + reflect "reflect" + + types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/auth/types" + gomock "github.com/golang/mock/gomock" +) + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", ctx, addr) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), ctx, addr) +} + +// NewAccountWithAddress mocks base method. +func (m *MockAccountKeeper) NewAccountWithAddress(ctx types.Context, addr types.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewAccountWithAddress", ctx, addr) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// NewAccountWithAddress indicates an expected call of NewAccountWithAddress. +func (mr *MockAccountKeeperMockRecorder) NewAccountWithAddress(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccountWithAddress", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccountWithAddress), ctx, addr) +} + +// SetAccount mocks base method. +func (m *MockAccountKeeper) SetAccount(ctx types.Context, acc types0.AccountI) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetAccount", ctx, acc) +} + +// SetAccount indicates an expected call of SetAccount. +func (mr *MockAccountKeeperMockRecorder) SetAccount(ctx, acc interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), ctx, acc) +} + +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder +} + +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper +} + +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder +} + +// IsSendEnabledCoins mocks base method. +func (m *MockBankKeeper) IsSendEnabledCoins(ctx types.Context, coins ...types.Coin) error { + m.ctrl.T.Helper() + varargs := []interface{}{ctx} + for _, a := range coins { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "IsSendEnabledCoins", varargs...) + ret0, _ := ret[0].(error) + return ret0 +} + +// IsSendEnabledCoins indicates an expected call of IsSendEnabledCoins. +func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx interface{}, coins ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx}, coins...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledCoins", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledCoins), varargs...) +} + +// SpendableCoins mocks base method. +func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// SpendableCoins indicates an expected call of SpendableCoins. +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) +}