Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
- [#4384](https://github.com/ignite/cli/pull/4384) Compare genesis params into chain genesis tests
- [#4463](https://github.com/ignite/cli/pull/4463) Run `chain simulation` with any simulation test case
- [#4533](https://github.com/ignite/cli/pull/4533) Promote GitHub codespace instead of Gitpod
- [#4549](https://github.com/ignite/cli/pull/4549) Remove unused placeholder vars

### Fixes

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cli

import (
"strconv"
<%= for (goImport) in mergeGoImports(fields) { %>
<%= goImport.Alias %> "<%= goImport.Name %>"<% } %>
"github.com/spf13/cobra"
Expand All @@ -15,8 +14,6 @@ import (
"<%= ModulePath %>/x/<%= moduleName %>/types"
)

var _ = strconv.Itoa(0)

// CmdSend<%= packetName.UpperCamel %>() returns the <%= packetName.UpperCamel %> send packet command.
// This command does not use AutoCLI because it gives a better UX to do not.
func CmdSend<%= packetName.UpperCamel %>() *cobra.Command {
Expand Down
1 change: 1 addition & 0 deletions ignite/templates/message/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ func moduleSimulationModify(opts *Options) genny.RunFn {

content, err := typed.ModuleSimulationMsgModify(
f.String(),
opts.ModulePath,
opts.ModuleName,
opts.MsgName,
opts.MsgSigner,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
package <%= moduleName %>

import (
"math/rand"

"cosmossdk.io/core/address"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"

"<%= modulePath %>/testutil/sample"
<%= moduleName %>simulation "<%= modulePath %>/x/<%= moduleName %>/simulation"
"<%= modulePath %>/x/<%= moduleName %>/types"
)

// avoid unused import issue
var (
_ = rand.Rand{}
_ = sample.AccAddress
_ = sdk.AccAddress{}
_ = simulation.MsgEntryKind
_ = <%= moduleName %>simulation.PlaceHolder
)

// GenerateGenesisState creates a randomized GenState of the module.
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
accs := make([]string, len(simState.Accounts))
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions ignite/templates/typed/list/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func moduleSimulationModify(opts *typed.Options) genny.RunFn {

content, err = typed.ModuleSimulationMsgModify(
content,
opts.ModulePath,
opts.ModuleName,
opts.TypeName,
opts.MsgSigner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package simulation

import (
"math/rand"
"strconv"

"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -14,9 +13,6 @@ import (
"<%= ModulePath %>/x/<%= ModuleName %>/types"
)

// Prevent strconv unused error
var _ = strconv.IntSize

func SimulateMsgCreate<%= TypeName.UpperCamel %>(
ak types.AuthKeeper,
bk types.BankKeeper,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package keeper_test

import (
"strconv"
"testing"

"github.com/cosmos/cosmos-sdk/types/query"
Expand All @@ -14,14 +13,10 @@ import (
"<%= ModulePath %>/x/<%= ModuleName %>/keeper"
)

// Prevent strconv unused error
var _ = strconv.IntSize

func createN<%= TypeName.UpperCamel %>(keeper keeper.Keeper, ctx context.Context, n int) []types.<%= TypeName.UpperCamel %> {
items := make([]types.<%= TypeName.UpperCamel %>, n)
for i := range items {
items[i].<%= Index.Name.UpperCamel %> = <%= Index.ValueLoop() %>

_ = keeper.<%= TypeName.UpperCamel %>.Set(ctx, items[i].<%= Index.Name.UpperCamel %>, items[i])
}
return items
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package keeper_test

import (
"strconv"
"testing"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand All @@ -11,9 +10,6 @@ import (
"<%= ModulePath %>/x/<%= ModuleName %>/types"
)

// Prevent strconv unused error
var _ = strconv.IntSize

func Test<%= TypeName.UpperCamel %>MsgServerCreate(t *testing.T) {
f := initFixture(t)
srv := keeper.NewMsgServerImpl(f.keeper)
Expand Down
1 change: 1 addition & 0 deletions ignite/templates/typed/map/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func moduleSimulationModify(opts *typed.Options) genny.RunFn {

content, err = typed.ModuleSimulationMsgModify(
content,
opts.ModulePath,
opts.ModuleName,
opts.TypeName,
opts.MsgSigner,
Expand Down
17 changes: 15 additions & 2 deletions ignite/templates/typed/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
)

func ModuleSimulationMsgModify(
content string,
content,
modulePath,
moduleName string,
typeName, msgSigner multiformatname.Name,
msgs ...string,
Expand All @@ -18,7 +19,19 @@ func ModuleSimulationMsgModify(
msgs = append(msgs, "")
}

var err error
// Import
content, err := xast.AppendImports(
content,
xast.WithLastNamedImport(
fmt.Sprintf("%[1]vsimulation", moduleName),
fmt.Sprintf("%[1]v/x/%[2]v/simulation", modulePath, moduleName),
),
xast.WithImport("math/rand", 0),
)
if err != nil {
return "", err
}

for _, msg := range msgs {
// simulation operations
replacementOp := fmt.Sprintf(`
Expand Down
1 change: 1 addition & 0 deletions ignite/templates/typed/singleton/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func moduleSimulationModify(opts *typed.Options) genny.RunFn {

content, err := typed.ModuleSimulationMsgModify(
f.String(),
opts.ModulePath,
opts.ModuleName,
opts.TypeName,
opts.MsgSigner,
Expand Down
Loading