Skip to content

Commit

Permalink
feat: support app wiring and autocli (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey authored Oct 7, 2024
1 parent 1a5bdeb commit e7200be
Show file tree
Hide file tree
Showing 11 changed files with 373 additions and 949 deletions.
111 changes: 93 additions & 18 deletions api/module/v1/module.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.22.7
require (
cosmossdk.io/api v0.7.5
cosmossdk.io/core v0.11.1
cosmossdk.io/depinject v1.0.0
cosmossdk.io/errors v1.0.1
cosmossdk.io/math v1.3.0
cosmossdk.io/store v1.1.1
Expand All @@ -16,7 +17,6 @@ require (
github.com/golang/protobuf v1.5.4
github.com/golangci/golangci-lint v1.61.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.9.0
google.golang.org/genproto/googleapis/api v0.0.0-20240725223205-93522f1f2a9f
google.golang.org/grpc v1.66.0
Expand All @@ -28,7 +28,6 @@ require (
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
4d63.com/gochecknoglobals v0.2.1 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/depinject v1.0.0 // indirect
cosmossdk.io/log v1.4.1 // indirect
cosmossdk.io/x/tx v0.13.5 // indirect
cosmossdk.io/x/upgrade v0.1.4 // indirect
Expand Down Expand Up @@ -246,6 +245,7 @@ require (
github.com/sourcegraph/go-diff v0.7.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
Expand Down
3 changes: 3 additions & 0 deletions proto/aura/module/v1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ import "cosmos/app/v1alpha1/module.proto";
// Module is the config object of the Aura module.
message Module {
option (cosmos.app.v1alpha1.module) = {go_import: "github.com/ondoprotocol/usdy-noble/v2/x/aura"};

// denom is the denom this module is allowed to govern, burn, mint, etc.
string denom = 1;
}
21 changes: 3 additions & 18 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
_ "github.com/cosmos/cosmos-sdk/x/consensus"
_ "github.com/cosmos/cosmos-sdk/x/params"
_ "github.com/cosmos/cosmos-sdk/x/staking"
_ "github.com/ondoprotocol/usdy-noble/v2/x/aura"

// Cosmos Modules
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
Expand All @@ -42,9 +43,7 @@ import (
transferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
// Custom Modules
"github.com/ondoprotocol/usdy-noble/v2/x/aura"
aurakeeper "github.com/ondoprotocol/usdy-noble/v2/x/aura/keeper"
auratypes "github.com/ondoprotocol/usdy-noble/v2/x/aura/types"
)

var DefaultNodeHome string
Expand Down Expand Up @@ -138,28 +137,14 @@ func NewSimApp(
&app.ParamsKeeper,
&app.StakingKeeper,
&app.UpgradeKeeper,
// Custom Modules
&app.AuraKeeper,
); err != nil {
return nil, err
}

app.App = appBuilder.Build(db, traceStore, baseAppOptions...)

if err := app.RegisterStores(storetypes.NewKVStoreKey(auratypes.ModuleName)); err != nil {
return nil, err
}
app.AuraKeeper = aurakeeper.NewKeeper(
"ausdy",
runtime.NewKVStoreService(app.GetKey(auratypes.ModuleName)),
runtime.ProvideEventService(),
app.AccountKeeper.AddressCodec(),
nil,
)
app.BankKeeper.AppendSendRestriction(app.AuraKeeper.SendRestrictionFn)
app.AuraKeeper.SetBankKeeper(app.BankKeeper)
if err := app.RegisterModules(aura.NewAppModule(app.AccountKeeper.AddressCodec(), app.AuraKeeper)); err != nil {
return nil, err
}

if err := app.RegisterLegacyModules(); err != nil {
return nil, err
}
Expand Down
5 changes: 5 additions & 0 deletions simapp/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,8 @@ modules:
- name: upgrade
config:
"@type": cosmos.upgrade.module.v1.Module

- name: aura
config:
"@type": aura.module.v1.Module
denom: ausdy
3 changes: 0 additions & 3 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import (
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
tendermint "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
"github.com/ondoprotocol/usdy-noble/v2/simapp"
"github.com/ondoprotocol/usdy-noble/v2/x/aura"
auratypes "github.com/ondoprotocol/usdy-noble/v2/x/aura/types"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -111,7 +109,6 @@ func NewRootCmd() *cobra.Command {
ibcexported.ModuleName: ibc.AppModule{},
transfertypes.ModuleName: transfer.AppModule{},
tendermint.ModuleName: tendermint.AppModule{},
auratypes.ModuleName: aura.NewAppModule(autoCliOpts.AddressCodec, nil),
}
for name, mod := range modules {
moduleBasicManager[name] = module.CoreAppModuleBasicAdaptor(name, mod)
Expand Down
Loading

0 comments on commit e7200be

Please sign in to comment.