refactor: move nebula configuration to static file

This commit is contained in:
Prad Nukala
2024-09-30 21:51:16 -04:00
parent 37585b4df2
commit 48b197890e
18 changed files with 186 additions and 107 deletions
+8 -8
View File
@@ -3,20 +3,19 @@ package module
import (
"os"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
modulev1 "github.com/onsonr/sonr/api/macaroon/module/v1"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
"github.com/onsonr/sonr/x/macaroon/keeper"
)
@@ -41,6 +40,7 @@ type ModuleInputs struct {
Cdc codec.Codec
StoreService store.KVStoreService
AddressCodec address.Codec
DidKeeper didkeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
@@ -57,7 +57,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr)
m := NewAppModule(in.Cdc, k)
m := NewAppModule(in.Cdc, k, in.DidKeeper)
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
}
+6 -7
View File
@@ -3,12 +3,9 @@ package keeper_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/store"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
@@ -23,9 +20,10 @@ import (
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/store"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
module "github.com/onsonr/sonr/x/macaroon"
"github.com/onsonr/sonr/x/macaroon/keeper"
"github.com/onsonr/sonr/x/macaroon/types"
@@ -49,6 +47,7 @@ type testFixture struct {
appModule *module.AppModule
accountkeeper authkeeper.AccountKeeper
didk didkeeper.Keeper
bankkeeper bankkeeper.BaseKeeper
stakingKeeper *stakingkeeper.Keeper
mintkeeper mintkeeper.Keeper
@@ -82,7 +81,7 @@ func SetupTest(t *testing.T) *testFixture {
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr)
f.msgServer = keeper.NewMsgServerImpl(f.k)
f.queryServer = keeper.NewQuerier(f.k)
f.appModule = module.NewAppModule(encCfg.Codec, f.k)
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk)
return f
}
+7 -7
View File
@@ -4,23 +4,20 @@ import (
"context"
"encoding/json"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
abci "github.com/cometbft/cometbft/abci/types"
"cosmossdk.io/client/v2/autocli"
errorsmod "cosmossdk.io/errors"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
"github.com/onsonr/sonr/x/macaroon/keeper"
"github.com/onsonr/sonr/x/macaroon/types"
// this line is used by starport scaffolding # 1
)
const (
@@ -47,16 +44,19 @@ type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
didk didkeeper.Keeper
}
// NewAppModule constructor
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
didkeeper didkeeper.Keeper,
) *AppModule {
return &AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},
keeper: keeper,
didk: didkeeper,
}
}
+10 -8
View File
@@ -3,20 +3,20 @@ package module
import (
"os"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
modulev1 "github.com/onsonr/sonr/api/oracle/module/v1"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper"
"github.com/onsonr/sonr/x/oracle/keeper"
)
@@ -42,6 +42,8 @@ type ModuleInputs struct {
StoreService store.KVStoreService
AddressCodec address.Codec
DidKeeper didkeeper.Keeper
MacaroonKeeper macaroonkeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
}
@@ -57,7 +59,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr)
m := NewAppModule(in.Cdc, k)
m := NewAppModule(in.Cdc, k, in.DidKeeper, in.MacaroonKeeper)
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
}
+8 -8
View File
@@ -3,12 +3,9 @@ package keeper_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/store"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
@@ -23,9 +20,11 @@ import (
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/store"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper"
module "github.com/onsonr/sonr/x/oracle"
"github.com/onsonr/sonr/x/oracle/keeper"
"github.com/onsonr/sonr/x/oracle/types"
@@ -50,6 +49,8 @@ type testFixture struct {
accountkeeper authkeeper.AccountKeeper
bankkeeper bankkeeper.BaseKeeper
didkeeper didkeeper.Keeper
mack macaroonkeeper.Keeper
stakingKeeper *stakingkeeper.Keeper
mintkeeper mintkeeper.Keeper
@@ -82,8 +83,7 @@ func SetupTest(t *testing.T) *testFixture {
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr)
f.msgServer = keeper.NewMsgServerImpl(f.k)
f.queryServer = keeper.NewQuerier(f.k)
f.appModule = module.NewAppModule(encCfg.Codec, f.k)
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didkeeper, f.mack)
return f
}
+11 -7
View File
@@ -4,23 +4,21 @@ import (
"context"
"encoding/json"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
abci "github.com/cometbft/cometbft/abci/types"
"cosmossdk.io/client/v2/autocli"
errorsmod "cosmossdk.io/errors"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper"
"github.com/onsonr/sonr/x/oracle/keeper"
"github.com/onsonr/sonr/x/oracle/types"
// this line is used by starport scaffolding # 1
)
const (
@@ -47,16 +45,22 @@ type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
didk didkeeper.Keeper
mack macaroonkeeper.Keeper
}
// NewAppModule constructor
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
didkeeper didkeeper.Keeper,
macaroonkeeper macaroonkeeper.Keeper,
) *AppModule {
return &AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},
keeper: keeper,
didk: didkeeper,
mack: macaroonkeeper,
}
}
+10 -8
View File
@@ -3,20 +3,20 @@ package module
import (
"os"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
modulev1 "github.com/onsonr/sonr/api/service/module/v1"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper"
"github.com/onsonr/sonr/x/service/keeper"
)
@@ -42,6 +42,8 @@ type ModuleInputs struct {
StoreService store.KVStoreService
AddressCodec address.Codec
DidKeeper didkeeper.Keeper
MacaroonKeeper macaroonkeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
}
@@ -57,7 +59,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr)
m := NewAppModule(in.Cdc, k)
m := NewAppModule(in.Cdc, k, in.DidKeeper, in.MacaroonKeeper)
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
}
+8 -7
View File
@@ -3,12 +3,9 @@ package keeper_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/store"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
@@ -23,9 +20,11 @@ import (
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/store"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper"
module "github.com/onsonr/sonr/x/service"
"github.com/onsonr/sonr/x/service/keeper"
"github.com/onsonr/sonr/x/service/types"
@@ -50,6 +49,8 @@ type testFixture struct {
accountkeeper authkeeper.AccountKeeper
bankkeeper bankkeeper.BaseKeeper
didkeeper didkeeper.Keeper
mack macaroonkeeper.Keeper
stakingKeeper *stakingkeeper.Keeper
mintkeeper mintkeeper.Keeper
@@ -82,7 +83,7 @@ func SetupTest(t *testing.T) *testFixture {
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr)
f.msgServer = keeper.NewMsgServerImpl(f.k)
f.queryServer = keeper.NewQuerier(f.k)
f.appModule = module.NewAppModule(encCfg.Codec, f.k)
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didkeeper, f.mack)
return f
}
+11 -7
View File
@@ -4,23 +4,21 @@ import (
"context"
"encoding/json"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
abci "github.com/cometbft/cometbft/abci/types"
"cosmossdk.io/client/v2/autocli"
errorsmod "cosmossdk.io/errors"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper"
"github.com/onsonr/sonr/x/service/keeper"
"github.com/onsonr/sonr/x/service/types"
// this line is used by starport scaffolding # 1
)
const (
@@ -47,16 +45,22 @@ type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
didk didkeeper.Keeper
mack macaroonkeeper.Keeper
}
// NewAppModule constructor
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
didkeeper didkeeper.Keeper,
macaroonkeeper macaroonkeeper.Keeper,
) *AppModule {
return &AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},
keeper: keeper,
didk: didkeeper,
mack: macaroonkeeper,
}
}
+6 -8
View File
@@ -3,18 +3,16 @@ package module
import (
"os"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
modulev1 "github.com/onsonr/sonr/api/vault/module/v1"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
@@ -59,7 +57,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs {
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.DidKeeper)
m := NewAppModule(in.Cdc, k)
m := NewAppModule(in.Cdc, k, in.DidKeeper)
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
}
+4 -7
View File
@@ -3,12 +3,9 @@ package keeper_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/store"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/testutil"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
@@ -23,8 +20,8 @@ import (
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"cosmossdk.io/core/store"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
module "github.com/onsonr/sonr/x/vault"
@@ -84,7 +81,7 @@ func SetupTest(t *testing.T) *testFixture {
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.didk)
f.msgServer = keeper.NewMsgServerImpl(f.k)
f.queryServer = keeper.NewQuerier(f.k)
f.appModule = module.NewAppModule(encCfg.Codec, f.k)
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk)
return f
}
+4 -8
View File
@@ -4,25 +4,20 @@ import (
"context"
"encoding/json"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
abci "github.com/cometbft/cometbft/abci/types"
"cosmossdk.io/client/v2/autocli"
errorsmod "cosmossdk.io/errors"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/gorilla/mux"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
"github.com/onsonr/sonr/x/vault/keeper"
"github.com/onsonr/sonr/x/vault/types"
// this line is used by starport scaffolding # 1
)
const (
@@ -56,6 +51,7 @@ type AppModule struct {
func NewAppModule(
cdc codec.Codec,
keeper keeper.Keeper,
didkeeper didkeeper.Keeper,
) *AppModule {
return &AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},