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

Commit

Permalink
dep injected
Browse files Browse the repository at this point in the history
  • Loading branch information
taryune committed Feb 23, 2024
1 parent 80f6619 commit 5c70494
Show file tree
Hide file tree
Showing 11 changed files with 860 additions and 516 deletions.
3 changes: 3 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ import (

"github.com/mycel-domain/mycel/docs"
// Epochs
_ "github.com/mycel-domain/mycel/x/epochs/module"
epochsmodulekeeper "github.com/mycel-domain/mycel/x/epochs/keeper"
// Furnace
_ "github.com/mycel-domain/mycel/x/furnace/module"
furnacemodulekeeper "github.com/mycel-domain/mycel/x/furnace/keeper"
// Registry
_ "github.com/mycel-domain/mycel/x/registry/module"
registrymodulekeeper "github.com/mycel-domain/mycel/x/registry/keeper"
)

Expand Down
465 changes: 465 additions & 0 deletions debug_container.dot

Large diffs are not rendered by default.

243 changes: 191 additions & 52 deletions debug_container.log

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x/epochs/keeper/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/mycel-domain/mycel/x/epochs"
"github.com/mycel-domain/mycel/x/epochs/module"
"github.com/mycel-domain/mycel/x/epochs/types"
)

Expand Down
164 changes: 0 additions & 164 deletions x/epochs/module.go

This file was deleted.

62 changes: 56 additions & 6 deletions x/epochs/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ import (
"context"
"encoding/json"
"fmt"
"log"
"time"

"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

"cosmossdk.io/core/appmodule"

"cosmossdk.io/depinject"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/spf13/cobra"

// this line is used by starport scaffolding # 1

modulev1 "github.com/mycel-domain/mycel/api/mycel/epochs/module/v1"
"github.com/mycel-domain/mycel/x/epochs/client/cli"
"github.com/mycel-domain/mycel/x/epochs/keeper"
"github.com/mycel-domain/mycel/x/epochs/types"
Expand Down Expand Up @@ -81,7 +84,6 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx))
if err != nil {

Check warning on line 86 in x/epochs/module/module.go

View workflow job for this annotation

GitHub Actions / lint

empty-block: this block is empty, you can remove it (revive)
log.Printf("%v", err)
}
}

Expand Down Expand Up @@ -162,3 +164,51 @@ func (am AppModule) BeginBlock(ctx context.Context) error {
am.keeper.BeginBlocker(sdk.UnwrapSDKContext(ctx))
return nil
}

// ----------------------------------------------------------------------------
// App Wiring Setup
// ----------------------------------------------------------------------------

func init() {
appmodule.Register(
&modulev1.Module{},
appmodule.Provide(ProvideModule),
)
}

type ModuleInputs struct {
depinject.In

Cdc codec.Codec
StoreKey storetypes.StoreKey
MemKey storetypes.StoreKey
ParamStore paramtypes.Subspace
Config *modulev1.Module

AccountKeeper types.AccountKeeper
BankKeeper types.BankKeeper
}

type ModuleOutputs struct {
depinject.Out

EpochsKeeper keeper.Keeper
Module appmodule.AppModule
}

func ProvideModule(in ModuleInputs) ModuleOutputs {
k := keeper.NewKeeper(
in.Cdc,
in.StoreKey,
in.MemKey,
in.ParamStore,
)
m := NewAppModule(
in.Cdc,
*k,
in.AccountKeeper,
in.BankKeeper,
)

return ModuleOutputs{EpochsKeeper: *k, Module: m}
}
54 changes: 0 additions & 54 deletions x/epochs/module/module_simulation.go

This file was deleted.

Loading

0 comments on commit 5c70494

Please sign in to comment.