Skip to content

Commit

Permalink
use sdk root.go
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Oct 22, 2022
1 parent 73573f0 commit 5c0c9b5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 37 deletions.
28 changes: 5 additions & 23 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/simapp"
store "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down Expand Up @@ -91,11 +92,9 @@ import (
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

"github.com/tendermint/starport/starport/pkg/cosmoscmd"
"github.com/tendermint/starport/starport/pkg/openapiconsole"

"github.com/ChihuahuaChain/chihuahua/docs"
// this line is used by starport scaffolding # stargate/app/moduleImport

"github.com/CosmWasm/wasmd/x/wasm"
wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
Expand All @@ -108,7 +107,6 @@ const (
v220UpgradeName = "burnmech"
)

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
var (
// If EnabledSpecificProposals is "", and this is "true", then enable all x/wasm proposals.
// If EnabledSpecificProposals is "", and this is not "true", then disable all x/wasm proposals.
Expand Down Expand Up @@ -147,11 +145,8 @@ func GetWasmOpts(appOpts servertypes.AppOptions) []wasm.Option {
return wasmOpts
}

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

func getGovProposalHandlers() []govclient.ProposalHandler {
var govProposalHandlers []govclient.ProposalHandler
// this line is used by starport scaffolding # stargate/app/govProposalHandlers
govProposalHandlers = wasmclient.ProposalHandlers

govProposalHandlers = append(govProposalHandlers,
Expand All @@ -161,7 +156,6 @@ func getGovProposalHandlers() []govclient.ProposalHandler {
upgradeclient.CancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
// this line is used by starport scaffolding # stargate/app/govProposalHandler
)

return govProposalHandlers
Expand Down Expand Up @@ -193,7 +187,6 @@ var (
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
wasm.AppModuleBasic{},
)

Expand All @@ -206,13 +199,12 @@ var (
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
// this line is used by starport scaffolding # stargate/app/maccPerms
wasm.ModuleName: {authtypes.Burner},
wasm.ModuleName: {authtypes.Burner},
}
)

var (
_ cosmoscmd.CosmosApp = (*App)(nil)
_ simapp.App = (*App)(nil)
_ servertypes.Application = (*App)(nil)
)

Expand Down Expand Up @@ -266,7 +258,6 @@ type App struct {
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

// this line is used by starport scaffolding # stargate/app/keeperDeclaration
wasmKeeper wasm.Keeper
scopedWasmKeeper capabilitykeeper.ScopedKeeper

Expand All @@ -283,10 +274,10 @@ func New(
skipUpgradeHeights map[int64]bool,
homePath string,
invCheckPeriod uint,
encodingConfig cosmoscmd.EncodingConfig,
encodingConfig encparams.EncodingConfig,
appOpts servertypes.AppOptions,
baseAppOptions ...func(*baseapp.BaseApp),
) cosmoscmd.App {
) *App {
appCodec := encodingConfig.Marshaler
cdc := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry
Expand All @@ -301,7 +292,6 @@ func New(
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
wasm.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -329,7 +319,6 @@ func New(
// grant capabilities for the ibc and ibc-transfer modules
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/scopedKeeper
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName)

// add keepers
Expand Down Expand Up @@ -402,7 +391,6 @@ func New(
// If evidence needs to be handled for the app, set routes in router here and seal
app.EvidenceKeeper = *evidenceKeeper

// this line is used by starport scaffolding # stargate/app/keeperDefinition
wasmDir := filepath.Join(homePath, "data")

wasmConfig, err := wasm.ReadWasmConfig(appOpts)
Expand Down Expand Up @@ -444,12 +432,10 @@ func New(
appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
&stakingKeeper, govRouter,
)
// this line is used by starport scaffolding # stargate/app/keeperDefinition

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := ibcporttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
// this line is used by starport scaffolding # ibc/app/router
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.IBCKeeper.ChannelKeeper))
app.IBCKeeper.SetRouter(ibcRouter)

Expand Down Expand Up @@ -484,7 +470,6 @@ func New(
ibc.NewAppModule(app.IBCKeeper),
params.NewAppModule(app.ParamsKeeper),
transferModule,
// this line is used by starport scaffolding # stargate/app/appModule
wasm.NewAppModule(appCodec, &app.wasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
)

Expand Down Expand Up @@ -561,7 +546,6 @@ func New(
feegrant.ModuleName,
ibctransfertypes.ModuleName,
authz.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
wasm.ModuleName,
)

Expand Down Expand Up @@ -626,7 +610,6 @@ func New(

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper
// this line is used by starport scaffolding # stargate/app/beforeInitReturn
app.scopedWasmKeeper = scopedWasmKeeper

return app
Expand Down Expand Up @@ -774,7 +757,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace
paramsKeeper.Subspace(wasm.ModuleName)

return paramsKeeper
Expand Down
27 changes: 13 additions & 14 deletions cmd/chihuahuad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@ package main
import (
"os"

"github.com/ChihuahuaChain/chihuahua/app"
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/tendermint/starport/starport/pkg/cosmoscmd"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/simapp/simd/cmd"
)

func main() {
rootCmd, _ := cosmoscmd.NewRootCmd(
app.Name,
app.AccountAddressPrefix,
app.DefaultNodeHome,
app.Name,
app.ModuleBasics,
app.New,
// this line is used by starport scaffolding # root/arguments
)
rootCmd.AddCommand(Cmd())
if err := svrcmd.Execute(rootCmd, app.DefaultNodeHome); err != nil {
os.Exit(1)
rootCmd, _ := cmd.NewRootCmd()

if err := svrcmd.Execute(rootCmd, simapp.DefaultNodeHome); err != nil {
switch e := err.(type) {
case server.ErrorCode:
os.Exit(e.Code)

default:
os.Exit(1)
}
}
}

0 comments on commit 5c0c9b5

Please sign in to comment.