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 @@ -10,6 +10,7 @@

- [#4880](https://github.com/ignite/cli/pull/4880) Add possibility to scaffold underscore package.
- [#4878](https://github.com/ignite/cli/pull/4878) Improve the `xast` package readability.
- [#4883](https://github.com/ignite/cli/pull/4883) Remove ibc keys placeholders.

## [`v29.8.0`](https://github.com/ignite/cli/releases/tag/v29.8.0)

Expand Down
2 changes: 1 addition & 1 deletion ignite/services/scaffolder/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (s Scaffolder) CreateModule(

// Scaffold IBC module
if opts.IsIBC {
g, err = modulecreate.NewIBC(s.Tracer(), opts)
g, err = modulecreate.NewIBC(opts)
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ const (
// It should be synced with the gov module's name if it is ever changed.
// See: https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.2/x/gov/types/keys.go#L9
GovModuleName = "gov"
<%= if (isIBC) { %>
// Version defines the current version the IBC module supports
Version = "<%= moduleName %>-1"

<%= if (isIBC) { %>// this line is used by starport scaffolding # ibc/keys/name<% } %>
// PortID is the default port id that module binds to
PortID = "<%= moduleName %>"
<% } %>
)

<%= if (isIBC) { %>// this line is used by starport scaffolding # ibc/keys/port<% } %>
<%= if (isIBC) { %>
var (
// PortKey defines the key to store the port ID in store
PortKey = collections.NewPrefix("<%= moduleName %>-port-")
)
<% } %>

// ParamsKey is the prefix to retrieve all Params
var ParamsKey = collections.NewPrefix("p_<%= moduleName %>")
var ParamsKey = collections.NewPrefix("p_<%= moduleName %>")
34 changes: 1 addition & 33 deletions ignite/templates/module/create/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (

"github.com/ignite/cli/v29/ignite/pkg/errors"
"github.com/ignite/cli/v29/ignite/pkg/gomodulepath"
"github.com/ignite/cli/v29/ignite/pkg/placeholder"
"github.com/ignite/cli/v29/ignite/pkg/protoanalysis/protoutil"
"github.com/ignite/cli/v29/ignite/pkg/xast"
"github.com/ignite/cli/v29/ignite/pkg/xgenny"
Expand All @@ -25,7 +24,7 @@ import (
)

// NewIBC returns the generator to scaffold the implementation of the IBCModule interface inside a module.
func NewIBC(replacer placeholder.Replacer, opts *CreateOptions) (*genny.Generator, error) {
func NewIBC(opts *CreateOptions) (*genny.Generator, error) {
subFs, err := fs.Sub(fsIBC, "files/ibc")
if err != nil {
return nil, errors.Errorf("fail to generate sub: %w", err)
Expand All @@ -35,7 +34,6 @@ func NewIBC(replacer placeholder.Replacer, opts *CreateOptions) (*genny.Generato
g.RunFn(genesisModify(opts))
g.RunFn(genesisTypesModify(opts))
g.RunFn(genesisProtoModify(opts))
g.RunFn(keysModify(replacer, opts))

if err := g.OnlyFS(subFs, nil, nil); err != nil {
return g, errors.Errorf("generator fs: %w", err)
Expand Down Expand Up @@ -178,36 +176,6 @@ func genesisProtoModify(opts *CreateOptions) genny.RunFn {
}
}

func keysModify(replacer placeholder.Replacer, opts *CreateOptions) genny.RunFn {
return func(r *genny.Runner) error {
path := filepath.Join("x", opts.ModuleName, "types/keys.go")
f, err := r.Disk.Find(path)
if err != nil {
return err
}

// Append version and the port ID in keys
templateName := `// Version defines the current version the IBC module supports
Version = "%[1]v-1"

// PortID is the default port id that module binds to
PortID = "%[1]v"`
replacementName := fmt.Sprintf(templateName, opts.ModuleName)
content := replacer.Replace(f.String(), module.PlaceholderIBCKeysName, replacementName)

// PlaceholderIBCKeysPort
templatePort := `var (
// PortKey defines the key to store the port ID in store
PortKey = collections.NewPrefix("%[1]v-port-")
)`
replacementPort := fmt.Sprintf(templatePort, opts.ModuleName)
content = replacer.Replace(content, module.PlaceholderIBCKeysPort, replacementPort)

newFile := genny.NewFileS(path, content)
return r.File(newFile)
}
}

func appIBCModify(opts *CreateOptions) genny.RunFn {
return func(r *genny.Runner) error {
path := module.PathIBCConfigGo
Expand Down
7 changes: 0 additions & 7 deletions ignite/templates/module/placeholders.go

This file was deleted.