Skip to content

Commit

Permalink
feat: upgraded the app with gravity module to SDK v0.50
Browse files Browse the repository at this point in the history
  • Loading branch information
deepan95dev committed Dec 14, 2023
1 parent 8a60bd6 commit 8ce93dd
Show file tree
Hide file tree
Showing 46 changed files with 759 additions and 617 deletions.
105 changes: 68 additions & 37 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,24 @@ import (
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"

palomamempool "github.com/palomachain/paloma/app/mempool"
appparams "github.com/palomachain/paloma/app/params"

// xchain "github.com/palomachain/paloma/internal/x-chain"
// consensusmodule "github.com/palomachain/paloma/x/consensus"
// consensusmodulekeeper "github.com/palomachain/paloma/x/consensus/keeper"
// consensusmoduletypes "github.com/palomachain/paloma/x/consensus/types"
// "github.com/palomachain/paloma/x/evm"
gravitymodule "github.com/palomachain/paloma/x/gravity"
gravityclient "github.com/palomachain/paloma/x/gravity/client"
gravitymodulekeeper "github.com/palomachain/paloma/x/gravity/keeper"
gravitymoduletypes "github.com/palomachain/paloma/x/gravity/types"

"github.com/palomachain/paloma/x/evm"
evmclient "github.com/palomachain/paloma/x/evm/client"
evmmodulekeeper "github.com/palomachain/paloma/x/evm/keeper"
evmmoduletypes "github.com/palomachain/paloma/x/evm/types"

// gravitymodule "github.com/palomachain/paloma/x/gravity"
// gravityclient "github.com/palomachain/paloma/x/gravity/client"
// gravitymodulekeeper "github.com/palomachain/paloma/x/gravity/keeper"
// gravitymoduletypes "github.com/palomachain/paloma/x/gravity/types"
// palomamodule "github.com/palomachain/paloma/x/paloma"
// palomamodulekeeper "github.com/palomachain/paloma/x/paloma/keeper"
// palomamoduletypes "github.com/palomachain/paloma/x/paloma/types"
Expand Down Expand Up @@ -165,6 +166,8 @@ const (
func getGovProposalHandlers() []govclient.ProposalHandler {
return []govclient.ProposalHandler{
paramsclient.ProposalHandler,
gravityclient.ProposalHandler,
// treasuryclient.ProposalHandler,
evmclient.ProposalHandler,
}
}
Expand All @@ -173,6 +176,40 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
// and genesis verification.
ModuleBasics = module.NewBasicManager(
auth.AppModuleBasic{},
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
bank.AppModule{},
capability.AppModuleBasic{},
staking.AppModule{},
mint.AppModule{},
distr.AppModuleBasic{},
gov.AppModule{AppModuleBasic: gov.NewAppModuleBasic(getGovProposalHandlers())},
params.AppModuleBasic{},
crisis.AppModule{},
slashing.AppModule{},
feegrantmodule.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
vesting.AppModuleBasic{},
// schedulermodule.AppModuleBasic{},
// consensusmodule.AppModuleBasic{},
// valsetmodule.AppModuleBasic{},
wasm.AppModuleBasic{},
evm.AppModuleBasic{},
gravitymodule.AppModuleBasic{},
// palomamodule.AppModuleBasic{},
// treasurymodule.AppModuleBasic{},
// consensus.AppModuleBasic{},
transfer.AppModuleBasic{},
ibc.AppModuleBasic{},
ica.AppModuleBasic{},
ibcfee.AppModuleBasic{},
)

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
Expand All @@ -181,10 +218,12 @@ var (
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
gravitymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
icatypes.ModuleName: nil,
evmmoduletypes.ModuleName: {authtypes.Burner, authtypes.Minter},
wasmtypes.ModuleName: {authtypes.Burner},
// treasurymoduletypes.ModuleName: {authtypes.Burner, authtypes.Minter},
}
)

Expand Down Expand Up @@ -247,10 +286,10 @@ type App struct {
// ConsensusKeeper consensusmodulekeeper.Keeper
// ValsetKeeper valsetmodulekeeper.Keeper
// PalomaKeeper palomamodulekeeper.Keeper
// TreasuryKeeper treasurymodulekeeper.Keeper
EvmKeeper evmmodulekeeper.Keeper
// GravityKeeper gravitymodulekeeper.Keeper
wasmKeeper wasmkeeper.Keeper
// TreasuryKeeper treasurymodulekeeper.Keeper
GravityKeeper gravitymodulekeeper.Keeper
wasmKeeper wasmkeeper.Keeper
EvmKeeper evmmodulekeeper.Keeper

// mm is the module manager
ModuleManager *module.Manager
Expand Down Expand Up @@ -325,11 +364,9 @@ func New(
// consensusmoduletypes.StoreKey,
// valsetmoduletypes.StoreKey,
// treasurymoduletypes.StoreKey,
// // wasm.StoreKey,
evmmoduletypes.StoreKey,
wasmtypes.StoreKey,
// evmmoduletypes.StoreKey,
// gravitymoduletypes.StoreKey,
gravitymoduletypes.StoreKey,
// consensusparamtypes.StoreKey,
crisistypes.StoreKey,
)
Expand Down Expand Up @@ -559,18 +596,18 @@ func New(
// }
// app.ValsetKeeper.EvmKeeper = app.EvmKeeper

// app.GravityKeeper = gravitymodulekeeper.NewKeeper(
// appCodec,
// app.GetSubspace(gravitymoduletypes.ModuleName),
// app.AccountKeeper,
// app.StakingKeeper,
// app.BankKeeper,
// app.SlashingKeeper,
// app.DistrKeeper,
// app.EvmKeeper,
// app.TransferKeeper,
// gravitymodulekeeper.NewGravityStoreGetter(keys[gravitymoduletypes.StoreKey]),
// )
app.GravityKeeper = gravitymodulekeeper.NewKeeper(
appCodec,
app.GetSubspace(gravitymoduletypes.ModuleName),
app.AccountKeeper,
app.StakingKeeper,
app.BankKeeper,
app.SlashingKeeper,
app.DistrKeeper,
app.TransferKeeper,
app.EvmKeeper,
gravitymodulekeeper.NewGravityStoreGetter(keys[gravitymoduletypes.StoreKey]),
)

// app.PalomaKeeper = *palomamodulekeeper.NewKeeper(
// appCodec,
Expand Down Expand Up @@ -739,7 +776,7 @@ func New(
// valsetModule := valsetmodule.NewAppModule(appCodec, app.ValsetKeeper, app.AccountKeeper, app.BankKeeper)
// schedulerModule := schedulermodule.NewAppModule(appCodec, app.SchedulerKeeper, app.AccountKeeper, app.BankKeeper)
// palomaModule := palomamodule.NewAppModule(appCodec, app.PalomaKeeper, app.AccountKeeper, app.BankKeeper)
// gravityModule := gravitymodule.NewAppModule(appCodec, app.GravityKeeper, app.BankKeeper)
gravityModule := gravitymodule.NewAppModule(appCodec, app.GravityKeeper, app.BankKeeper)
// treasuryModule := treasurymodule.NewAppModule(appCodec, app.TreasuryKeeper, app.AccountKeeper, app.BankKeeper)
app.ModuleManager = module.NewManager(
genutil.NewAppModule(
Expand All @@ -766,7 +803,7 @@ func New(
// consensusModule,
// valsetModule,
evmModule,
// gravityModule,
gravityModule,
// palomaModule,
// treasuryModule,
wasm.NewAppModule(appCodec, &app.wasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasm.ModuleName)),
Expand Down Expand Up @@ -813,11 +850,9 @@ func New(
genutiltypes.ModuleName,
// valsetmoduletypes.ModuleName,
// palomamoduletypes.ModuleName,
// wasm.ModuleName,
evmmoduletypes.ModuleName,
wasmtypes.ModuleName,
// evmmoduletypes.ModuleName,
// gravitymoduletypes.ModuleName,
gravitymoduletypes.ModuleName,
// treasurymoduletypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
Expand Down Expand Up @@ -847,11 +882,9 @@ func New(
genutiltypes.ModuleName,
// valsetmoduletypes.ModuleName,
// palomamoduletypes.ModuleName,
// wasm.ModuleName,
evmmoduletypes.ModuleName,
wasmtypes.ModuleName,
// evmmoduletypes.ModuleName,
// gravitymoduletypes.ModuleName,
gravitymoduletypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
Expand Down Expand Up @@ -890,11 +923,9 @@ func New(
ibcexported.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
// wasm.ModuleName,
evmmoduletypes.ModuleName,
wasmtypes.ModuleName,
// evmmoduletypes.ModuleName,
// gravitymoduletypes.ModuleName,
gravitymoduletypes.ModuleName,
// treasurymoduletypes.ModuleName,
consensusparamtypes.ModuleName,
)
Expand Down Expand Up @@ -1143,7 +1174,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
// paramsKeeper.Subspace(valsetmoduletypes.ModuleName)
paramsKeeper.Subspace(wasmtypes.ModuleName)
// paramsKeeper.Subspace(evmmoduletypes.ModuleName)
// paramsKeeper.Subspace(gravitymoduletypes.ModuleName)
paramsKeeper.Subspace(gravitymoduletypes.ModuleName)

return paramsKeeper
}
Expand Down
Loading

0 comments on commit 8ce93dd

Please sign in to comment.