From 3472ac63434028d80548b468b939976fd31f6279 Mon Sep 17 00:00:00 2001 From: Sammy Date: Mon, 13 Nov 2023 12:37:22 -0800 Subject: [PATCH] feat(nexus): add the wasm message route (#2023) --- app/app.go | 8 +- x/axelarnet/keeper/message_route.go | 1 + x/evm/keeper/message_route.go | 1 + x/nexus/exported/types.go | 13 + x/nexus/keeper/general_message.go | 9 +- x/nexus/keeper/msg_dispatcher.go | 6 +- x/nexus/keeper/wasm_message_route.go | 40 + x/nexus/keeper/wasm_message_route_test.go | 101 +++ x/nexus/types/expected_keepers.go | 13 +- x/nexus/types/mock/expected_keepers.go | 851 ++++++++++++++++++++++ 10 files changed, 1035 insertions(+), 8 deletions(-) create mode 100644 x/nexus/keeper/wasm_message_route.go create mode 100644 x/nexus/keeper/wasm_message_route_test.go diff --git a/app/app.go b/app/app.go index 2d411de33..52d7930b4 100644 --- a/app/app.go +++ b/app/app.go @@ -300,7 +300,6 @@ func NewAxelarApp( messageRouter := nexusTypes.NewMessageRouter(). AddRoute(evmTypes.ModuleName, evmKeeper.NewMessageRoute()). AddRoute(axelarnetTypes.ModuleName, axelarnetKeeper.NewMessageRoute(getKeeper[axelarnetKeeper.Keeper](keepers), getKeeper[axelarnetKeeper.IBCKeeper](keepers), getKeeper[feegrantkeeper.Keeper](keepers), axelarbankkeeper.NewBankKeeper(getKeeper[bankkeeper.BaseKeeper](keepers)), getKeeper[nexusKeeper.Keeper](keepers), getKeeper[authkeeper.AccountKeeper](keepers))) - getKeeperAsRef[nexusKeeper.Keeper](keepers).SetMessageRouter(messageRouter) axelarnetModule := axelarnet.NewAppModule(getKeeper[axelarnetKeeper.Keeper](keepers), getKeeper[nexusKeeper.Keeper](keepers), axelarbankkeeper.NewBankKeeper(getKeeper[bankkeeper.BaseKeeper](keepers)), getKeeper[authkeeper.AccountKeeper](keepers), getKeeper[axelarnetKeeper.IBCKeeper](keepers), transferStack, rateLimiter, logger) @@ -355,10 +354,15 @@ func NewAxelarApp( ibcRouter.AddRoute(wasm.ModuleName, wasmStack) // set the contract keeper for the Ics20WasmHooks - wasmHooks.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(wasmK) + contractKeeper := wasmkeeper.NewDefaultPermissionKeeper(wasmK) + wasmHooks.ContractKeeper = contractKeeper setKeeper(keepers, wasmK) + + messageRouter.AddRoute(wasm.ModuleName, nexusKeeper.NewMessageRoute(getKeeperAsRef[nexusKeeper.Keeper](keepers), getKeeper[authkeeper.AccountKeeper](keepers), contractKeeper)) } + getKeeperAsRef[nexusKeeper.Keeper](keepers).SetMessageRouter(messageRouter) + // Finalize the IBC router getKeeperAsRef[ibckeeper.Keeper](keepers).SetRouter(ibcRouter) diff --git a/x/axelarnet/keeper/message_route.go b/x/axelarnet/keeper/message_route.go index 7a9dea84e..15d23f6ee 100644 --- a/x/axelarnet/keeper/message_route.go +++ b/x/axelarnet/keeper/message_route.go @@ -15,6 +15,7 @@ import ( // for IBC execution const gasCost = storetypes.Gas(1000000) +// NewMessageRoute creates a new message route func NewMessageRoute( keeper Keeper, ibcK types.IBCKeeper, diff --git a/x/evm/keeper/message_route.go b/x/evm/keeper/message_route.go index 02a252988..ec58b5df9 100644 --- a/x/evm/keeper/message_route.go +++ b/x/evm/keeper/message_route.go @@ -10,6 +10,7 @@ import ( // for commands approval const gasCost = storetypes.Gas(10000000) +// NewMessageRoute creates a new message route func NewMessageRoute() nexus.MessageRoute { return func(ctx sdk.Context, _ nexus.RoutingContext, _ nexus.GeneralMessage) error { ctx.GasMeter().ConsumeGas(gasCost, "execute-message") diff --git a/x/nexus/exported/types.go b/x/nexus/exported/types.go index 2aec97b50..95e5b840d 100644 --- a/x/nexus/exported/types.go +++ b/x/nexus/exported/types.go @@ -336,3 +336,16 @@ func (m GeneralMessage) Type() MessageType { return TypeGeneralMessageWithToken } + +// FromGeneralMessage returns a WasmMessage from a GeneralMessage +func FromGeneralMessage(msg GeneralMessage) WasmMessage { + return WasmMessage{ + SourceChain: msg.GetSourceChain(), + SourceAddress: msg.GetSourceAddress(), + DestinationChain: msg.GetDestinationChain(), + DestinationAddress: msg.GetDestinationAddress(), + PayloadHash: msg.PayloadHash, + SourceTxID: msg.SourceTxID, + SourceTxIndex: msg.SourceTxIndex, + } +} diff --git a/x/nexus/keeper/general_message.go b/x/nexus/keeper/general_message.go index 9cadceb04..832ed10f9 100644 --- a/x/nexus/keeper/general_message.go +++ b/x/nexus/keeper/general_message.go @@ -8,6 +8,7 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" "github.com/axelarnetwork/axelar-core/utils" @@ -244,5 +245,11 @@ func (k Keeper) RouteMessage(ctx sdk.Context, id string, routingCtx ...exported. if len(routingCtx) == 0 { routingCtx = []exported.RoutingContext{{}} } - return k.getMessageRouter().Route(ctx, routingCtx[0], funcs.MustOk(k.GetMessage(ctx, id))) + + msg := funcs.MustOk(k.GetMessage(ctx, id)) + if err := k.getMessageRouter().Route(ctx, routingCtx[0], msg); err != nil { + return sdkerrors.Wrapf(err, "failed to route message %s to the %s module", id, msg.Recipient.Chain.Module) + } + + return nil } diff --git a/x/nexus/keeper/msg_dispatcher.go b/x/nexus/keeper/msg_dispatcher.go index 329a4c41d..bd07fb369 100644 --- a/x/nexus/keeper/msg_dispatcher.go +++ b/x/nexus/keeper/msg_dispatcher.go @@ -19,8 +19,6 @@ import ( var _ wasmkeeper.Messenger = (*Messenger)(nil) -type request = exported.WasmMessage - type Messenger struct { types.Nexus } @@ -32,14 +30,14 @@ func NewMessenger(nexus types.Nexus) Messenger { // DispatchMsg decodes the messages from the cosmowasm gateway and routes them to the nexus module if possible func (m Messenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, _ string, msg wasmvmtypes.CosmosMsg) (events []sdk.Event, data [][]byte, err error) { - req := request{} + req := exported.WasmMessage{} if err := json.Unmarshal(msg.Custom, &req); err != nil { return nil, nil, sdkerrors.Wrap(wasmtypes.ErrUnknownMsg, err.Error()) } gateway := m.GetParams(ctx).Gateway - if len(gateway) == 0 { + if gateway.Empty() { return nil, nil, fmt.Errorf("gateway is not set") } diff --git a/x/nexus/keeper/wasm_message_route.go b/x/nexus/keeper/wasm_message_route.go new file mode 100644 index 000000000..933069f05 --- /dev/null +++ b/x/nexus/keeper/wasm_message_route.go @@ -0,0 +1,40 @@ +package keeper + +import ( + "encoding/json" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/axelarnetwork/axelar-core/x/nexus/exported" + types "github.com/axelarnetwork/axelar-core/x/nexus/types" +) + +type request struct { + RouteMessages []exported.WasmMessage `json:"route_messages"` +} + +// NewMessageRoute creates a new message route +func NewMessageRoute(nexus types.Nexus, account types.AccountKeeper, wasm types.WasmKeeper) exported.MessageRoute { + return func(ctx sdk.Context, _ exported.RoutingContext, msg exported.GeneralMessage) error { + if msg.Asset != nil { + return fmt.Errorf("asset transfer is not supported") + } + + gateway := nexus.GetParams(ctx).Gateway + if gateway.Empty() { + return fmt.Errorf("gateway is not set") + } + + bz, err := json.Marshal(request{RouteMessages: []exported.WasmMessage{exported.FromGeneralMessage(msg)}}) + if err != nil { + return nil + } + + if _, err := wasm.Execute(ctx, gateway, account.GetModuleAddress(types.ModuleName), bz, sdk.NewCoins()); err != nil { + return err + } + + return nil + } +} diff --git a/x/nexus/keeper/wasm_message_route_test.go b/x/nexus/keeper/wasm_message_route_test.go new file mode 100644 index 000000000..5484a5408 --- /dev/null +++ b/x/nexus/keeper/wasm_message_route_test.go @@ -0,0 +1,101 @@ +package keeper_test + +import ( + "encoding/json" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/axelarnetwork/axelar-core/testutils/fake" + "github.com/axelarnetwork/axelar-core/testutils/rand" + nexus "github.com/axelarnetwork/axelar-core/x/nexus/exported" + "github.com/axelarnetwork/axelar-core/x/nexus/keeper" + "github.com/axelarnetwork/axelar-core/x/nexus/types" + "github.com/axelarnetwork/axelar-core/x/nexus/types/mock" + . "github.com/axelarnetwork/utils/test" +) + +func TestNewMessageRoute(t *testing.T) { + var ( + ctx sdk.Context + route nexus.MessageRoute + msg nexus.GeneralMessage + + nexusK *mock.NexusMock + accountK *mock.AccountKeeperMock + wasmK *mock.WasmKeeperMock + gateway sdk.AccAddress + ) + + givenMessageRoute := Given("the message route", func() { + ctx = sdk.NewContext(fake.NewMultiStore(), tmproto.Header{}, false, log.TestingLogger()) + + nexusK = &mock.NexusMock{} + accountK = &mock.AccountKeeperMock{} + wasmK = &mock.WasmKeeperMock{} + + route = keeper.NewMessageRoute(nexusK, accountK, wasmK) + }) + + givenMessageRoute. + When("the gateway is not set", func() { + nexusK.GetParamsFunc = func(ctx sdk.Context) types.Params { return types.DefaultParams() } + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, route(ctx, nexus.RoutingContext{}, msg), "gateway is not set") + }). + Run(t) + + givenMessageRoute. + When("the gateway is set", func() { + nexusK.GetParamsFunc = func(ctx sdk.Context) types.Params { + gateway = rand.AccAddr() + + params := types.DefaultParams() + params.Gateway = gateway + + return params + } + }). + Branch( + When("the message has an asset", func() { + msg = randMsg(nexus.Processing, true) + }). + Then("should return error", func(t *testing.T) { + assert.ErrorContains(t, route(ctx, nexus.RoutingContext{}, msg), "asset transfer is not supported") + }), + + When("the message has no asset", func() { + msg = randMsg(nexus.Processing) + }). + Then("should execute the wasm message", func(t *testing.T) { + moduleAddr := rand.AccAddr() + accountK.GetModuleAddressFunc = func(_ string) sdk.AccAddress { return moduleAddr } + + wasmK.ExecuteFunc = func(_ sdk.Context, _, _ sdk.AccAddress, _ []byte, _ sdk.Coins) ([]byte, error) { + return nil, nil + } + + assert.NoError(t, route(ctx, nexus.RoutingContext{}, msg)) + + assert.Len(t, wasmK.ExecuteCalls(), 1) + assert.Equal(t, wasmK.ExecuteCalls()[0].ContractAddress, gateway) + assert.Equal(t, wasmK.ExecuteCalls()[0].Caller, moduleAddr) + assert.Empty(t, wasmK.ExecuteCalls()[0].Coins) + + type req struct { + RouteMessages []nexus.WasmMessage `json:"route_messages"` + } + + var actual req + assert.NoError(t, json.Unmarshal(wasmK.ExecuteCalls()[0].Msg, &actual)) + assert.Len(t, actual.RouteMessages, 1) + assert.Equal(t, nexus.FromGeneralMessage(msg), actual.RouteMessages[0]) + }), + ). + Run(t) + +} diff --git a/x/nexus/types/expected_keepers.go b/x/nexus/types/expected_keepers.go index 58945958f..e9aab25dc 100644 --- a/x/nexus/types/expected_keepers.go +++ b/x/nexus/types/expected_keepers.go @@ -3,6 +3,7 @@ package types import ( "time" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/tendermint/tendermint/libs/log" @@ -13,7 +14,7 @@ import ( snapshot "github.com/axelarnetwork/axelar-core/x/snapshot/exported" ) -//go:generate moq -out ./mock/expected_keepers.go -pkg mock . Nexus Snapshotter AxelarnetKeeper RewardKeeper SlashingKeeper +//go:generate moq -out ./mock/expected_keepers.go -pkg mock . Nexus Snapshotter AxelarnetKeeper RewardKeeper SlashingKeeper WasmKeeper AccountKeeper // Nexus provides functionality to manage cross-chain transfers type Nexus interface { @@ -73,3 +74,13 @@ type RewardKeeper interface { type SlashingKeeper interface { IsTombstoned(ctx sdk.Context, consAddr sdk.ConsAddress) bool } + +// WasmKeeper provides functionality to manage wasm contracts +type WasmKeeper interface { + wasmtypes.ContractOpsKeeper +} + +// AccountKeeper provides functionality to get account keeper +type AccountKeeper interface { + GetModuleAddress(moduleName string) sdk.AccAddress +} diff --git a/x/nexus/types/mock/expected_keepers.go b/x/nexus/types/mock/expected_keepers.go index c7af547e3..123b879e6 100644 --- a/x/nexus/types/mock/expected_keepers.go +++ b/x/nexus/types/mock/expected_keepers.go @@ -4,6 +4,7 @@ package mock import ( + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" utils "github.com/axelarnetwork/axelar-core/utils" github_com_axelarnetwork_axelar_core_x_nexus_exported "github.com/axelarnetwork/axelar-core/x/nexus/exported" nexustypes "github.com/axelarnetwork/axelar-core/x/nexus/types" @@ -1628,3 +1629,853 @@ func (mock *SlashingKeeperMock) IsTombstonedCalls() []struct { mock.lockIsTombstoned.RUnlock() return calls } + +// Ensure, that WasmKeeperMock does implement nexustypes.WasmKeeper. +// If this is not the case, regenerate this file with moq. +var _ nexustypes.WasmKeeper = &WasmKeeperMock{} + +// WasmKeeperMock is a mock implementation of nexustypes.WasmKeeper. +// +// func TestSomethingThatUsesWasmKeeper(t *testing.T) { +// +// // make and configure a mocked nexustypes.WasmKeeper +// mockedWasmKeeper := &WasmKeeperMock{ +// ClearContractAdminFunc: func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress) error { +// panic("mock out the ClearContractAdmin method") +// }, +// CreateFunc: func(ctx cosmossdktypes.Context, creator cosmossdktypes.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (uint64, []byte, error) { +// panic("mock out the Create method") +// }, +// ExecuteFunc: func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, msg []byte, coins cosmossdktypes.Coins) ([]byte, error) { +// panic("mock out the Execute method") +// }, +// InstantiateFunc: func(ctx cosmossdktypes.Context, codeID uint64, creator cosmossdktypes.AccAddress, admin cosmossdktypes.AccAddress, initMsg []byte, label string, deposit cosmossdktypes.Coins) (cosmossdktypes.AccAddress, []byte, error) { +// panic("mock out the Instantiate method") +// }, +// Instantiate2Func: func(ctx cosmossdktypes.Context, codeID uint64, creator cosmossdktypes.AccAddress, admin cosmossdktypes.AccAddress, initMsg []byte, label string, deposit cosmossdktypes.Coins, salt []byte, fixMsg bool) (cosmossdktypes.AccAddress, []byte, error) { +// panic("mock out the Instantiate2 method") +// }, +// MigrateFunc: func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, newCodeID uint64, msg []byte) ([]byte, error) { +// panic("mock out the Migrate method") +// }, +// PinCodeFunc: func(ctx cosmossdktypes.Context, codeID uint64) error { +// panic("mock out the PinCode method") +// }, +// SetAccessConfigFunc: func(ctx cosmossdktypes.Context, codeID uint64, caller cosmossdktypes.AccAddress, newConfig wasmtypes.AccessConfig) error { +// panic("mock out the SetAccessConfig method") +// }, +// SetContractInfoExtensionFunc: func(ctx cosmossdktypes.Context, contract cosmossdktypes.AccAddress, extra wasmtypes.ContractInfoExtension) error { +// panic("mock out the SetContractInfoExtension method") +// }, +// SudoFunc: func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, msg []byte) ([]byte, error) { +// panic("mock out the Sudo method") +// }, +// UnpinCodeFunc: func(ctx cosmossdktypes.Context, codeID uint64) error { +// panic("mock out the UnpinCode method") +// }, +// UpdateContractAdminFunc: func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, newAdmin cosmossdktypes.AccAddress) error { +// panic("mock out the UpdateContractAdmin method") +// }, +// } +// +// // use mockedWasmKeeper in code that requires nexustypes.WasmKeeper +// // and then make assertions. +// +// } +type WasmKeeperMock struct { + // ClearContractAdminFunc mocks the ClearContractAdmin method. + ClearContractAdminFunc func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress) error + + // CreateFunc mocks the Create method. + CreateFunc func(ctx cosmossdktypes.Context, creator cosmossdktypes.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (uint64, []byte, error) + + // ExecuteFunc mocks the Execute method. + ExecuteFunc func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, msg []byte, coins cosmossdktypes.Coins) ([]byte, error) + + // InstantiateFunc mocks the Instantiate method. + InstantiateFunc func(ctx cosmossdktypes.Context, codeID uint64, creator cosmossdktypes.AccAddress, admin cosmossdktypes.AccAddress, initMsg []byte, label string, deposit cosmossdktypes.Coins) (cosmossdktypes.AccAddress, []byte, error) + + // Instantiate2Func mocks the Instantiate2 method. + Instantiate2Func func(ctx cosmossdktypes.Context, codeID uint64, creator cosmossdktypes.AccAddress, admin cosmossdktypes.AccAddress, initMsg []byte, label string, deposit cosmossdktypes.Coins, salt []byte, fixMsg bool) (cosmossdktypes.AccAddress, []byte, error) + + // MigrateFunc mocks the Migrate method. + MigrateFunc func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, newCodeID uint64, msg []byte) ([]byte, error) + + // PinCodeFunc mocks the PinCode method. + PinCodeFunc func(ctx cosmossdktypes.Context, codeID uint64) error + + // SetAccessConfigFunc mocks the SetAccessConfig method. + SetAccessConfigFunc func(ctx cosmossdktypes.Context, codeID uint64, caller cosmossdktypes.AccAddress, newConfig wasmtypes.AccessConfig) error + + // SetContractInfoExtensionFunc mocks the SetContractInfoExtension method. + SetContractInfoExtensionFunc func(ctx cosmossdktypes.Context, contract cosmossdktypes.AccAddress, extra wasmtypes.ContractInfoExtension) error + + // SudoFunc mocks the Sudo method. + SudoFunc func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, msg []byte) ([]byte, error) + + // UnpinCodeFunc mocks the UnpinCode method. + UnpinCodeFunc func(ctx cosmossdktypes.Context, codeID uint64) error + + // UpdateContractAdminFunc mocks the UpdateContractAdmin method. + UpdateContractAdminFunc func(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, newAdmin cosmossdktypes.AccAddress) error + + // calls tracks calls to the methods. + calls struct { + // ClearContractAdmin holds details about calls to the ClearContractAdmin method. + ClearContractAdmin []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // ContractAddress is the contractAddress argument value. + ContractAddress cosmossdktypes.AccAddress + // Caller is the caller argument value. + Caller cosmossdktypes.AccAddress + } + // Create holds details about calls to the Create method. + Create []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // Creator is the creator argument value. + Creator cosmossdktypes.AccAddress + // WasmCode is the wasmCode argument value. + WasmCode []byte + // InstantiateAccess is the instantiateAccess argument value. + InstantiateAccess *wasmtypes.AccessConfig + } + // Execute holds details about calls to the Execute method. + Execute []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // ContractAddress is the contractAddress argument value. + ContractAddress cosmossdktypes.AccAddress + // Caller is the caller argument value. + Caller cosmossdktypes.AccAddress + // Msg is the msg argument value. + Msg []byte + // Coins is the coins argument value. + Coins cosmossdktypes.Coins + } + // Instantiate holds details about calls to the Instantiate method. + Instantiate []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // CodeID is the codeID argument value. + CodeID uint64 + // Creator is the creator argument value. + Creator cosmossdktypes.AccAddress + // Admin is the admin argument value. + Admin cosmossdktypes.AccAddress + // InitMsg is the initMsg argument value. + InitMsg []byte + // Label is the label argument value. + Label string + // Deposit is the deposit argument value. + Deposit cosmossdktypes.Coins + } + // Instantiate2 holds details about calls to the Instantiate2 method. + Instantiate2 []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // CodeID is the codeID argument value. + CodeID uint64 + // Creator is the creator argument value. + Creator cosmossdktypes.AccAddress + // Admin is the admin argument value. + Admin cosmossdktypes.AccAddress + // InitMsg is the initMsg argument value. + InitMsg []byte + // Label is the label argument value. + Label string + // Deposit is the deposit argument value. + Deposit cosmossdktypes.Coins + // Salt is the salt argument value. + Salt []byte + // FixMsg is the fixMsg argument value. + FixMsg bool + } + // Migrate holds details about calls to the Migrate method. + Migrate []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // ContractAddress is the contractAddress argument value. + ContractAddress cosmossdktypes.AccAddress + // Caller is the caller argument value. + Caller cosmossdktypes.AccAddress + // NewCodeID is the newCodeID argument value. + NewCodeID uint64 + // Msg is the msg argument value. + Msg []byte + } + // PinCode holds details about calls to the PinCode method. + PinCode []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // CodeID is the codeID argument value. + CodeID uint64 + } + // SetAccessConfig holds details about calls to the SetAccessConfig method. + SetAccessConfig []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // CodeID is the codeID argument value. + CodeID uint64 + // Caller is the caller argument value. + Caller cosmossdktypes.AccAddress + // NewConfig is the newConfig argument value. + NewConfig wasmtypes.AccessConfig + } + // SetContractInfoExtension holds details about calls to the SetContractInfoExtension method. + SetContractInfoExtension []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // Contract is the contract argument value. + Contract cosmossdktypes.AccAddress + // Extra is the extra argument value. + Extra wasmtypes.ContractInfoExtension + } + // Sudo holds details about calls to the Sudo method. + Sudo []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // ContractAddress is the contractAddress argument value. + ContractAddress cosmossdktypes.AccAddress + // Msg is the msg argument value. + Msg []byte + } + // UnpinCode holds details about calls to the UnpinCode method. + UnpinCode []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // CodeID is the codeID argument value. + CodeID uint64 + } + // UpdateContractAdmin holds details about calls to the UpdateContractAdmin method. + UpdateContractAdmin []struct { + // Ctx is the ctx argument value. + Ctx cosmossdktypes.Context + // ContractAddress is the contractAddress argument value. + ContractAddress cosmossdktypes.AccAddress + // Caller is the caller argument value. + Caller cosmossdktypes.AccAddress + // NewAdmin is the newAdmin argument value. + NewAdmin cosmossdktypes.AccAddress + } + } + lockClearContractAdmin sync.RWMutex + lockCreate sync.RWMutex + lockExecute sync.RWMutex + lockInstantiate sync.RWMutex + lockInstantiate2 sync.RWMutex + lockMigrate sync.RWMutex + lockPinCode sync.RWMutex + lockSetAccessConfig sync.RWMutex + lockSetContractInfoExtension sync.RWMutex + lockSudo sync.RWMutex + lockUnpinCode sync.RWMutex + lockUpdateContractAdmin sync.RWMutex +} + +// ClearContractAdmin calls ClearContractAdminFunc. +func (mock *WasmKeeperMock) ClearContractAdmin(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress) error { + if mock.ClearContractAdminFunc == nil { + panic("WasmKeeperMock.ClearContractAdminFunc: method is nil but WasmKeeper.ClearContractAdmin was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + }{ + Ctx: ctx, + ContractAddress: contractAddress, + Caller: caller, + } + mock.lockClearContractAdmin.Lock() + mock.calls.ClearContractAdmin = append(mock.calls.ClearContractAdmin, callInfo) + mock.lockClearContractAdmin.Unlock() + return mock.ClearContractAdminFunc(ctx, contractAddress, caller) +} + +// ClearContractAdminCalls gets all the calls that were made to ClearContractAdmin. +// Check the length with: +// +// len(mockedWasmKeeper.ClearContractAdminCalls()) +func (mock *WasmKeeperMock) ClearContractAdminCalls() []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress +} { + var calls []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + } + mock.lockClearContractAdmin.RLock() + calls = mock.calls.ClearContractAdmin + mock.lockClearContractAdmin.RUnlock() + return calls +} + +// Create calls CreateFunc. +func (mock *WasmKeeperMock) Create(ctx cosmossdktypes.Context, creator cosmossdktypes.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (uint64, []byte, error) { + if mock.CreateFunc == nil { + panic("WasmKeeperMock.CreateFunc: method is nil but WasmKeeper.Create was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + Creator cosmossdktypes.AccAddress + WasmCode []byte + InstantiateAccess *wasmtypes.AccessConfig + }{ + Ctx: ctx, + Creator: creator, + WasmCode: wasmCode, + InstantiateAccess: instantiateAccess, + } + mock.lockCreate.Lock() + mock.calls.Create = append(mock.calls.Create, callInfo) + mock.lockCreate.Unlock() + return mock.CreateFunc(ctx, creator, wasmCode, instantiateAccess) +} + +// CreateCalls gets all the calls that were made to Create. +// Check the length with: +// +// len(mockedWasmKeeper.CreateCalls()) +func (mock *WasmKeeperMock) CreateCalls() []struct { + Ctx cosmossdktypes.Context + Creator cosmossdktypes.AccAddress + WasmCode []byte + InstantiateAccess *wasmtypes.AccessConfig +} { + var calls []struct { + Ctx cosmossdktypes.Context + Creator cosmossdktypes.AccAddress + WasmCode []byte + InstantiateAccess *wasmtypes.AccessConfig + } + mock.lockCreate.RLock() + calls = mock.calls.Create + mock.lockCreate.RUnlock() + return calls +} + +// Execute calls ExecuteFunc. +func (mock *WasmKeeperMock) Execute(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, msg []byte, coins cosmossdktypes.Coins) ([]byte, error) { + if mock.ExecuteFunc == nil { + panic("WasmKeeperMock.ExecuteFunc: method is nil but WasmKeeper.Execute was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + Msg []byte + Coins cosmossdktypes.Coins + }{ + Ctx: ctx, + ContractAddress: contractAddress, + Caller: caller, + Msg: msg, + Coins: coins, + } + mock.lockExecute.Lock() + mock.calls.Execute = append(mock.calls.Execute, callInfo) + mock.lockExecute.Unlock() + return mock.ExecuteFunc(ctx, contractAddress, caller, msg, coins) +} + +// ExecuteCalls gets all the calls that were made to Execute. +// Check the length with: +// +// len(mockedWasmKeeper.ExecuteCalls()) +func (mock *WasmKeeperMock) ExecuteCalls() []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + Msg []byte + Coins cosmossdktypes.Coins +} { + var calls []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + Msg []byte + Coins cosmossdktypes.Coins + } + mock.lockExecute.RLock() + calls = mock.calls.Execute + mock.lockExecute.RUnlock() + return calls +} + +// Instantiate calls InstantiateFunc. +func (mock *WasmKeeperMock) Instantiate(ctx cosmossdktypes.Context, codeID uint64, creator cosmossdktypes.AccAddress, admin cosmossdktypes.AccAddress, initMsg []byte, label string, deposit cosmossdktypes.Coins) (cosmossdktypes.AccAddress, []byte, error) { + if mock.InstantiateFunc == nil { + panic("WasmKeeperMock.InstantiateFunc: method is nil but WasmKeeper.Instantiate was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Creator cosmossdktypes.AccAddress + Admin cosmossdktypes.AccAddress + InitMsg []byte + Label string + Deposit cosmossdktypes.Coins + }{ + Ctx: ctx, + CodeID: codeID, + Creator: creator, + Admin: admin, + InitMsg: initMsg, + Label: label, + Deposit: deposit, + } + mock.lockInstantiate.Lock() + mock.calls.Instantiate = append(mock.calls.Instantiate, callInfo) + mock.lockInstantiate.Unlock() + return mock.InstantiateFunc(ctx, codeID, creator, admin, initMsg, label, deposit) +} + +// InstantiateCalls gets all the calls that were made to Instantiate. +// Check the length with: +// +// len(mockedWasmKeeper.InstantiateCalls()) +func (mock *WasmKeeperMock) InstantiateCalls() []struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Creator cosmossdktypes.AccAddress + Admin cosmossdktypes.AccAddress + InitMsg []byte + Label string + Deposit cosmossdktypes.Coins +} { + var calls []struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Creator cosmossdktypes.AccAddress + Admin cosmossdktypes.AccAddress + InitMsg []byte + Label string + Deposit cosmossdktypes.Coins + } + mock.lockInstantiate.RLock() + calls = mock.calls.Instantiate + mock.lockInstantiate.RUnlock() + return calls +} + +// Instantiate2 calls Instantiate2Func. +func (mock *WasmKeeperMock) Instantiate2(ctx cosmossdktypes.Context, codeID uint64, creator cosmossdktypes.AccAddress, admin cosmossdktypes.AccAddress, initMsg []byte, label string, deposit cosmossdktypes.Coins, salt []byte, fixMsg bool) (cosmossdktypes.AccAddress, []byte, error) { + if mock.Instantiate2Func == nil { + panic("WasmKeeperMock.Instantiate2Func: method is nil but WasmKeeper.Instantiate2 was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Creator cosmossdktypes.AccAddress + Admin cosmossdktypes.AccAddress + InitMsg []byte + Label string + Deposit cosmossdktypes.Coins + Salt []byte + FixMsg bool + }{ + Ctx: ctx, + CodeID: codeID, + Creator: creator, + Admin: admin, + InitMsg: initMsg, + Label: label, + Deposit: deposit, + Salt: salt, + FixMsg: fixMsg, + } + mock.lockInstantiate2.Lock() + mock.calls.Instantiate2 = append(mock.calls.Instantiate2, callInfo) + mock.lockInstantiate2.Unlock() + return mock.Instantiate2Func(ctx, codeID, creator, admin, initMsg, label, deposit, salt, fixMsg) +} + +// Instantiate2Calls gets all the calls that were made to Instantiate2. +// Check the length with: +// +// len(mockedWasmKeeper.Instantiate2Calls()) +func (mock *WasmKeeperMock) Instantiate2Calls() []struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Creator cosmossdktypes.AccAddress + Admin cosmossdktypes.AccAddress + InitMsg []byte + Label string + Deposit cosmossdktypes.Coins + Salt []byte + FixMsg bool +} { + var calls []struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Creator cosmossdktypes.AccAddress + Admin cosmossdktypes.AccAddress + InitMsg []byte + Label string + Deposit cosmossdktypes.Coins + Salt []byte + FixMsg bool + } + mock.lockInstantiate2.RLock() + calls = mock.calls.Instantiate2 + mock.lockInstantiate2.RUnlock() + return calls +} + +// Migrate calls MigrateFunc. +func (mock *WasmKeeperMock) Migrate(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, newCodeID uint64, msg []byte) ([]byte, error) { + if mock.MigrateFunc == nil { + panic("WasmKeeperMock.MigrateFunc: method is nil but WasmKeeper.Migrate was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + NewCodeID uint64 + Msg []byte + }{ + Ctx: ctx, + ContractAddress: contractAddress, + Caller: caller, + NewCodeID: newCodeID, + Msg: msg, + } + mock.lockMigrate.Lock() + mock.calls.Migrate = append(mock.calls.Migrate, callInfo) + mock.lockMigrate.Unlock() + return mock.MigrateFunc(ctx, contractAddress, caller, newCodeID, msg) +} + +// MigrateCalls gets all the calls that were made to Migrate. +// Check the length with: +// +// len(mockedWasmKeeper.MigrateCalls()) +func (mock *WasmKeeperMock) MigrateCalls() []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + NewCodeID uint64 + Msg []byte +} { + var calls []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + NewCodeID uint64 + Msg []byte + } + mock.lockMigrate.RLock() + calls = mock.calls.Migrate + mock.lockMigrate.RUnlock() + return calls +} + +// PinCode calls PinCodeFunc. +func (mock *WasmKeeperMock) PinCode(ctx cosmossdktypes.Context, codeID uint64) error { + if mock.PinCodeFunc == nil { + panic("WasmKeeperMock.PinCodeFunc: method is nil but WasmKeeper.PinCode was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + CodeID uint64 + }{ + Ctx: ctx, + CodeID: codeID, + } + mock.lockPinCode.Lock() + mock.calls.PinCode = append(mock.calls.PinCode, callInfo) + mock.lockPinCode.Unlock() + return mock.PinCodeFunc(ctx, codeID) +} + +// PinCodeCalls gets all the calls that were made to PinCode. +// Check the length with: +// +// len(mockedWasmKeeper.PinCodeCalls()) +func (mock *WasmKeeperMock) PinCodeCalls() []struct { + Ctx cosmossdktypes.Context + CodeID uint64 +} { + var calls []struct { + Ctx cosmossdktypes.Context + CodeID uint64 + } + mock.lockPinCode.RLock() + calls = mock.calls.PinCode + mock.lockPinCode.RUnlock() + return calls +} + +// SetAccessConfig calls SetAccessConfigFunc. +func (mock *WasmKeeperMock) SetAccessConfig(ctx cosmossdktypes.Context, codeID uint64, caller cosmossdktypes.AccAddress, newConfig wasmtypes.AccessConfig) error { + if mock.SetAccessConfigFunc == nil { + panic("WasmKeeperMock.SetAccessConfigFunc: method is nil but WasmKeeper.SetAccessConfig was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Caller cosmossdktypes.AccAddress + NewConfig wasmtypes.AccessConfig + }{ + Ctx: ctx, + CodeID: codeID, + Caller: caller, + NewConfig: newConfig, + } + mock.lockSetAccessConfig.Lock() + mock.calls.SetAccessConfig = append(mock.calls.SetAccessConfig, callInfo) + mock.lockSetAccessConfig.Unlock() + return mock.SetAccessConfigFunc(ctx, codeID, caller, newConfig) +} + +// SetAccessConfigCalls gets all the calls that were made to SetAccessConfig. +// Check the length with: +// +// len(mockedWasmKeeper.SetAccessConfigCalls()) +func (mock *WasmKeeperMock) SetAccessConfigCalls() []struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Caller cosmossdktypes.AccAddress + NewConfig wasmtypes.AccessConfig +} { + var calls []struct { + Ctx cosmossdktypes.Context + CodeID uint64 + Caller cosmossdktypes.AccAddress + NewConfig wasmtypes.AccessConfig + } + mock.lockSetAccessConfig.RLock() + calls = mock.calls.SetAccessConfig + mock.lockSetAccessConfig.RUnlock() + return calls +} + +// SetContractInfoExtension calls SetContractInfoExtensionFunc. +func (mock *WasmKeeperMock) SetContractInfoExtension(ctx cosmossdktypes.Context, contract cosmossdktypes.AccAddress, extra wasmtypes.ContractInfoExtension) error { + if mock.SetContractInfoExtensionFunc == nil { + panic("WasmKeeperMock.SetContractInfoExtensionFunc: method is nil but WasmKeeper.SetContractInfoExtension was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + Contract cosmossdktypes.AccAddress + Extra wasmtypes.ContractInfoExtension + }{ + Ctx: ctx, + Contract: contract, + Extra: extra, + } + mock.lockSetContractInfoExtension.Lock() + mock.calls.SetContractInfoExtension = append(mock.calls.SetContractInfoExtension, callInfo) + mock.lockSetContractInfoExtension.Unlock() + return mock.SetContractInfoExtensionFunc(ctx, contract, extra) +} + +// SetContractInfoExtensionCalls gets all the calls that were made to SetContractInfoExtension. +// Check the length with: +// +// len(mockedWasmKeeper.SetContractInfoExtensionCalls()) +func (mock *WasmKeeperMock) SetContractInfoExtensionCalls() []struct { + Ctx cosmossdktypes.Context + Contract cosmossdktypes.AccAddress + Extra wasmtypes.ContractInfoExtension +} { + var calls []struct { + Ctx cosmossdktypes.Context + Contract cosmossdktypes.AccAddress + Extra wasmtypes.ContractInfoExtension + } + mock.lockSetContractInfoExtension.RLock() + calls = mock.calls.SetContractInfoExtension + mock.lockSetContractInfoExtension.RUnlock() + return calls +} + +// Sudo calls SudoFunc. +func (mock *WasmKeeperMock) Sudo(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, msg []byte) ([]byte, error) { + if mock.SudoFunc == nil { + panic("WasmKeeperMock.SudoFunc: method is nil but WasmKeeper.Sudo was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Msg []byte + }{ + Ctx: ctx, + ContractAddress: contractAddress, + Msg: msg, + } + mock.lockSudo.Lock() + mock.calls.Sudo = append(mock.calls.Sudo, callInfo) + mock.lockSudo.Unlock() + return mock.SudoFunc(ctx, contractAddress, msg) +} + +// SudoCalls gets all the calls that were made to Sudo. +// Check the length with: +// +// len(mockedWasmKeeper.SudoCalls()) +func (mock *WasmKeeperMock) SudoCalls() []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Msg []byte +} { + var calls []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Msg []byte + } + mock.lockSudo.RLock() + calls = mock.calls.Sudo + mock.lockSudo.RUnlock() + return calls +} + +// UnpinCode calls UnpinCodeFunc. +func (mock *WasmKeeperMock) UnpinCode(ctx cosmossdktypes.Context, codeID uint64) error { + if mock.UnpinCodeFunc == nil { + panic("WasmKeeperMock.UnpinCodeFunc: method is nil but WasmKeeper.UnpinCode was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + CodeID uint64 + }{ + Ctx: ctx, + CodeID: codeID, + } + mock.lockUnpinCode.Lock() + mock.calls.UnpinCode = append(mock.calls.UnpinCode, callInfo) + mock.lockUnpinCode.Unlock() + return mock.UnpinCodeFunc(ctx, codeID) +} + +// UnpinCodeCalls gets all the calls that were made to UnpinCode. +// Check the length with: +// +// len(mockedWasmKeeper.UnpinCodeCalls()) +func (mock *WasmKeeperMock) UnpinCodeCalls() []struct { + Ctx cosmossdktypes.Context + CodeID uint64 +} { + var calls []struct { + Ctx cosmossdktypes.Context + CodeID uint64 + } + mock.lockUnpinCode.RLock() + calls = mock.calls.UnpinCode + mock.lockUnpinCode.RUnlock() + return calls +} + +// UpdateContractAdmin calls UpdateContractAdminFunc. +func (mock *WasmKeeperMock) UpdateContractAdmin(ctx cosmossdktypes.Context, contractAddress cosmossdktypes.AccAddress, caller cosmossdktypes.AccAddress, newAdmin cosmossdktypes.AccAddress) error { + if mock.UpdateContractAdminFunc == nil { + panic("WasmKeeperMock.UpdateContractAdminFunc: method is nil but WasmKeeper.UpdateContractAdmin was just called") + } + callInfo := struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + NewAdmin cosmossdktypes.AccAddress + }{ + Ctx: ctx, + ContractAddress: contractAddress, + Caller: caller, + NewAdmin: newAdmin, + } + mock.lockUpdateContractAdmin.Lock() + mock.calls.UpdateContractAdmin = append(mock.calls.UpdateContractAdmin, callInfo) + mock.lockUpdateContractAdmin.Unlock() + return mock.UpdateContractAdminFunc(ctx, contractAddress, caller, newAdmin) +} + +// UpdateContractAdminCalls gets all the calls that were made to UpdateContractAdmin. +// Check the length with: +// +// len(mockedWasmKeeper.UpdateContractAdminCalls()) +func (mock *WasmKeeperMock) UpdateContractAdminCalls() []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + NewAdmin cosmossdktypes.AccAddress +} { + var calls []struct { + Ctx cosmossdktypes.Context + ContractAddress cosmossdktypes.AccAddress + Caller cosmossdktypes.AccAddress + NewAdmin cosmossdktypes.AccAddress + } + mock.lockUpdateContractAdmin.RLock() + calls = mock.calls.UpdateContractAdmin + mock.lockUpdateContractAdmin.RUnlock() + return calls +} + +// Ensure, that AccountKeeperMock does implement nexustypes.AccountKeeper. +// If this is not the case, regenerate this file with moq. +var _ nexustypes.AccountKeeper = &AccountKeeperMock{} + +// AccountKeeperMock is a mock implementation of nexustypes.AccountKeeper. +// +// func TestSomethingThatUsesAccountKeeper(t *testing.T) { +// +// // make and configure a mocked nexustypes.AccountKeeper +// mockedAccountKeeper := &AccountKeeperMock{ +// GetModuleAddressFunc: func(moduleName string) cosmossdktypes.AccAddress { +// panic("mock out the GetModuleAddress method") +// }, +// } +// +// // use mockedAccountKeeper in code that requires nexustypes.AccountKeeper +// // and then make assertions. +// +// } +type AccountKeeperMock struct { + // GetModuleAddressFunc mocks the GetModuleAddress method. + GetModuleAddressFunc func(moduleName string) cosmossdktypes.AccAddress + + // calls tracks calls to the methods. + calls struct { + // GetModuleAddress holds details about calls to the GetModuleAddress method. + GetModuleAddress []struct { + // ModuleName is the moduleName argument value. + ModuleName string + } + } + lockGetModuleAddress sync.RWMutex +} + +// GetModuleAddress calls GetModuleAddressFunc. +func (mock *AccountKeeperMock) GetModuleAddress(moduleName string) cosmossdktypes.AccAddress { + if mock.GetModuleAddressFunc == nil { + panic("AccountKeeperMock.GetModuleAddressFunc: method is nil but AccountKeeper.GetModuleAddress was just called") + } + callInfo := struct { + ModuleName string + }{ + ModuleName: moduleName, + } + mock.lockGetModuleAddress.Lock() + mock.calls.GetModuleAddress = append(mock.calls.GetModuleAddress, callInfo) + mock.lockGetModuleAddress.Unlock() + return mock.GetModuleAddressFunc(moduleName) +} + +// GetModuleAddressCalls gets all the calls that were made to GetModuleAddress. +// Check the length with: +// +// len(mockedAccountKeeper.GetModuleAddressCalls()) +func (mock *AccountKeeperMock) GetModuleAddressCalls() []struct { + ModuleName string +} { + var calls []struct { + ModuleName string + } + mock.lockGetModuleAddress.RLock() + calls = mock.calls.GetModuleAddress + mock.lockGetModuleAddress.RUnlock() + return calls +}