diff --git a/contrib/scripts/mockgen.sh b/contrib/scripts/mockgen.sh index 224afa112d..b48a212a03 100644 --- a/contrib/scripts/mockgen.sh +++ b/contrib/scripts/mockgen.sh @@ -2,7 +2,7 @@ mockgen_cmd="go run github.com/golang/mock/mockgen" -$mockgen_cmd -source ./x/ugov/keeper_interfaces.go -package mocks -destination ./x/ugov/mocks/keepers.go -$mockgen_cmd -source ./x/uibc/expected_keepers.go -package mocks -destination ./x/uibc/mocks/keepers.go -$mockgen_cmd -source ./x/metoken/expected_keepers.go -package mocks -destination ./x/metoken/mocks/keepers.go -$mockgen_cmd -source ./app/inflation/expected_keepers.go -package mocks -destination ./app/inflation/mocks/keepers.go +$mockgen_cmd -source ./../../x/ugov/keeper_interfaces.go -package mocks -destination ./../..//x/ugov/mocks/keepers.go +$mockgen_cmd -source ./../../x/uibc/expected_keepers.go -package mocks -destination ./../..//x/uibc/mocks/keepers.go +$mockgen_cmd -source ./../../x/metoken/expected_keepers.go -package mocks -destination ./../../x/metoken/mocks/keepers.go +$mockgen_cmd -source ./../../app/inflation/expected_keepers.go -package mocks -destination ./../..//app/inflation/mocks/keepers.go diff --git a/x/metoken/mocks/keepers.go b/x/metoken/mocks/keepers.go index 44ff91b83b..89d12951af 100644 --- a/x/metoken/mocks/keepers.go +++ b/x/metoken/mocks/keepers.go @@ -1,1867 +1,288 @@ -// Code generated by go-mockgen 1.3.7; DO NOT EDIT. +// Code generated by MockGen. DO NOT EDIT. +// Source: ./../../x/metoken/expected_keepers.go +// Package mocks is a generated GoMock package. package mocks import ( - "sync" + reflect "reflect" math "cosmossdk.io/math" types "github.com/cosmos/cosmos-sdk/types" - types1 "github.com/umee-network/umee/v6/x/leverage/types" - metoken "github.com/umee-network/umee/v6/x/metoken" - types2 "github.com/umee-network/umee/v6/x/oracle/types" + gomock "github.com/golang/mock/gomock" + types0 "github.com/umee-network/umee/v6/x/leverage/types" + types1 "github.com/umee-network/umee/v6/x/oracle/types" ) -// MockBankKeeper is a mock implementation of the BankKeeper interface (from -// the package github.com/umee-network/umee/v6/x/metoken) used for unit -// testing. +// MockBankKeeper is a mock of BankKeeper interface. type MockBankKeeper struct { - // BurnCoinsFunc is an instance of a mock function object controlling - // the behavior of the method BurnCoins. - BurnCoinsFunc *BankKeeperBurnCoinsFunc - // MintCoinsFunc is an instance of a mock function object controlling - // the behavior of the method MintCoins. - MintCoinsFunc *BankKeeperMintCoinsFunc - // SendCoinsFromAccountToModuleFunc is an instance of a mock function - // object controlling the behavior of the method - // SendCoinsFromAccountToModule. - SendCoinsFromAccountToModuleFunc *BankKeeperSendCoinsFromAccountToModuleFunc - // SendCoinsFromModuleToAccountFunc is an instance of a mock function - // object controlling the behavior of the method - // SendCoinsFromModuleToAccount. - SendCoinsFromModuleToAccountFunc *BankKeeperSendCoinsFromModuleToAccountFunc + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder } -// NewMockBankKeeper creates a new mock of the BankKeeper interface. All -// methods return zero values for all results, unless overwritten. -func NewMockBankKeeper() *MockBankKeeper { - return &MockBankKeeper{ - BurnCoinsFunc: &BankKeeperBurnCoinsFunc{ - defaultHook: func(types.Context, string, types.Coins) (r0 error) { - return - }, - }, - MintCoinsFunc: &BankKeeperMintCoinsFunc{ - defaultHook: func(types.Context, string, types.Coins) (r0 error) { - return - }, - }, - SendCoinsFromAccountToModuleFunc: &BankKeeperSendCoinsFromAccountToModuleFunc{ - defaultHook: func(types.Context, types.AccAddress, string, types.Coins) (r0 error) { - return - }, - }, - SendCoinsFromModuleToAccountFunc: &BankKeeperSendCoinsFromModuleToAccountFunc{ - defaultHook: func(types.Context, string, types.AccAddress, types.Coins) (r0 error) { - return - }, - }, - } +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper } -// NewStrictMockBankKeeper creates a new mock of the BankKeeper interface. -// All methods panic on invocation, unless overwritten. -func NewStrictMockBankKeeper() *MockBankKeeper { - return &MockBankKeeper{ - BurnCoinsFunc: &BankKeeperBurnCoinsFunc{ - defaultHook: func(types.Context, string, types.Coins) error { - panic("unexpected invocation of MockBankKeeper.BurnCoins") - }, - }, - MintCoinsFunc: &BankKeeperMintCoinsFunc{ - defaultHook: func(types.Context, string, types.Coins) error { - panic("unexpected invocation of MockBankKeeper.MintCoins") - }, - }, - SendCoinsFromAccountToModuleFunc: &BankKeeperSendCoinsFromAccountToModuleFunc{ - defaultHook: func(types.Context, types.AccAddress, string, types.Coins) error { - panic("unexpected invocation of MockBankKeeper.SendCoinsFromAccountToModule") - }, - }, - SendCoinsFromModuleToAccountFunc: &BankKeeperSendCoinsFromModuleToAccountFunc{ - defaultHook: func(types.Context, string, types.AccAddress, types.Coins) error { - panic("unexpected invocation of MockBankKeeper.SendCoinsFromModuleToAccount") - }, - }, - } +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock } -// NewMockBankKeeperFrom creates a new mock of the MockBankKeeper interface. -// All methods delegate to the given implementation, unless overwritten. -func NewMockBankKeeperFrom(i metoken.BankKeeper) *MockBankKeeper { - return &MockBankKeeper{ - BurnCoinsFunc: &BankKeeperBurnCoinsFunc{ - defaultHook: i.BurnCoins, - }, - MintCoinsFunc: &BankKeeperMintCoinsFunc{ - defaultHook: i.MintCoins, - }, - SendCoinsFromAccountToModuleFunc: &BankKeeperSendCoinsFromAccountToModuleFunc{ - defaultHook: i.SendCoinsFromAccountToModule, - }, - SendCoinsFromModuleToAccountFunc: &BankKeeperSendCoinsFromModuleToAccountFunc{ - defaultHook: i.SendCoinsFromModuleToAccount, - }, - } +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder } -// BankKeeperBurnCoinsFunc describes the behavior when the BurnCoins method -// of the parent MockBankKeeper instance is invoked. -type BankKeeperBurnCoinsFunc struct { - defaultHook func(types.Context, string, types.Coins) error - hooks []func(types.Context, string, types.Coins) error - history []BankKeeperBurnCoinsFuncCall - mutex sync.Mutex +// BurnCoins mocks base method. +func (m *MockBankKeeper) BurnCoins(ctx types.Context, moduleName string, amounts types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BurnCoins", ctx, moduleName, amounts) + ret0, _ := ret[0].(error) + return ret0 } -// BurnCoins delegates to the next hook function in the queue and stores the -// parameter and result values of this invocation. -func (m *MockBankKeeper) BurnCoins(v0 types.Context, v1 string, v2 types.Coins) error { - r0 := m.BurnCoinsFunc.nextHook()(v0, v1, v2) - m.BurnCoinsFunc.appendCall(BankKeeperBurnCoinsFuncCall{v0, v1, v2, r0}) - return r0 +// BurnCoins indicates an expected call of BurnCoins. +func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, moduleName, amounts interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, moduleName, amounts) } -// SetDefaultHook sets function that is called when the BurnCoins method of -// the parent MockBankKeeper instance is invoked and the hook queue is -// empty. -func (f *BankKeeperBurnCoinsFunc) SetDefaultHook(hook func(types.Context, string, types.Coins) error) { - f.defaultHook = hook +// MintCoins mocks base method. +func (m *MockBankKeeper) MintCoins(ctx types.Context, moduleName string, amounts types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amounts) + ret0, _ := ret[0].(error) + return ret0 } -// PushHook adds a function to the end of hook queue. Each invocation of the -// BurnCoins method of the parent MockBankKeeper instance invokes the hook -// at the front of the queue and discards it. After the queue is empty, the -// default hook function is invoked for any future action. -func (f *BankKeeperBurnCoinsFunc) PushHook(hook func(types.Context, string, types.Coins) error) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() +// MintCoins indicates an expected call of MintCoins. +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amounts interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amounts) } -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *BankKeeperBurnCoinsFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(types.Context, string, types.Coins) error { - return r0 - }) +// SendCoinsFromAccountToModule mocks base method. +func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt) + ret0, _ := ret[0].(error) + return ret0 } -// PushReturn calls PushHook with a function that returns the given values. -func (f *BankKeeperBurnCoinsFunc) PushReturn(r0 error) { - f.PushHook(func(types.Context, string, types.Coins) error { - return r0 - }) +// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) } -func (f *BankKeeperBurnCoinsFunc) nextHook() func(types.Context, string, types.Coins) error { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *BankKeeperBurnCoinsFunc) appendCall(r0 BankKeeperBurnCoinsFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of BankKeeperBurnCoinsFuncCall objects -// describing the invocations of this function. -func (f *BankKeeperBurnCoinsFunc) History() []BankKeeperBurnCoinsFuncCall { - f.mutex.Lock() - history := make([]BankKeeperBurnCoinsFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// BankKeeperBurnCoinsFuncCall is an object that describes an invocation of -// method BurnCoins on an instance of MockBankKeeper. -type BankKeeperBurnCoinsFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 string - // Arg2 is the value of the 3rd argument passed to this method - // invocation. - Arg2 types.Coins - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c BankKeeperBurnCoinsFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1, c.Arg2} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c BankKeeperBurnCoinsFuncCall) Results() []interface{} { - return []interface{}{c.Result0} -} - -// BankKeeperMintCoinsFunc describes the behavior when the MintCoins method -// of the parent MockBankKeeper instance is invoked. -type BankKeeperMintCoinsFunc struct { - defaultHook func(types.Context, string, types.Coins) error - hooks []func(types.Context, string, types.Coins) error - history []BankKeeperMintCoinsFuncCall - mutex sync.Mutex -} - -// MintCoins delegates to the next hook function in the queue and stores the -// parameter and result values of this invocation. -func (m *MockBankKeeper) MintCoins(v0 types.Context, v1 string, v2 types.Coins) error { - r0 := m.MintCoinsFunc.nextHook()(v0, v1, v2) - m.MintCoinsFunc.appendCall(BankKeeperMintCoinsFuncCall{v0, v1, v2, r0}) - return r0 -} - -// SetDefaultHook sets function that is called when the MintCoins method of -// the parent MockBankKeeper instance is invoked and the hook queue is -// empty. -func (f *BankKeeperMintCoinsFunc) SetDefaultHook(hook func(types.Context, string, types.Coins) error) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// MintCoins method of the parent MockBankKeeper instance invokes the hook -// at the front of the queue and discards it. After the queue is empty, the -// default hook function is invoked for any future action. -func (f *BankKeeperMintCoinsFunc) PushHook(hook func(types.Context, string, types.Coins) error) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() +// SendCoinsFromModuleToAccount mocks base method. +func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", ctx, senderModule, recipientAddr, amt) + ret0, _ := ret[0].(error) + return ret0 } -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *BankKeeperMintCoinsFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(types.Context, string, types.Coins) error { - return r0 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *BankKeeperMintCoinsFunc) PushReturn(r0 error) { - f.PushHook(func(types.Context, string, types.Coins) error { - return r0 - }) -} - -func (f *BankKeeperMintCoinsFunc) nextHook() func(types.Context, string, types.Coins) error { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *BankKeeperMintCoinsFunc) appendCall(r0 BankKeeperMintCoinsFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of BankKeeperMintCoinsFuncCall objects -// describing the invocations of this function. -func (f *BankKeeperMintCoinsFunc) History() []BankKeeperMintCoinsFuncCall { - f.mutex.Lock() - history := make([]BankKeeperMintCoinsFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// BankKeeperMintCoinsFuncCall is an object that describes an invocation of -// method MintCoins on an instance of MockBankKeeper. -type BankKeeperMintCoinsFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 string - // Arg2 is the value of the 3rd argument passed to this method - // invocation. - Arg2 types.Coins - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c BankKeeperMintCoinsFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1, c.Arg2} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c BankKeeperMintCoinsFuncCall) Results() []interface{} { - return []interface{}{c.Result0} -} - -// BankKeeperSendCoinsFromAccountToModuleFunc describes the behavior when -// the SendCoinsFromAccountToModule method of the parent MockBankKeeper -// instance is invoked. -type BankKeeperSendCoinsFromAccountToModuleFunc struct { - defaultHook func(types.Context, types.AccAddress, string, types.Coins) error - hooks []func(types.Context, types.AccAddress, string, types.Coins) error - history []BankKeeperSendCoinsFromAccountToModuleFuncCall - mutex sync.Mutex -} - -// SendCoinsFromAccountToModule delegates to the next hook function in the -// queue and stores the parameter and result values of this invocation. -func (m *MockBankKeeper) SendCoinsFromAccountToModule(v0 types.Context, v1 types.AccAddress, v2 string, v3 types.Coins) error { - r0 := m.SendCoinsFromAccountToModuleFunc.nextHook()(v0, v1, v2, v3) - m.SendCoinsFromAccountToModuleFunc.appendCall(BankKeeperSendCoinsFromAccountToModuleFuncCall{v0, v1, v2, v3, r0}) - return r0 -} - -// SetDefaultHook sets function that is called when the -// SendCoinsFromAccountToModule method of the parent MockBankKeeper instance -// is invoked and the hook queue is empty. -func (f *BankKeeperSendCoinsFromAccountToModuleFunc) SetDefaultHook(hook func(types.Context, types.AccAddress, string, types.Coins) error) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// SendCoinsFromAccountToModule method of the parent MockBankKeeper instance -// invokes the hook at the front of the queue and discards it. After the -// queue is empty, the default hook function is invoked for any future -// action. -func (f *BankKeeperSendCoinsFromAccountToModuleFunc) PushHook(hook func(types.Context, types.AccAddress, string, types.Coins) error) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *BankKeeperSendCoinsFromAccountToModuleFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(types.Context, types.AccAddress, string, types.Coins) error { - return r0 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *BankKeeperSendCoinsFromAccountToModuleFunc) PushReturn(r0 error) { - f.PushHook(func(types.Context, types.AccAddress, string, types.Coins) error { - return r0 - }) -} - -func (f *BankKeeperSendCoinsFromAccountToModuleFunc) nextHook() func(types.Context, types.AccAddress, string, types.Coins) error { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *BankKeeperSendCoinsFromAccountToModuleFunc) appendCall(r0 BankKeeperSendCoinsFromAccountToModuleFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of -// BankKeeperSendCoinsFromAccountToModuleFuncCall objects describing the -// invocations of this function. -func (f *BankKeeperSendCoinsFromAccountToModuleFunc) History() []BankKeeperSendCoinsFromAccountToModuleFuncCall { - f.mutex.Lock() - history := make([]BankKeeperSendCoinsFromAccountToModuleFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// BankKeeperSendCoinsFromAccountToModuleFuncCall is an object that -// describes an invocation of method SendCoinsFromAccountToModule on an -// instance of MockBankKeeper. -type BankKeeperSendCoinsFromAccountToModuleFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 types.AccAddress - // Arg2 is the value of the 3rd argument passed to this method - // invocation. - Arg2 string - // Arg3 is the value of the 4th argument passed to this method - // invocation. - Arg3 types.Coins - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c BankKeeperSendCoinsFromAccountToModuleFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c BankKeeperSendCoinsFromAccountToModuleFuncCall) Results() []interface{} { - return []interface{}{c.Result0} -} - -// BankKeeperSendCoinsFromModuleToAccountFunc describes the behavior when -// the SendCoinsFromModuleToAccount method of the parent MockBankKeeper -// instance is invoked. -type BankKeeperSendCoinsFromModuleToAccountFunc struct { - defaultHook func(types.Context, string, types.AccAddress, types.Coins) error - hooks []func(types.Context, string, types.AccAddress, types.Coins) error - history []BankKeeperSendCoinsFromModuleToAccountFuncCall - mutex sync.Mutex -} - -// SendCoinsFromModuleToAccount delegates to the next hook function in the -// queue and stores the parameter and result values of this invocation. -func (m *MockBankKeeper) SendCoinsFromModuleToAccount(v0 types.Context, v1 string, v2 types.AccAddress, v3 types.Coins) error { - r0 := m.SendCoinsFromModuleToAccountFunc.nextHook()(v0, v1, v2, v3) - m.SendCoinsFromModuleToAccountFunc.appendCall(BankKeeperSendCoinsFromModuleToAccountFuncCall{v0, v1, v2, v3, r0}) - return r0 -} - -// SetDefaultHook sets function that is called when the -// SendCoinsFromModuleToAccount method of the parent MockBankKeeper instance -// is invoked and the hook queue is empty. -func (f *BankKeeperSendCoinsFromModuleToAccountFunc) SetDefaultHook(hook func(types.Context, string, types.AccAddress, types.Coins) error) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// SendCoinsFromModuleToAccount method of the parent MockBankKeeper instance -// invokes the hook at the front of the queue and discards it. After the -// queue is empty, the default hook function is invoked for any future -// action. -func (f *BankKeeperSendCoinsFromModuleToAccountFunc) PushHook(hook func(types.Context, string, types.AccAddress, types.Coins) error) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *BankKeeperSendCoinsFromModuleToAccountFunc) SetDefaultReturn(r0 error) { - f.SetDefaultHook(func(types.Context, string, types.AccAddress, types.Coins) error { - return r0 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *BankKeeperSendCoinsFromModuleToAccountFunc) PushReturn(r0 error) { - f.PushHook(func(types.Context, string, types.AccAddress, types.Coins) error { - return r0 - }) -} - -func (f *BankKeeperSendCoinsFromModuleToAccountFunc) nextHook() func(types.Context, string, types.AccAddress, types.Coins) error { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook +// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) } -func (f *BankKeeperSendCoinsFromModuleToAccountFunc) appendCall(r0 BankKeeperSendCoinsFromModuleToAccountFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of -// BankKeeperSendCoinsFromModuleToAccountFuncCall objects describing the -// invocations of this function. -func (f *BankKeeperSendCoinsFromModuleToAccountFunc) History() []BankKeeperSendCoinsFromModuleToAccountFuncCall { - f.mutex.Lock() - history := make([]BankKeeperSendCoinsFromModuleToAccountFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// BankKeeperSendCoinsFromModuleToAccountFuncCall is an object that -// describes an invocation of method SendCoinsFromModuleToAccount on an -// instance of MockBankKeeper. -type BankKeeperSendCoinsFromModuleToAccountFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 string - // Arg2 is the value of the 3rd argument passed to this method - // invocation. - Arg2 types.AccAddress - // Arg3 is the value of the 4th argument passed to this method - // invocation. - Arg3 types.Coins - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c BankKeeperSendCoinsFromModuleToAccountFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c BankKeeperSendCoinsFromModuleToAccountFuncCall) Results() []interface{} { - return []interface{}{c.Result0} -} - -// MockLeverageKeeper is a mock implementation of the LeverageKeeper -// interface (from the package github.com/umee-network/umee/v6/x/metoken) -// used for unit testing. +// MockLeverageKeeper is a mock of LeverageKeeper interface. type MockLeverageKeeper struct { - // GetAllSuppliedFunc is an instance of a mock function object - // controlling the behavior of the method GetAllSupplied. - GetAllSuppliedFunc *LeverageKeeperGetAllSuppliedFunc - // GetTokenSettingsFunc is an instance of a mock function object - // controlling the behavior of the method GetTokenSettings. - GetTokenSettingsFunc *LeverageKeeperGetTokenSettingsFunc - // GetTotalSupplyFunc is an instance of a mock function object - // controlling the behavior of the method GetTotalSupply. - GetTotalSupplyFunc *LeverageKeeperGetTotalSupplyFunc - // ModuleMaxWithdrawFunc is an instance of a mock function object - // controlling the behavior of the method ModuleMaxWithdraw. - ModuleMaxWithdrawFunc *LeverageKeeperModuleMaxWithdrawFunc - // SupplyFromModuleFunc is an instance of a mock function object - // controlling the behavior of the method SupplyFromModule. - SupplyFromModuleFunc *LeverageKeeperSupplyFromModuleFunc - // ToTokenFunc is an instance of a mock function object controlling the - // behavior of the method ToToken. - ToTokenFunc *LeverageKeeperToTokenFunc - // ToUTokenFunc is an instance of a mock function object controlling the - // behavior of the method ToUToken. - ToUTokenFunc *LeverageKeeperToUTokenFunc - // WithdrawToModuleFunc is an instance of a mock function object - // controlling the behavior of the method WithdrawToModule. - WithdrawToModuleFunc *LeverageKeeperWithdrawToModuleFunc -} - -// NewMockLeverageKeeper creates a new mock of the LeverageKeeper interface. -// All methods return zero values for all results, unless overwritten. -func NewMockLeverageKeeper() *MockLeverageKeeper { - return &MockLeverageKeeper{ - GetAllSuppliedFunc: &LeverageKeeperGetAllSuppliedFunc{ - defaultHook: func(types.Context, types.AccAddress) (r0 types.Coins, r1 error) { - return - }, - }, - GetTokenSettingsFunc: &LeverageKeeperGetTokenSettingsFunc{ - defaultHook: func(types.Context, string) (r0 types1.Token, r1 error) { - return - }, - }, - GetTotalSupplyFunc: &LeverageKeeperGetTotalSupplyFunc{ - defaultHook: func(types.Context, string) (r0 types.Coin, r1 error) { - return - }, - }, - ModuleMaxWithdrawFunc: &LeverageKeeperModuleMaxWithdrawFunc{ - defaultHook: func(types.Context, types.Coin) (r0 math.Int, r1 error) { - return - }, - }, - SupplyFromModuleFunc: &LeverageKeeperSupplyFromModuleFunc{ - defaultHook: func(types.Context, string, types.Coin) (r0 types.Coin, r1 bool, r2 error) { - return - }, - }, - ToTokenFunc: &LeverageKeeperToTokenFunc{ - defaultHook: func(types.Context, types.Coin) (r0 types.Coin, r1 error) { - return - }, - }, - ToUTokenFunc: &LeverageKeeperToUTokenFunc{ - defaultHook: func(types.Context, types.Coin) (r0 types.Coin, r1 error) { - return - }, - }, - WithdrawToModuleFunc: &LeverageKeeperWithdrawToModuleFunc{ - defaultHook: func(types.Context, string, types.Coin) (r0 types.Coin, r1 bool, r2 error) { - return - }, - }, - } -} - -// NewStrictMockLeverageKeeper creates a new mock of the LeverageKeeper -// interface. All methods panic on invocation, unless overwritten. -func NewStrictMockLeverageKeeper() *MockLeverageKeeper { - return &MockLeverageKeeper{ - GetAllSuppliedFunc: &LeverageKeeperGetAllSuppliedFunc{ - defaultHook: func(types.Context, types.AccAddress) (types.Coins, error) { - panic("unexpected invocation of MockLeverageKeeper.GetAllSupplied") - }, - }, - GetTokenSettingsFunc: &LeverageKeeperGetTokenSettingsFunc{ - defaultHook: func(types.Context, string) (types1.Token, error) { - panic("unexpected invocation of MockLeverageKeeper.GetTokenSettings") - }, - }, - GetTotalSupplyFunc: &LeverageKeeperGetTotalSupplyFunc{ - defaultHook: func(types.Context, string) (types.Coin, error) { - panic("unexpected invocation of MockLeverageKeeper.GetTotalSupply") - }, - }, - ModuleMaxWithdrawFunc: &LeverageKeeperModuleMaxWithdrawFunc{ - defaultHook: func(types.Context, types.Coin) (math.Int, error) { - panic("unexpected invocation of MockLeverageKeeper.ModuleMaxWithdraw") - }, - }, - SupplyFromModuleFunc: &LeverageKeeperSupplyFromModuleFunc{ - defaultHook: func(types.Context, string, types.Coin) (types.Coin, bool, error) { - panic("unexpected invocation of MockLeverageKeeper.SupplyFromModule") - }, - }, - ToTokenFunc: &LeverageKeeperToTokenFunc{ - defaultHook: func(types.Context, types.Coin) (types.Coin, error) { - panic("unexpected invocation of MockLeverageKeeper.ToToken") - }, - }, - ToUTokenFunc: &LeverageKeeperToUTokenFunc{ - defaultHook: func(types.Context, types.Coin) (types.Coin, error) { - panic("unexpected invocation of MockLeverageKeeper.ToUToken") - }, - }, - WithdrawToModuleFunc: &LeverageKeeperWithdrawToModuleFunc{ - defaultHook: func(types.Context, string, types.Coin) (types.Coin, bool, error) { - panic("unexpected invocation of MockLeverageKeeper.WithdrawToModule") - }, - }, - } -} - -// NewMockLeverageKeeperFrom creates a new mock of the MockLeverageKeeper -// interface. All methods delegate to the given implementation, unless -// overwritten. -func NewMockLeverageKeeperFrom(i metoken.LeverageKeeper) *MockLeverageKeeper { - return &MockLeverageKeeper{ - GetAllSuppliedFunc: &LeverageKeeperGetAllSuppliedFunc{ - defaultHook: i.GetAllSupplied, - }, - GetTokenSettingsFunc: &LeverageKeeperGetTokenSettingsFunc{ - defaultHook: i.GetTokenSettings, - }, - GetTotalSupplyFunc: &LeverageKeeperGetTotalSupplyFunc{ - defaultHook: i.GetTotalSupply, - }, - ModuleMaxWithdrawFunc: &LeverageKeeperModuleMaxWithdrawFunc{ - defaultHook: i.ModuleMaxWithdraw, - }, - SupplyFromModuleFunc: &LeverageKeeperSupplyFromModuleFunc{ - defaultHook: i.SupplyFromModule, - }, - ToTokenFunc: &LeverageKeeperToTokenFunc{ - defaultHook: i.ToToken, - }, - ToUTokenFunc: &LeverageKeeperToUTokenFunc{ - defaultHook: i.ToUToken, - }, - WithdrawToModuleFunc: &LeverageKeeperWithdrawToModuleFunc{ - defaultHook: i.WithdrawToModule, - }, - } -} - -// LeverageKeeperGetAllSuppliedFunc describes the behavior when the -// GetAllSupplied method of the parent MockLeverageKeeper instance is -// invoked. -type LeverageKeeperGetAllSuppliedFunc struct { - defaultHook func(types.Context, types.AccAddress) (types.Coins, error) - hooks []func(types.Context, types.AccAddress) (types.Coins, error) - history []LeverageKeeperGetAllSuppliedFuncCall - mutex sync.Mutex -} - -// GetAllSupplied delegates to the next hook function in the queue and -// stores the parameter and result values of this invocation. -func (m *MockLeverageKeeper) GetAllSupplied(v0 types.Context, v1 types.AccAddress) (types.Coins, error) { - r0, r1 := m.GetAllSuppliedFunc.nextHook()(v0, v1) - m.GetAllSuppliedFunc.appendCall(LeverageKeeperGetAllSuppliedFuncCall{v0, v1, r0, r1}) - return r0, r1 -} - -// SetDefaultHook sets function that is called when the GetAllSupplied -// method of the parent MockLeverageKeeper instance is invoked and the hook -// queue is empty. -func (f *LeverageKeeperGetAllSuppliedFunc) SetDefaultHook(hook func(types.Context, types.AccAddress) (types.Coins, error)) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// GetAllSupplied method of the parent MockLeverageKeeper instance invokes -// the hook at the front of the queue and discards it. After the queue is -// empty, the default hook function is invoked for any future action. -func (f *LeverageKeeperGetAllSuppliedFunc) PushHook(hook func(types.Context, types.AccAddress) (types.Coins, error)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *LeverageKeeperGetAllSuppliedFunc) SetDefaultReturn(r0 types.Coins, r1 error) { - f.SetDefaultHook(func(types.Context, types.AccAddress) (types.Coins, error) { - return r0, r1 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *LeverageKeeperGetAllSuppliedFunc) PushReturn(r0 types.Coins, r1 error) { - f.PushHook(func(types.Context, types.AccAddress) (types.Coins, error) { - return r0, r1 - }) -} - -func (f *LeverageKeeperGetAllSuppliedFunc) nextHook() func(types.Context, types.AccAddress) (types.Coins, error) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *LeverageKeeperGetAllSuppliedFunc) appendCall(r0 LeverageKeeperGetAllSuppliedFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of LeverageKeeperGetAllSuppliedFuncCall -// objects describing the invocations of this function. -func (f *LeverageKeeperGetAllSuppliedFunc) History() []LeverageKeeperGetAllSuppliedFuncCall { - f.mutex.Lock() - history := make([]LeverageKeeperGetAllSuppliedFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// LeverageKeeperGetAllSuppliedFuncCall is an object that describes an -// invocation of method GetAllSupplied on an instance of MockLeverageKeeper. -type LeverageKeeperGetAllSuppliedFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 types.AccAddress - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 types.Coins - // Result1 is the value of the 2nd result returned from this method - // invocation. - Result1 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c LeverageKeeperGetAllSuppliedFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c LeverageKeeperGetAllSuppliedFuncCall) Results() []interface{} { - return []interface{}{c.Result0, c.Result1} -} - -// LeverageKeeperGetTokenSettingsFunc describes the behavior when the -// GetTokenSettings method of the parent MockLeverageKeeper instance is -// invoked. -type LeverageKeeperGetTokenSettingsFunc struct { - defaultHook func(types.Context, string) (types1.Token, error) - hooks []func(types.Context, string) (types1.Token, error) - history []LeverageKeeperGetTokenSettingsFuncCall - mutex sync.Mutex -} - -// GetTokenSettings delegates to the next hook function in the queue and -// stores the parameter and result values of this invocation. -func (m *MockLeverageKeeper) GetTokenSettings(v0 types.Context, v1 string) (types1.Token, error) { - r0, r1 := m.GetTokenSettingsFunc.nextHook()(v0, v1) - m.GetTokenSettingsFunc.appendCall(LeverageKeeperGetTokenSettingsFuncCall{v0, v1, r0, r1}) - return r0, r1 -} - -// SetDefaultHook sets function that is called when the GetTokenSettings -// method of the parent MockLeverageKeeper instance is invoked and the hook -// queue is empty. -func (f *LeverageKeeperGetTokenSettingsFunc) SetDefaultHook(hook func(types.Context, string) (types1.Token, error)) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// GetTokenSettings method of the parent MockLeverageKeeper instance invokes -// the hook at the front of the queue and discards it. After the queue is -// empty, the default hook function is invoked for any future action. -func (f *LeverageKeeperGetTokenSettingsFunc) PushHook(hook func(types.Context, string) (types1.Token, error)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *LeverageKeeperGetTokenSettingsFunc) SetDefaultReturn(r0 types1.Token, r1 error) { - f.SetDefaultHook(func(types.Context, string) (types1.Token, error) { - return r0, r1 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *LeverageKeeperGetTokenSettingsFunc) PushReturn(r0 types1.Token, r1 error) { - f.PushHook(func(types.Context, string) (types1.Token, error) { - return r0, r1 - }) -} - -func (f *LeverageKeeperGetTokenSettingsFunc) nextHook() func(types.Context, string) (types1.Token, error) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *LeverageKeeperGetTokenSettingsFunc) appendCall(r0 LeverageKeeperGetTokenSettingsFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of LeverageKeeperGetTokenSettingsFuncCall -// objects describing the invocations of this function. -func (f *LeverageKeeperGetTokenSettingsFunc) History() []LeverageKeeperGetTokenSettingsFuncCall { - f.mutex.Lock() - history := make([]LeverageKeeperGetTokenSettingsFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// LeverageKeeperGetTokenSettingsFuncCall is an object that describes an -// invocation of method GetTokenSettings on an instance of -// MockLeverageKeeper. -type LeverageKeeperGetTokenSettingsFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 string - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 types1.Token - // Result1 is the value of the 2nd result returned from this method - // invocation. - Result1 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c LeverageKeeperGetTokenSettingsFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c LeverageKeeperGetTokenSettingsFuncCall) Results() []interface{} { - return []interface{}{c.Result0, c.Result1} -} - -// LeverageKeeperGetTotalSupplyFunc describes the behavior when the -// GetTotalSupply method of the parent MockLeverageKeeper instance is -// invoked. -type LeverageKeeperGetTotalSupplyFunc struct { - defaultHook func(types.Context, string) (types.Coin, error) - hooks []func(types.Context, string) (types.Coin, error) - history []LeverageKeeperGetTotalSupplyFuncCall - mutex sync.Mutex -} - -// GetTotalSupply delegates to the next hook function in the queue and -// stores the parameter and result values of this invocation. -func (m *MockLeverageKeeper) GetTotalSupply(v0 types.Context, v1 string) (types.Coin, error) { - r0, r1 := m.GetTotalSupplyFunc.nextHook()(v0, v1) - m.GetTotalSupplyFunc.appendCall(LeverageKeeperGetTotalSupplyFuncCall{v0, v1, r0, r1}) - return r0, r1 -} - -// SetDefaultHook sets function that is called when the GetTotalSupply -// method of the parent MockLeverageKeeper instance is invoked and the hook -// queue is empty. -func (f *LeverageKeeperGetTotalSupplyFunc) SetDefaultHook(hook func(types.Context, string) (types.Coin, error)) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// GetTotalSupply method of the parent MockLeverageKeeper instance invokes -// the hook at the front of the queue and discards it. After the queue is -// empty, the default hook function is invoked for any future action. -func (f *LeverageKeeperGetTotalSupplyFunc) PushHook(hook func(types.Context, string) (types.Coin, error)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *LeverageKeeperGetTotalSupplyFunc) SetDefaultReturn(r0 types.Coin, r1 error) { - f.SetDefaultHook(func(types.Context, string) (types.Coin, error) { - return r0, r1 - }) + ctrl *gomock.Controller + recorder *MockLeverageKeeperMockRecorder } -// PushReturn calls PushHook with a function that returns the given values. -func (f *LeverageKeeperGetTotalSupplyFunc) PushReturn(r0 types.Coin, r1 error) { - f.PushHook(func(types.Context, string) (types.Coin, error) { - return r0, r1 - }) +// MockLeverageKeeperMockRecorder is the mock recorder for MockLeverageKeeper. +type MockLeverageKeeperMockRecorder struct { + mock *MockLeverageKeeper } -func (f *LeverageKeeperGetTotalSupplyFunc) nextHook() func(types.Context, string) (types.Coin, error) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook +// NewMockLeverageKeeper creates a new mock instance. +func NewMockLeverageKeeper(ctrl *gomock.Controller) *MockLeverageKeeper { + mock := &MockLeverageKeeper{ctrl: ctrl} + mock.recorder = &MockLeverageKeeperMockRecorder{mock} + return mock } -func (f *LeverageKeeperGetTotalSupplyFunc) appendCall(r0 LeverageKeeperGetTotalSupplyFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockLeverageKeeper) EXPECT() *MockLeverageKeeperMockRecorder { + return m.recorder } -// History returns a sequence of LeverageKeeperGetTotalSupplyFuncCall -// objects describing the invocations of this function. -func (f *LeverageKeeperGetTotalSupplyFunc) History() []LeverageKeeperGetTotalSupplyFuncCall { - f.mutex.Lock() - history := make([]LeverageKeeperGetTotalSupplyFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history +// GetAllSupplied mocks base method. +func (m *MockLeverageKeeper) GetAllSupplied(ctx types.Context, supplierAddr types.AccAddress) (types.Coins, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllSupplied", ctx, supplierAddr) + ret0, _ := ret[0].(types.Coins) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// LeverageKeeperGetTotalSupplyFuncCall is an object that describes an -// invocation of method GetTotalSupply on an instance of MockLeverageKeeper. -type LeverageKeeperGetTotalSupplyFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 string - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 types.Coin - // Result1 is the value of the 2nd result returned from this method - // invocation. - Result1 error +// GetAllSupplied indicates an expected call of GetAllSupplied. +func (mr *MockLeverageKeeperMockRecorder) GetAllSupplied(ctx, supplierAddr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllSupplied", reflect.TypeOf((*MockLeverageKeeper)(nil).GetAllSupplied), ctx, supplierAddr) } -// Args returns an interface slice containing the arguments of this -// invocation. -func (c LeverageKeeperGetTotalSupplyFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1} +// GetTokenSettings mocks base method. +func (m *MockLeverageKeeper) GetTokenSettings(ctx types.Context, denom string) (types0.Token, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTokenSettings", ctx, denom) + ret0, _ := ret[0].(types0.Token) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Results returns an interface slice containing the results of this -// invocation. -func (c LeverageKeeperGetTotalSupplyFuncCall) Results() []interface{} { - return []interface{}{c.Result0, c.Result1} +// GetTokenSettings indicates an expected call of GetTokenSettings. +func (mr *MockLeverageKeeperMockRecorder) GetTokenSettings(ctx, denom interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTokenSettings", reflect.TypeOf((*MockLeverageKeeper)(nil).GetTokenSettings), ctx, denom) } -// LeverageKeeperModuleMaxWithdrawFunc describes the behavior when the -// ModuleMaxWithdraw method of the parent MockLeverageKeeper instance is -// invoked. -type LeverageKeeperModuleMaxWithdrawFunc struct { - defaultHook func(types.Context, types.Coin) (math.Int, error) - hooks []func(types.Context, types.Coin) (math.Int, error) - history []LeverageKeeperModuleMaxWithdrawFuncCall - mutex sync.Mutex +// GetTotalSupply mocks base method. +func (m *MockLeverageKeeper) GetTotalSupply(ctx types.Context, denom string) (types.Coin, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetTotalSupply", ctx, denom) + ret0, _ := ret[0].(types.Coin) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// ModuleMaxWithdraw delegates to the next hook function in the queue and -// stores the parameter and result values of this invocation. -func (m *MockLeverageKeeper) ModuleMaxWithdraw(v0 types.Context, v1 types.Coin) (math.Int, error) { - r0, r1 := m.ModuleMaxWithdrawFunc.nextHook()(v0, v1) - m.ModuleMaxWithdrawFunc.appendCall(LeverageKeeperModuleMaxWithdrawFuncCall{v0, v1, r0, r1}) - return r0, r1 +// GetTotalSupply indicates an expected call of GetTotalSupply. +func (mr *MockLeverageKeeperMockRecorder) GetTotalSupply(ctx, denom interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTotalSupply", reflect.TypeOf((*MockLeverageKeeper)(nil).GetTotalSupply), ctx, denom) } -// SetDefaultHook sets function that is called when the ModuleMaxWithdraw -// method of the parent MockLeverageKeeper instance is invoked and the hook -// queue is empty. -func (f *LeverageKeeperModuleMaxWithdrawFunc) SetDefaultHook(hook func(types.Context, types.Coin) (math.Int, error)) { - f.defaultHook = hook +// ModuleMaxWithdraw mocks base method. +func (m *MockLeverageKeeper) ModuleMaxWithdraw(ctx types.Context, spendableUTokens types.Coin) (math.Int, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ModuleMaxWithdraw", ctx, spendableUTokens) + ret0, _ := ret[0].(math.Int) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// PushHook adds a function to the end of hook queue. Each invocation of the -// ModuleMaxWithdraw method of the parent MockLeverageKeeper instance -// invokes the hook at the front of the queue and discards it. After the -// queue is empty, the default hook function is invoked for any future -// action. -func (f *LeverageKeeperModuleMaxWithdrawFunc) PushHook(hook func(types.Context, types.Coin) (math.Int, error)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() +// ModuleMaxWithdraw indicates an expected call of ModuleMaxWithdraw. +func (mr *MockLeverageKeeperMockRecorder) ModuleMaxWithdraw(ctx, spendableUTokens interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ModuleMaxWithdraw", reflect.TypeOf((*MockLeverageKeeper)(nil).ModuleMaxWithdraw), ctx, spendableUTokens) } -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *LeverageKeeperModuleMaxWithdrawFunc) SetDefaultReturn(r0 math.Int, r1 error) { - f.SetDefaultHook(func(types.Context, types.Coin) (math.Int, error) { - return r0, r1 - }) +// SupplyFromModule mocks base method. +func (m *MockLeverageKeeper) SupplyFromModule(ctx types.Context, fromModule string, coin types.Coin) (types.Coin, bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SupplyFromModule", ctx, fromModule, coin) + ret0, _ := ret[0].(types.Coin) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 } -// PushReturn calls PushHook with a function that returns the given values. -func (f *LeverageKeeperModuleMaxWithdrawFunc) PushReturn(r0 math.Int, r1 error) { - f.PushHook(func(types.Context, types.Coin) (math.Int, error) { - return r0, r1 - }) +// SupplyFromModule indicates an expected call of SupplyFromModule. +func (mr *MockLeverageKeeperMockRecorder) SupplyFromModule(ctx, fromModule, coin interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SupplyFromModule", reflect.TypeOf((*MockLeverageKeeper)(nil).SupplyFromModule), ctx, fromModule, coin) } -func (f *LeverageKeeperModuleMaxWithdrawFunc) nextHook() func(types.Context, types.Coin) (math.Int, error) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *LeverageKeeperModuleMaxWithdrawFunc) appendCall(r0 LeverageKeeperModuleMaxWithdrawFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of LeverageKeeperModuleMaxWithdrawFuncCall -// objects describing the invocations of this function. -func (f *LeverageKeeperModuleMaxWithdrawFunc) History() []LeverageKeeperModuleMaxWithdrawFuncCall { - f.mutex.Lock() - history := make([]LeverageKeeperModuleMaxWithdrawFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history +// ToToken mocks base method. +func (m *MockLeverageKeeper) ToToken(ctx types.Context, uToken types.Coin) (types.Coin, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ToToken", ctx, uToken) + ret0, _ := ret[0].(types.Coin) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// LeverageKeeperModuleMaxWithdrawFuncCall is an object that describes an -// invocation of method ModuleMaxWithdraw on an instance of -// MockLeverageKeeper. -type LeverageKeeperModuleMaxWithdrawFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 types.Coin - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 math.Int - // Result1 is the value of the 2nd result returned from this method - // invocation. - Result1 error +// ToToken indicates an expected call of ToToken. +func (mr *MockLeverageKeeperMockRecorder) ToToken(ctx, uToken interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToToken", reflect.TypeOf((*MockLeverageKeeper)(nil).ToToken), ctx, uToken) } -// Args returns an interface slice containing the arguments of this -// invocation. -func (c LeverageKeeperModuleMaxWithdrawFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1} +// ToUToken mocks base method. +func (m *MockLeverageKeeper) ToUToken(ctx types.Context, token types.Coin) (types.Coin, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ToUToken", ctx, token) + ret0, _ := ret[0].(types.Coin) + ret1, _ := ret[1].(error) + return ret0, ret1 } -// Results returns an interface slice containing the results of this -// invocation. -func (c LeverageKeeperModuleMaxWithdrawFuncCall) Results() []interface{} { - return []interface{}{c.Result0, c.Result1} +// ToUToken indicates an expected call of ToUToken. +func (mr *MockLeverageKeeperMockRecorder) ToUToken(ctx, token interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ToUToken", reflect.TypeOf((*MockLeverageKeeper)(nil).ToUToken), ctx, token) } -// LeverageKeeperSupplyFromModuleFunc describes the behavior when the -// SupplyFromModule method of the parent MockLeverageKeeper instance is -// invoked. -type LeverageKeeperSupplyFromModuleFunc struct { - defaultHook func(types.Context, string, types.Coin) (types.Coin, bool, error) - hooks []func(types.Context, string, types.Coin) (types.Coin, bool, error) - history []LeverageKeeperSupplyFromModuleFuncCall - mutex sync.Mutex +// WithdrawToModule mocks base method. +func (m *MockLeverageKeeper) WithdrawToModule(ctx types.Context, toModule string, uToken types.Coin) (types.Coin, bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WithdrawToModule", ctx, toModule, uToken) + ret0, _ := ret[0].(types.Coin) + ret1, _ := ret[1].(bool) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 } -// SupplyFromModule delegates to the next hook function in the queue and -// stores the parameter and result values of this invocation. -func (m *MockLeverageKeeper) SupplyFromModule(v0 types.Context, v1 string, v2 types.Coin) (types.Coin, bool, error) { - r0, r1, r2 := m.SupplyFromModuleFunc.nextHook()(v0, v1, v2) - m.SupplyFromModuleFunc.appendCall(LeverageKeeperSupplyFromModuleFuncCall{v0, v1, v2, r0, r1, r2}) - return r0, r1, r2 +// WithdrawToModule indicates an expected call of WithdrawToModule. +func (mr *MockLeverageKeeperMockRecorder) WithdrawToModule(ctx, toModule, uToken interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WithdrawToModule", reflect.TypeOf((*MockLeverageKeeper)(nil).WithdrawToModule), ctx, toModule, uToken) } -// SetDefaultHook sets function that is called when the SupplyFromModule -// method of the parent MockLeverageKeeper instance is invoked and the hook -// queue is empty. -func (f *LeverageKeeperSupplyFromModuleFunc) SetDefaultHook(hook func(types.Context, string, types.Coin) (types.Coin, bool, error)) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// SupplyFromModule method of the parent MockLeverageKeeper instance invokes -// the hook at the front of the queue and discards it. After the queue is -// empty, the default hook function is invoked for any future action. -func (f *LeverageKeeperSupplyFromModuleFunc) PushHook(hook func(types.Context, string, types.Coin) (types.Coin, bool, error)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *LeverageKeeperSupplyFromModuleFunc) SetDefaultReturn(r0 types.Coin, r1 bool, r2 error) { - f.SetDefaultHook(func(types.Context, string, types.Coin) (types.Coin, bool, error) { - return r0, r1, r2 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *LeverageKeeperSupplyFromModuleFunc) PushReturn(r0 types.Coin, r1 bool, r2 error) { - f.PushHook(func(types.Context, string, types.Coin) (types.Coin, bool, error) { - return r0, r1, r2 - }) -} - -func (f *LeverageKeeperSupplyFromModuleFunc) nextHook() func(types.Context, string, types.Coin) (types.Coin, bool, error) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *LeverageKeeperSupplyFromModuleFunc) appendCall(r0 LeverageKeeperSupplyFromModuleFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of LeverageKeeperSupplyFromModuleFuncCall -// objects describing the invocations of this function. -func (f *LeverageKeeperSupplyFromModuleFunc) History() []LeverageKeeperSupplyFromModuleFuncCall { - f.mutex.Lock() - history := make([]LeverageKeeperSupplyFromModuleFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// LeverageKeeperSupplyFromModuleFuncCall is an object that describes an -// invocation of method SupplyFromModule on an instance of -// MockLeverageKeeper. -type LeverageKeeperSupplyFromModuleFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 string - // Arg2 is the value of the 3rd argument passed to this method - // invocation. - Arg2 types.Coin - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 types.Coin - // Result1 is the value of the 2nd result returned from this method - // invocation. - Result1 bool - // Result2 is the value of the 3rd result returned from this method - // invocation. - Result2 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c LeverageKeeperSupplyFromModuleFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1, c.Arg2} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c LeverageKeeperSupplyFromModuleFuncCall) Results() []interface{} { - return []interface{}{c.Result0, c.Result1, c.Result2} -} - -// LeverageKeeperToTokenFunc describes the behavior when the ToToken method -// of the parent MockLeverageKeeper instance is invoked. -type LeverageKeeperToTokenFunc struct { - defaultHook func(types.Context, types.Coin) (types.Coin, error) - hooks []func(types.Context, types.Coin) (types.Coin, error) - history []LeverageKeeperToTokenFuncCall - mutex sync.Mutex -} - -// ToToken delegates to the next hook function in the queue and stores the -// parameter and result values of this invocation. -func (m *MockLeverageKeeper) ToToken(v0 types.Context, v1 types.Coin) (types.Coin, error) { - r0, r1 := m.ToTokenFunc.nextHook()(v0, v1) - m.ToTokenFunc.appendCall(LeverageKeeperToTokenFuncCall{v0, v1, r0, r1}) - return r0, r1 -} - -// SetDefaultHook sets function that is called when the ToToken method of -// the parent MockLeverageKeeper instance is invoked and the hook queue is -// empty. -func (f *LeverageKeeperToTokenFunc) SetDefaultHook(hook func(types.Context, types.Coin) (types.Coin, error)) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// ToToken method of the parent MockLeverageKeeper instance invokes the hook -// at the front of the queue and discards it. After the queue is empty, the -// default hook function is invoked for any future action. -func (f *LeverageKeeperToTokenFunc) PushHook(hook func(types.Context, types.Coin) (types.Coin, error)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *LeverageKeeperToTokenFunc) SetDefaultReturn(r0 types.Coin, r1 error) { - f.SetDefaultHook(func(types.Context, types.Coin) (types.Coin, error) { - return r0, r1 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *LeverageKeeperToTokenFunc) PushReturn(r0 types.Coin, r1 error) { - f.PushHook(func(types.Context, types.Coin) (types.Coin, error) { - return r0, r1 - }) -} - -func (f *LeverageKeeperToTokenFunc) nextHook() func(types.Context, types.Coin) (types.Coin, error) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *LeverageKeeperToTokenFunc) appendCall(r0 LeverageKeeperToTokenFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of LeverageKeeperToTokenFuncCall objects -// describing the invocations of this function. -func (f *LeverageKeeperToTokenFunc) History() []LeverageKeeperToTokenFuncCall { - f.mutex.Lock() - history := make([]LeverageKeeperToTokenFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// LeverageKeeperToTokenFuncCall is an object that describes an invocation -// of method ToToken on an instance of MockLeverageKeeper. -type LeverageKeeperToTokenFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 types.Coin - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 types.Coin - // Result1 is the value of the 2nd result returned from this method - // invocation. - Result1 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c LeverageKeeperToTokenFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c LeverageKeeperToTokenFuncCall) Results() []interface{} { - return []interface{}{c.Result0, c.Result1} -} - -// LeverageKeeperToUTokenFunc describes the behavior when the ToUToken -// method of the parent MockLeverageKeeper instance is invoked. -type LeverageKeeperToUTokenFunc struct { - defaultHook func(types.Context, types.Coin) (types.Coin, error) - hooks []func(types.Context, types.Coin) (types.Coin, error) - history []LeverageKeeperToUTokenFuncCall - mutex sync.Mutex -} - -// ToUToken delegates to the next hook function in the queue and stores the -// parameter and result values of this invocation. -func (m *MockLeverageKeeper) ToUToken(v0 types.Context, v1 types.Coin) (types.Coin, error) { - r0, r1 := m.ToUTokenFunc.nextHook()(v0, v1) - m.ToUTokenFunc.appendCall(LeverageKeeperToUTokenFuncCall{v0, v1, r0, r1}) - return r0, r1 -} - -// SetDefaultHook sets function that is called when the ToUToken method of -// the parent MockLeverageKeeper instance is invoked and the hook queue is -// empty. -func (f *LeverageKeeperToUTokenFunc) SetDefaultHook(hook func(types.Context, types.Coin) (types.Coin, error)) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// ToUToken method of the parent MockLeverageKeeper instance invokes the -// hook at the front of the queue and discards it. After the queue is empty, -// the default hook function is invoked for any future action. -func (f *LeverageKeeperToUTokenFunc) PushHook(hook func(types.Context, types.Coin) (types.Coin, error)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *LeverageKeeperToUTokenFunc) SetDefaultReturn(r0 types.Coin, r1 error) { - f.SetDefaultHook(func(types.Context, types.Coin) (types.Coin, error) { - return r0, r1 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *LeverageKeeperToUTokenFunc) PushReturn(r0 types.Coin, r1 error) { - f.PushHook(func(types.Context, types.Coin) (types.Coin, error) { - return r0, r1 - }) -} - -func (f *LeverageKeeperToUTokenFunc) nextHook() func(types.Context, types.Coin) (types.Coin, error) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *LeverageKeeperToUTokenFunc) appendCall(r0 LeverageKeeperToUTokenFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of LeverageKeeperToUTokenFuncCall objects -// describing the invocations of this function. -func (f *LeverageKeeperToUTokenFunc) History() []LeverageKeeperToUTokenFuncCall { - f.mutex.Lock() - history := make([]LeverageKeeperToUTokenFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// LeverageKeeperToUTokenFuncCall is an object that describes an invocation -// of method ToUToken on an instance of MockLeverageKeeper. -type LeverageKeeperToUTokenFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 types.Coin - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 types.Coin - // Result1 is the value of the 2nd result returned from this method - // invocation. - Result1 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c LeverageKeeperToUTokenFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c LeverageKeeperToUTokenFuncCall) Results() []interface{} { - return []interface{}{c.Result0, c.Result1} -} - -// LeverageKeeperWithdrawToModuleFunc describes the behavior when the -// WithdrawToModule method of the parent MockLeverageKeeper instance is -// invoked. -type LeverageKeeperWithdrawToModuleFunc struct { - defaultHook func(types.Context, string, types.Coin) (types.Coin, bool, error) - hooks []func(types.Context, string, types.Coin) (types.Coin, bool, error) - history []LeverageKeeperWithdrawToModuleFuncCall - mutex sync.Mutex -} - -// WithdrawToModule delegates to the next hook function in the queue and -// stores the parameter and result values of this invocation. -func (m *MockLeverageKeeper) WithdrawToModule(v0 types.Context, v1 string, v2 types.Coin) (types.Coin, bool, error) { - r0, r1, r2 := m.WithdrawToModuleFunc.nextHook()(v0, v1, v2) - m.WithdrawToModuleFunc.appendCall(LeverageKeeperWithdrawToModuleFuncCall{v0, v1, v2, r0, r1, r2}) - return r0, r1, r2 -} - -// SetDefaultHook sets function that is called when the WithdrawToModule -// method of the parent MockLeverageKeeper instance is invoked and the hook -// queue is empty. -func (f *LeverageKeeperWithdrawToModuleFunc) SetDefaultHook(hook func(types.Context, string, types.Coin) (types.Coin, bool, error)) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// WithdrawToModule method of the parent MockLeverageKeeper instance invokes -// the hook at the front of the queue and discards it. After the queue is -// empty, the default hook function is invoked for any future action. -func (f *LeverageKeeperWithdrawToModuleFunc) PushHook(hook func(types.Context, string, types.Coin) (types.Coin, bool, error)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *LeverageKeeperWithdrawToModuleFunc) SetDefaultReturn(r0 types.Coin, r1 bool, r2 error) { - f.SetDefaultHook(func(types.Context, string, types.Coin) (types.Coin, bool, error) { - return r0, r1, r2 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *LeverageKeeperWithdrawToModuleFunc) PushReturn(r0 types.Coin, r1 bool, r2 error) { - f.PushHook(func(types.Context, string, types.Coin) (types.Coin, bool, error) { - return r0, r1, r2 - }) -} - -func (f *LeverageKeeperWithdrawToModuleFunc) nextHook() func(types.Context, string, types.Coin) (types.Coin, bool, error) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *LeverageKeeperWithdrawToModuleFunc) appendCall(r0 LeverageKeeperWithdrawToModuleFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of LeverageKeeperWithdrawToModuleFuncCall -// objects describing the invocations of this function. -func (f *LeverageKeeperWithdrawToModuleFunc) History() []LeverageKeeperWithdrawToModuleFuncCall { - f.mutex.Lock() - history := make([]LeverageKeeperWithdrawToModuleFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// LeverageKeeperWithdrawToModuleFuncCall is an object that describes an -// invocation of method WithdrawToModule on an instance of -// MockLeverageKeeper. -type LeverageKeeperWithdrawToModuleFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 string - // Arg2 is the value of the 3rd argument passed to this method - // invocation. - Arg2 types.Coin - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 types.Coin - // Result1 is the value of the 2nd result returned from this method - // invocation. - Result1 bool - // Result2 is the value of the 3rd result returned from this method - // invocation. - Result2 error -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c LeverageKeeperWithdrawToModuleFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1, c.Arg2} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c LeverageKeeperWithdrawToModuleFuncCall) Results() []interface{} { - return []interface{}{c.Result0, c.Result1, c.Result2} -} - -// MockOracleKeeper is a mock implementation of the OracleKeeper interface -// (from the package github.com/umee-network/umee/v6/x/metoken) used for -// unit testing. +// MockOracleKeeper is a mock of OracleKeeper interface. type MockOracleKeeper struct { - // AllMedianPricesFunc is an instance of a mock function object - // controlling the behavior of the method AllMedianPrices. - AllMedianPricesFunc *OracleKeeperAllMedianPricesFunc - // SetExchangeRateWithEventFunc is an instance of a mock function object - // controlling the behavior of the method SetExchangeRateWithEvent. - SetExchangeRateWithEventFunc *OracleKeeperSetExchangeRateWithEventFunc -} - -// NewMockOracleKeeper creates a new mock of the OracleKeeper interface. All -// methods return zero values for all results, unless overwritten. -func NewMockOracleKeeper() *MockOracleKeeper { - return &MockOracleKeeper{ - AllMedianPricesFunc: &OracleKeeperAllMedianPricesFunc{ - defaultHook: func(types.Context) (r0 types2.Prices) { - return - }, - }, - SetExchangeRateWithEventFunc: &OracleKeeperSetExchangeRateWithEventFunc{ - defaultHook: func(types.Context, string, math.LegacyDec) { - return - }, - }, - } -} - -// NewStrictMockOracleKeeper creates a new mock of the OracleKeeper -// interface. All methods panic on invocation, unless overwritten. -func NewStrictMockOracleKeeper() *MockOracleKeeper { - return &MockOracleKeeper{ - AllMedianPricesFunc: &OracleKeeperAllMedianPricesFunc{ - defaultHook: func(types.Context) types2.Prices { - panic("unexpected invocation of MockOracleKeeper.AllMedianPrices") - }, - }, - SetExchangeRateWithEventFunc: &OracleKeeperSetExchangeRateWithEventFunc{ - defaultHook: func(types.Context, string, math.LegacyDec) { - panic("unexpected invocation of MockOracleKeeper.SetExchangeRateWithEvent") - }, - }, - } -} - -// NewMockOracleKeeperFrom creates a new mock of the MockOracleKeeper -// interface. All methods delegate to the given implementation, unless -// overwritten. -func NewMockOracleKeeperFrom(i metoken.OracleKeeper) *MockOracleKeeper { - return &MockOracleKeeper{ - AllMedianPricesFunc: &OracleKeeperAllMedianPricesFunc{ - defaultHook: i.AllMedianPrices, - }, - SetExchangeRateWithEventFunc: &OracleKeeperSetExchangeRateWithEventFunc{ - defaultHook: i.SetExchangeRateWithEvent, - }, - } + ctrl *gomock.Controller + recorder *MockOracleKeeperMockRecorder } -// OracleKeeperAllMedianPricesFunc describes the behavior when the -// AllMedianPrices method of the parent MockOracleKeeper instance is -// invoked. -type OracleKeeperAllMedianPricesFunc struct { - defaultHook func(types.Context) types2.Prices - hooks []func(types.Context) types2.Prices - history []OracleKeeperAllMedianPricesFuncCall - mutex sync.Mutex +// MockOracleKeeperMockRecorder is the mock recorder for MockOracleKeeper. +type MockOracleKeeperMockRecorder struct { + mock *MockOracleKeeper } -// AllMedianPrices delegates to the next hook function in the queue and -// stores the parameter and result values of this invocation. -func (m *MockOracleKeeper) AllMedianPrices(v0 types.Context) types2.Prices { - r0 := m.AllMedianPricesFunc.nextHook()(v0) - m.AllMedianPricesFunc.appendCall(OracleKeeperAllMedianPricesFuncCall{v0, r0}) - return r0 +// NewMockOracleKeeper creates a new mock instance. +func NewMockOracleKeeper(ctrl *gomock.Controller) *MockOracleKeeper { + mock := &MockOracleKeeper{ctrl: ctrl} + mock.recorder = &MockOracleKeeperMockRecorder{mock} + return mock } -// SetDefaultHook sets function that is called when the AllMedianPrices -// method of the parent MockOracleKeeper instance is invoked and the hook -// queue is empty. -func (f *OracleKeeperAllMedianPricesFunc) SetDefaultHook(hook func(types.Context) types2.Prices) { - f.defaultHook = hook +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockOracleKeeper) EXPECT() *MockOracleKeeperMockRecorder { + return m.recorder } -// PushHook adds a function to the end of hook queue. Each invocation of the -// AllMedianPrices method of the parent MockOracleKeeper instance invokes -// the hook at the front of the queue and discards it. After the queue is -// empty, the default hook function is invoked for any future action. -func (f *OracleKeeperAllMedianPricesFunc) PushHook(hook func(types.Context) types2.Prices) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *OracleKeeperAllMedianPricesFunc) SetDefaultReturn(r0 types2.Prices) { - f.SetDefaultHook(func(types.Context) types2.Prices { - return r0 - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *OracleKeeperAllMedianPricesFunc) PushReturn(r0 types2.Prices) { - f.PushHook(func(types.Context) types2.Prices { - return r0 - }) -} - -func (f *OracleKeeperAllMedianPricesFunc) nextHook() func(types.Context) types2.Prices { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *OracleKeeperAllMedianPricesFunc) appendCall(r0 OracleKeeperAllMedianPricesFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of OracleKeeperAllMedianPricesFuncCall objects -// describing the invocations of this function. -func (f *OracleKeeperAllMedianPricesFunc) History() []OracleKeeperAllMedianPricesFuncCall { - f.mutex.Lock() - history := make([]OracleKeeperAllMedianPricesFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history -} - -// OracleKeeperAllMedianPricesFuncCall is an object that describes an -// invocation of method AllMedianPrices on an instance of MockOracleKeeper. -type OracleKeeperAllMedianPricesFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Result0 is the value of the 1st result returned from this method - // invocation. - Result0 types2.Prices -} - -// Args returns an interface slice containing the arguments of this -// invocation. -func (c OracleKeeperAllMedianPricesFuncCall) Args() []interface{} { - return []interface{}{c.Arg0} -} - -// Results returns an interface slice containing the results of this -// invocation. -func (c OracleKeeperAllMedianPricesFuncCall) Results() []interface{} { - return []interface{}{c.Result0} -} - -// OracleKeeperSetExchangeRateWithEventFunc describes the behavior when the -// SetExchangeRateWithEvent method of the parent MockOracleKeeper instance -// is invoked. -type OracleKeeperSetExchangeRateWithEventFunc struct { - defaultHook func(types.Context, string, math.LegacyDec) - hooks []func(types.Context, string, math.LegacyDec) - history []OracleKeeperSetExchangeRateWithEventFuncCall - mutex sync.Mutex -} - -// SetExchangeRateWithEvent delegates to the next hook function in the queue -// and stores the parameter and result values of this invocation. -func (m *MockOracleKeeper) SetExchangeRateWithEvent(v0 types.Context, v1 string, v2 math.LegacyDec) { - m.SetExchangeRateWithEventFunc.nextHook()(v0, v1, v2) - m.SetExchangeRateWithEventFunc.appendCall(OracleKeeperSetExchangeRateWithEventFuncCall{v0, v1, v2}) - return -} - -// SetDefaultHook sets function that is called when the -// SetExchangeRateWithEvent method of the parent MockOracleKeeper instance -// is invoked and the hook queue is empty. -func (f *OracleKeeperSetExchangeRateWithEventFunc) SetDefaultHook(hook func(types.Context, string, math.LegacyDec)) { - f.defaultHook = hook -} - -// PushHook adds a function to the end of hook queue. Each invocation of the -// SetExchangeRateWithEvent method of the parent MockOracleKeeper instance -// invokes the hook at the front of the queue and discards it. After the -// queue is empty, the default hook function is invoked for any future -// action. -func (f *OracleKeeperSetExchangeRateWithEventFunc) PushHook(hook func(types.Context, string, math.LegacyDec)) { - f.mutex.Lock() - f.hooks = append(f.hooks, hook) - f.mutex.Unlock() -} - -// SetDefaultReturn calls SetDefaultHook with a function that returns the -// given values. -func (f *OracleKeeperSetExchangeRateWithEventFunc) SetDefaultReturn() { - f.SetDefaultHook(func(types.Context, string, math.LegacyDec) { - return - }) -} - -// PushReturn calls PushHook with a function that returns the given values. -func (f *OracleKeeperSetExchangeRateWithEventFunc) PushReturn() { - f.PushHook(func(types.Context, string, math.LegacyDec) { - return - }) -} - -func (f *OracleKeeperSetExchangeRateWithEventFunc) nextHook() func(types.Context, string, math.LegacyDec) { - f.mutex.Lock() - defer f.mutex.Unlock() - - if len(f.hooks) == 0 { - return f.defaultHook - } - - hook := f.hooks[0] - f.hooks = f.hooks[1:] - return hook -} - -func (f *OracleKeeperSetExchangeRateWithEventFunc) appendCall(r0 OracleKeeperSetExchangeRateWithEventFuncCall) { - f.mutex.Lock() - f.history = append(f.history, r0) - f.mutex.Unlock() -} - -// History returns a sequence of -// OracleKeeperSetExchangeRateWithEventFuncCall objects describing the -// invocations of this function. -func (f *OracleKeeperSetExchangeRateWithEventFunc) History() []OracleKeeperSetExchangeRateWithEventFuncCall { - f.mutex.Lock() - history := make([]OracleKeeperSetExchangeRateWithEventFuncCall, len(f.history)) - copy(history, f.history) - f.mutex.Unlock() - - return history +// AllMedianPrices mocks base method. +func (m *MockOracleKeeper) AllMedianPrices(ctx types.Context) types1.Prices { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AllMedianPrices", ctx) + ret0, _ := ret[0].(types1.Prices) + return ret0 } -// OracleKeeperSetExchangeRateWithEventFuncCall is an object that describes -// an invocation of method SetExchangeRateWithEvent on an instance of -// MockOracleKeeper. -type OracleKeeperSetExchangeRateWithEventFuncCall struct { - // Arg0 is the value of the 1st argument passed to this method - // invocation. - Arg0 types.Context - // Arg1 is the value of the 2nd argument passed to this method - // invocation. - Arg1 string - // Arg2 is the value of the 3rd argument passed to this method - // invocation. - Arg2 math.LegacyDec +// AllMedianPrices indicates an expected call of AllMedianPrices. +func (mr *MockOracleKeeperMockRecorder) AllMedianPrices(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AllMedianPrices", reflect.TypeOf((*MockOracleKeeper)(nil).AllMedianPrices), ctx) } -// Args returns an interface slice containing the arguments of this -// invocation. -func (c OracleKeeperSetExchangeRateWithEventFuncCall) Args() []interface{} { - return []interface{}{c.Arg0, c.Arg1, c.Arg2} +// SetExchangeRateWithEvent mocks base method. +func (m *MockOracleKeeper) SetExchangeRateWithEvent(ctx types.Context, denom string, rate types.Dec) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetExchangeRateWithEvent", ctx, denom, rate) } -// Results returns an interface slice containing the results of this -// invocation. -func (c OracleKeeperSetExchangeRateWithEventFuncCall) Results() []interface{} { - return []interface{}{} +// SetExchangeRateWithEvent indicates an expected call of SetExchangeRateWithEvent. +func (mr *MockOracleKeeperMockRecorder) SetExchangeRateWithEvent(ctx, denom, rate interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetExchangeRateWithEvent", reflect.TypeOf((*MockOracleKeeper)(nil).SetExchangeRateWithEvent), ctx, denom, rate) }