Skip to content
Closed
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
20 changes: 9 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ import (
"go.opentelemetry.io/otel"
)

const (
AccountAddressPrefix = "cosmos"
Name = "sei-chain"
)

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals

func getGovProposalHandlers() []govclient.ProposalHandler {
Expand Down Expand Up @@ -191,7 +186,7 @@ func init() {
panic(err)
}

DefaultNodeHome = filepath.Join(userHomeDir, "."+Name)
DefaultNodeHome = filepath.Join(userHomeDir, "."+AppName)
}

// App extends an ABCI application, but with most of its parameters exported.
Expand Down Expand Up @@ -245,7 +240,8 @@ type App struct {
// sm is the simulation manager
sm *module.SimulationManager

tracingInfo *tracing.TracingInfo
configurator module.Configurator
tracingInfo *tracing.TracingInfo
}

// New returns a reference to an initialized blockchain app
Expand All @@ -267,7 +263,7 @@ func New(
cdc := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

bApp := baseapp.NewBaseApp(Name, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
bApp := baseapp.NewBaseApp(AppName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
bApp.SetVersion(version.Version)
bApp.SetInterfaceRegistry(interfaceRegistry)
Expand Down Expand Up @@ -571,7 +567,8 @@ func New(

app.mm.RegisterInvariants(&app.CrisisKeeper)
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
app.mm.RegisterServices(module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()))
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
app.mm.RegisterServices(app.configurator)

// create the simulation manager and define the order of the modules for deterministic simulations
app.sm = module.NewSimulationManager(
Expand All @@ -594,6 +591,7 @@ func New(
// this line is used by starport scaffolding # stargate/app/appModule
)
app.sm.RegisterStoreDecoders()
app.RegisterUpgradeHandlers()

// initialize stores
app.MountKVStores(keys)
Expand Down Expand Up @@ -644,7 +642,7 @@ func New(
return app
}

// Name returns the name of the App
// AppName returns the name of the App
func (app *App) Name() string { return app.BaseApp.Name() }

// GetBaseApp returns the base app of the application
Expand Down Expand Up @@ -757,7 +755,7 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig

// register app's OpenAPI routes.
apiSvr.Router.Handle("/static/openapi.yml", http.FileServer(http.FS(docs.Docs)))
apiSvr.Router.HandleFunc("/", openapiconsole.Handler(Name, "/static/openapi.yml"))
apiSvr.Router.HandleFunc("/", openapiconsole.Handler(AppName, "/static/openapi.yml"))
}

// RegisterTxService implements the Application.RegisterTxService method.
Expand Down
8 changes: 8 additions & 0 deletions app/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app

const (
// Prefix of bech32 encoded address
AccountAddressPrefix = "cosmos"
// Application name
AppName = "sei-chain"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably want to change this to "sei" instead of "sei-chain", so that the cmd dir will be the same name as the seid. See ticket 0030 and #12

)
22 changes: 22 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package app

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

// Set this to the name of your upgrade
const UpgradeName = "upgrade-1.0.0"

func (app App) RegisterUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(UpgradeName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// Upgrade specific logic goes here
// For now, remove dex, epoch and oracle from the version map since
// they do not yet have upgrade logic
delete(fromVM, "dex")
delete(fromVM, "epoch")
delete(fromVM, "oracle")
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})
}
4 changes: 2 additions & 2 deletions cmd/sei-chaind/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (

func main() {
rootCmd, _ := NewRootCmd(
app.Name,
app.AppName,
app.AccountAddressPrefix,
app.DefaultNodeHome,
app.Name,
app.AppName,
app.ModuleBasics,
app.New,
// this line is used by starport scaffolding # root/arguments
Expand Down
4 changes: 2 additions & 2 deletions cmd/sei-chaind/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ func NewRootCmd(
WithViper(rootOptions.envPrefix)

rootCmd := &cobra.Command{
Use: appName + "d",
Short: "Stargate CosmosHub App",
Use: "seid",
Short: "Stargate Sei App",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
Expand Down