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 all 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 @@
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 @@
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")

Check warning on line 94 in ignite/cmd/scaffold_chain.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/scaffold_chain.go#L94

Added line #L94 was not covered by tests

// 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)

Check warning on line 97 in ignite/cmd/scaffold_chain.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/scaffold_chain.go#L97

Added line #L97 was not covered by tests

return c
}
Expand All @@ -114,6 +116,7 @@
moduleConfigs, _ = cmd.Flags().GetStringSlice(flagModuleConfigs)
skipProto, _ = cmd.Flags().GetBool(flagSkipProto)
protoDir, _ = cmd.Flags().GetString(flagProtoDir)
feeabsModule, _ = cmd.Flags().GetBool(flagFeeabsModule)

Check warning on line 119 in ignite/cmd/scaffold_chain.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/scaffold_chain.go#L119

Added line #L119 was not covered by tests
)

if noDefaultModule {
Expand All @@ -138,6 +141,7 @@
addressPrefix,
protoDir,
noDefaultModule,
feeabsModule,

Check warning on line 144 in ignite/cmd/scaffold_chain.go

View check run for this annotation

Codecov / codecov/patch

ignite/cmd/scaffold_chain.go#L144

Added line #L144 was not covered by tests
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 @@
"*/cosmos/app/v1alpha1/*",
"*/cosmos/tx/config/v1/config.proto",
"*/cosmos/msg/textual/v1/textual.proto",
"*/osmosis-labs/fee-abstraction/*",

Check warning on line 89 in ignite/pkg/cosmosgen/generate_openapi.go

View check run for this annotation

Codecov / codecov/patch

ignite/pkg/cosmosgen/generate_openapi.go#L89

Added line #L89 was not covered by tests
),
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 @@ -21,7 +21,7 @@
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 @@ -59,6 +59,7 @@
protoDir,
path,
noDefaultModule,
feeabsModule,

Check warning on line 62 in ignite/services/scaffolder/init.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/init.go#L62

Added line #L62 was not covered by tests
minimal,
isConsumerChain,
params,
Expand All @@ -75,7 +76,7 @@
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 @@ -98,15 +99,16 @@

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,

Check warning on line 111 in ignite/services/scaffolder/init.go

View check run for this annotation

Codecov / codecov/patch

ignite/services/scaffolder/init.go#L102-L111

Added lines #L102 - L111 were not covered by tests
})
if err != nil {
return xgenny.SourceModification{}, err
Expand Down
7 changes: 7 additions & 0 deletions ignite/templates/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

//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 @@
if opts.IsConsumerChain {
overridesFS["files-consumer"] = filesConsumer
}
if opts.IncludeFeeabsModule {
overridesFS["files-feeabs"] = filesFeeabs

Check warning on line 56 in ignite/templates/app/app.go

View check run for this annotation

Codecov / codecov/patch

ignite/templates/app/app.go#L55-L56

Added lines #L55 - L56 were not covered by tests
}

g := genny.New()
if err := g.SelectiveFS(subfs, includePrefix, nil, excludePrefix, nil); err != nil {
Expand Down Expand Up @@ -77,6 +83,7 @@
ctx.Set("IsConsumerChain", opts.IsConsumerChain)
ctx.Set("DepTools", cosmosgen.DepTools())
ctx.Set("IsChainMinimal", opts.IsChainMinimal)
ctx.Set("IncludeFeeabsModule", opts.IncludeFeeabsModule)

Check warning on line 86 in ignite/templates/app/app.go

View check run for this annotation

Codecov / codecov/patch

ignite/templates/app/app.go#L86

Added line #L86 was not covered by tests

plushhelpers.ExtendPlushContext(ctx)
g.Transformer(xgenny.Transformer(ctx))
Expand Down
Loading
Loading