Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(templates): add fee abstraction into the scaffold chain template #4181

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6a94e55
add comment
trungnt1811 Jun 7, 2024
2a40073
Merge branch 'main' into add-feeabs
trungnt1811 Jun 16, 2024
cca2cb5
chore: remove comment
trungnt1811 Jun 16, 2024
86c250f
refactor: add feeabs template
trungnt1811 Jun 16, 2024
1dd0033
Merge remote-tracking branch 'origin/main' into add-feeabs
trungnt1811 Jun 26, 2024
f3970e3
fix: kv store with key <nil> has not been registered in stores
trungnt1811 Jun 26, 2024
38ebd2c
bet
trungnt1811 Jun 26, 2024
46d7511
fix: exclude feeabs proto files
trungnt1811 Jun 27, 2024
b8264a8
Merge branch 'main' into add-feeabs
trungnt1811 Jun 27, 2024
babd00f
Merge branch 'main' into add-feeabs
trungnt1811 Jun 27, 2024
6cd2aa5
chore: add fee-abstraction v8 to go.mod
trungnt1811 Jun 27, 2024
34d0145
Merge remote-tracking branch 'origin/main' into add-feeabs
trungnt1811 Jun 28, 2024
6186911
Merge branch 'main' into add-feeabs
trungnt1811 Jul 1, 2024
242a546
Merge branch 'main' into add-feeabs
trungnt1811 Jul 9, 2024
90ab87e
add fee-abstraction flag
trungnt1811 Jul 12, 2024
63417de
add files-feeabs template
trungnt1811 Jul 12, 2024
1900f34
revert feeabs module in default flag
trungnt1811 Jul 12, 2024
a6ade96
chore: remove space
trungnt1811 Jul 12, 2024
982a6bc
Merge branch 'main' into add-feeabs
trungnt1811 Jul 12, 2024
052d4b0
chore: remove redundant template
trungnt1811 Jul 12, 2024
ea7b870
chore: remove comsumer template
trungnt1811 Jul 12, 2024
c089a62
chore: using condition in the go.mod template
trungnt1811 Jul 16, 2024
6b4e71d
Merge branch 'main' into add-feeabs
trungnt1811 Jul 16, 2024
87915fd
Merge branch 'ignite:main' into add-feeabs
trungnt1811 Jul 17, 2024
9f10512
Merge branch 'ignite:main' into add-feeabs
trungnt1811 Jul 18, 2024
e7615d9
hore: wire client/v2
trungnt1811 Jul 18, 2024
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
8 changes: 6 additions & 2 deletions ignite/cmd/scaffold_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
flagNoDefaultModule = "no-module"
flagSkipGit = "skip-git"
flagIsConsumer = "consumer"
flagFeeabsModule = "fee-abstraction"

tplScaffoldChainSuccess = `
⭐️ Successfully created a new blockchain '%[1]v'.
Expand Down Expand Up @@ -90,9 +91,10 @@ about Cosmos SDK on https://docs.cosmos.network
c.Flags().Bool(flagMinimal, false, "create a minimal blockchain (with the minimum required Cosmos SDK modules)")
c.Flags().Bool(flagIsConsumer, false, "scafffold an ICS consumer chain")
c.Flags().String(flagProtoDir, defaults.ProtoDir, "chain proto directory")
c.Flags().Bool(flagFeeabsModule, false, "create a project that includes the fee abstraction module")

// Cannot have both minimal and consumer flag
c.MarkFlagsMutuallyExclusive(flagIsConsumer, flagMinimal)
// Cannot have minimal, consumer, and fee-abstraction flags at the same time
c.MarkFlagsMutuallyExclusive(flagIsConsumer, flagMinimal, flagFeeabsModule)

return c
}
Expand All @@ -114,6 +116,7 @@ func scaffoldChainHandler(cmd *cobra.Command, args []string) error {
moduleConfigs, _ = cmd.Flags().GetStringSlice(flagModuleConfigs)
skipProto, _ = cmd.Flags().GetBool(flagSkipProto)
protoDir, _ = cmd.Flags().GetString(flagProtoDir)
feeabsModule, _ = cmd.Flags().GetBool(flagFeeabsModule)
)

if noDefaultModule {
Expand All @@ -138,6 +141,7 @@ func scaffoldChainHandler(cmd *cobra.Command, args []string) error {
addressPrefix,
protoDir,
noDefaultModule,
feeabsModule,
minimal,
isConsumer,
params,
Expand Down
1 change: 1 addition & 0 deletions ignite/pkg/cosmosgen/generate_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func (g *generator) generateOpenAPISpec(ctx context.Context) error {
"*/cosmos/app/v1alpha1/*",
"*/cosmos/tx/config/v1/config.proto",
"*/cosmos/msg/textual/v1/textual.proto",
"*/osmosis-labs/fee-abstraction/*",
),
cosmosbuf.FileByFile(),
); err != nil {
Expand Down
24 changes: 13 additions & 11 deletions ignite/services/scaffolder/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Init(
ctx context.Context,
runner *xgenny.Runner,
root, name, addressPrefix, protoDir string,
noDefaultModule, minimal, isConsumerChain bool,
noDefaultModule, feeabsModule, minimal, isConsumerChain bool,
params, moduleConfigs []string,
) (string, string, error) {
pathInfo, err := gomodulepath.Parse(name)
Expand Down Expand Up @@ -51,6 +51,7 @@ func Init(
protoDir,
path,
noDefaultModule,
feeabsModule,
minimal,
isConsumerChain,
params,
Expand All @@ -67,7 +68,7 @@ func generate(
addressPrefix,
protoDir,
absRoot string,
noDefaultModule, minimal, isConsumerChain bool,
noDefaultModule, feeabsModule, minimal, isConsumerChain bool,
params, moduleConfigs []string,
) (xgenny.SourceModification, error) {
// Parse params with the associated type
Expand All @@ -90,15 +91,16 @@ func generate(

g, err := app.NewGenerator(&app.Options{
// generate application template
ModulePath: pathInfo.RawPath,
AppName: pathInfo.Package,
AppPath: absRoot,
ProtoDir: protoDir,
GitHubPath: githubPath,
BinaryNamePrefix: pathInfo.Root,
AddressPrefix: addressPrefix,
IsChainMinimal: minimal,
IsConsumerChain: isConsumerChain,
ModulePath: pathInfo.RawPath,
AppName: pathInfo.Package,
AppPath: absRoot,
ProtoDir: protoDir,
GitHubPath: githubPath,
BinaryNamePrefix: pathInfo.Root,
AddressPrefix: addressPrefix,
IsChainMinimal: minimal,
IsConsumerChain: isConsumerChain,
IncludeFeeabsModule: feeabsModule,
})
if err != nil {
return xgenny.SourceModification{}, err
Expand Down
6 changes: 6 additions & 0 deletions ignite/templates/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ var (

//go:embed files-consumer/* files-consumer/**/*
filesConsumer embed.FS

//go:embed files-feeabs/* files-feeabs/**/*
filesFeeabs embed.FS
)

const (
Expand Down Expand Up @@ -49,6 +52,9 @@ func NewGenerator(opts *Options) (*genny.Generator, error) {
if opts.IsConsumerChain {
overridesFS["files-consumer"] = filesConsumer
}
if opts.IncludeFeeabsModule {
overridesFS["files-feeabs"] = filesFeeabs
}

g := genny.New()
if err := g.SelectiveFS(subfs, includePrefix, nil, excludePrefix, nil); err != nil {
Expand Down
Loading
Loading