Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Furnace Module #95

Merged
merged 28 commits into from
Oct 12, 2023
Merged
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
51 changes: 43 additions & 8 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ import (
epochsmodulekeeper "github.com/mycel-domain/mycel/x/epochs/keeper"
epochsmoduletypes "github.com/mycel-domain/mycel/x/epochs/types"

furnacemodule "github.com/mycel-domain/mycel/x/furnace"
furnacemodulekeeper "github.com/mycel-domain/mycel/x/furnace/keeper"
furnacemoduletypes "github.com/mycel-domain/mycel/x/furnace/types"
resolvermodule "github.com/mycel-domain/mycel/x/resolver"
resolvermodulekeeper "github.com/mycel-domain/mycel/x/resolver/keeper"
resolvermoduletypes "github.com/mycel-domain/mycel/x/resolver/types"
Expand Down Expand Up @@ -236,6 +239,7 @@ var (
registrymodule.AppModuleBasic{},
epochsmodule.AppModuleBasic{},
resolvermodule.AppModuleBasic{},
furnacemodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)

Expand All @@ -253,6 +257,7 @@ var (
wasmtypes.ModuleName: {authtypes.Burner},
// my modules
registrymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
furnacemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)
Expand Down Expand Up @@ -323,6 +328,8 @@ type App struct {
EpochsKeeper epochsmodulekeeper.Keeper

ResolverKeeper resolvermodulekeeper.Keeper

FurnaceKeeper furnacemodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// mm is the module manager
Expand Down Expand Up @@ -410,6 +417,7 @@ func NewApp(
registrymoduletypes.StoreKey,
epochsmoduletypes.StoreKey,
resolvermoduletypes.StoreKey,
furnacemoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -671,14 +679,22 @@ func NewApp(
),
)

// my modules
// My module's keepers
app.EpochsKeeper = *epochsmodulekeeper.NewKeeper(
appCodec,
keys[epochsmoduletypes.StoreKey],
keys[epochsmoduletypes.MemStoreKey],
app.GetSubspace(epochsmoduletypes.ModuleName),
)
epochsModule := epochsmodule.NewAppModule(appCodec, app.EpochsKeeper, app.AccountKeeper, app.BankKeeper)

app.ResolverKeeper = *resolvermodulekeeper.NewKeeper(
appCodec,
keys[resolvermoduletypes.StoreKey],
keys[resolvermoduletypes.MemStoreKey],
app.GetSubspace(resolvermoduletypes.ModuleName),

app.RegistryKeeper,
)

app.RegistryKeeper = *registrymodulekeeper.NewKeeper(
appCodec,
Expand All @@ -688,7 +704,6 @@ func NewApp(

app.BankKeeper,
)
registryModule := registrymodule.NewAppModule(appCodec, app.RegistryKeeper, app.AccountKeeper, app.BankKeeper)

app.ResolverKeeper = *resolvermodulekeeper.NewKeeper(
appCodec,
Expand All @@ -698,7 +713,27 @@ func NewApp(

app.RegistryKeeper,
)

app.FurnaceKeeper = *furnacemodulekeeper.NewKeeper(
appCodec,
keys[furnacemoduletypes.StoreKey],
keys[furnacemoduletypes.MemStoreKey],
app.GetSubspace(furnacemoduletypes.ModuleName),

app.BankKeeper,
app.EpochsKeeper,
)

app.EpochsKeeper.SetHooks(
epochsmoduletypes.NewMultiEpochHooks(
// insert hooks here
app.FurnaceKeeper.Hooks(),
))

epochsModule := epochsmodule.NewAppModule(appCodec, app.EpochsKeeper, app.AccountKeeper, app.BankKeeper)
registryModule := registrymodule.NewAppModule(appCodec, app.RegistryKeeper, app.AccountKeeper, app.BankKeeper)
resolverModule := resolvermodule.NewAppModule(appCodec, app.ResolverKeeper, app.AccountKeeper, app.BankKeeper)
furnaceModule := furnacemodule.NewAppModule(appCodec, app.FurnaceKeeper, app.AccountKeeper, app.BankKeeper)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

Expand Down Expand Up @@ -726,11 +761,6 @@ func NewApp(
),
)

app.EpochsKeeper.SetHooks(
epochsmodulekeeper.NewMultiEpochHooks(
// insert hooks here
))

/**** Module Options ****/

// NOTE: we may consider parsing `appOpts` inside module constructors. For the moment
Expand Down Expand Up @@ -772,6 +802,7 @@ func NewApp(
registryModule,
epochsModule,
resolverModule,
furnaceModule,
// this line is used by starport scaffolding # stargate/app/appModule

crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
Expand Down Expand Up @@ -810,6 +841,7 @@ func NewApp(
registrymoduletypes.ModuleName,
epochsmoduletypes.ModuleName,
resolvermoduletypes.ModuleName,
furnacemoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
)

Expand Down Expand Up @@ -841,6 +873,7 @@ func NewApp(
registrymoduletypes.ModuleName,
epochsmoduletypes.ModuleName,
resolvermoduletypes.ModuleName,
furnacemoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
)

Expand Down Expand Up @@ -878,6 +911,7 @@ func NewApp(
registrymoduletypes.ModuleName,
epochsmoduletypes.ModuleName,
resolvermoduletypes.ModuleName,
furnacemoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
}
app.mm.SetOrderInitGenesis(genesisModuleOrder...)
Expand Down Expand Up @@ -1141,6 +1175,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(registrymoduletypes.ModuleName)
paramsKeeper.Subspace(epochsmoduletypes.ModuleName)
paramsKeeper.Subspace(resolvermoduletypes.ModuleName)
paramsKeeper.Subspace(furnacemoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
1 change: 0 additions & 1 deletion cmd/myceld/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ func txCommand() *cobra.Command {
return cmd
}


func addModuleInitFlags(startCmd *cobra.Command) {
crisis.AddModuleInitFlags(startCmd)
// this line is used by starport scaffolding # root/arguments
Expand Down
2 changes: 1 addition & 1 deletion cmd/myceld/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func main() {
rootCmd, _ := cmd.NewRootCmd()

if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
switch e := err.(type) {
case server.ErrorCode:
Expand Down
Loading
Loading