Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/ibc-hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Apr 4, 2023
2 parents 9b94966 + 7984424 commit de02587
Show file tree
Hide file tree
Showing 54 changed files with 8,137 additions and 586 deletions.
22 changes: 20 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"path/filepath"
"strings"

"github.com/neutron-org/neutron/x/cron"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/cosmos/cosmos-sdk/baseapp"
Expand Down Expand Up @@ -78,6 +80,8 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
"github.com/cosmos/interchain-security/legacy_ibc_testing/core"
ibctesting "github.com/cosmos/interchain-security/legacy_ibc_testing/testing"
cronkeeper "github.com/neutron-org/neutron/x/cron/keeper"
crontypes "github.com/neutron-org/neutron/x/cron/types"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
Expand Down Expand Up @@ -194,6 +198,7 @@ var (
feerefunder.AppModuleBasic{},
feeburner.AppModuleBasic{},
contractmanager.AppModuleBasic{},
cron.AppModuleBasic{},
adminmodulemodule.NewAppModuleBasic(
govclient.NewProposalHandler(
adminmodulecli.NewSubmitParamChangeProposalTxCmd,
Expand Down Expand Up @@ -224,6 +229,7 @@ var (
ccvconsumertypes.ConsumerRedistributeName: {authtypes.Burner},
ccvconsumertypes.ConsumerToSendToProviderName: nil,
tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner},
crontypes.ModuleName: nil,
}
)

Expand Down Expand Up @@ -281,6 +287,7 @@ type App struct {
FeeBurnerKeeper *feeburnerkeeper.Keeper
ConsumerKeeper ccvconsumerkeeper.Keeper
TokenFactoryKeeper *tokenfactorykeeper.Keeper
CronKeeper cronkeeper.Keeper
RouterKeeper *routerkeeper.Keeper

RouterModule router.AppModule
Expand Down Expand Up @@ -338,7 +345,8 @@ func New(
evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey,
icahosttypes.StoreKey, capabilitytypes.StoreKey,
interchainqueriesmoduletypes.StoreKey, contractmanagermoduletypes.StoreKey, interchaintxstypes.StoreKey, wasm.StoreKey, feetypes.StoreKey,
feeburnertypes.StoreKey, adminmodulemoduletypes.StoreKey, ccvconsumertypes.StoreKey, tokenfactorytypes.StoreKey, routertypes.StoreKey, ibchookstypes.StoreKey,
feeburnertypes.StoreKey, adminmodulemoduletypes.StoreKey, ccvconsumertypes.StoreKey, tokenfactorytypes.StoreKey, routertypes.StoreKey,
crontypes.StoreKey, ibchookstypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, feetypes.MemStoreKey)
Expand Down Expand Up @@ -557,7 +565,8 @@ func New(
app.FeeKeeper,
)

wasmOpts = append(wasmbinding.RegisterCustomPlugins(&app.InterchainTxsKeeper, &app.InterchainQueriesKeeper, app.TransferKeeper, &app.AdminmoduleKeeper, app.FeeBurnerKeeper, app.FeeKeeper, &app.BankKeeper, app.TokenFactoryKeeper), wasmOpts...)
app.CronKeeper = *cronkeeper.NewKeeper(appCodec, keys[crontypes.StoreKey], keys[crontypes.MemStoreKey], app.GetSubspace(crontypes.ModuleName), app.AccountKeeper)
wasmOpts = append(wasmbinding.RegisterCustomPlugins(&app.InterchainTxsKeeper, &app.InterchainQueriesKeeper, app.TransferKeeper, &app.AdminmoduleKeeper, app.FeeBurnerKeeper, app.FeeKeeper, &app.BankKeeper, app.TokenFactoryKeeper, &app.CronKeeper), wasmOpts...)

app.WasmKeeper = wasm.NewKeeper(
appCodec,
Expand All @@ -580,6 +589,9 @@ func New(
)
wasmHooks.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper)

app.CronKeeper.WasmMsgServer = wasmkeeper.NewMsgServerImpl(wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper))
cronModule := cron.NewAppModule(appCodec, &app.CronKeeper)

if len(enabledProposals) != 0 {
app.AdminmoduleKeeper.Router().AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals))
}
Expand Down Expand Up @@ -658,6 +670,7 @@ func New(
adminModule,
ibcHooksModule,
tokenfactory.NewAppModule(appCodec, *app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper),
cronModule,
)

// During begin block slashing happens after distr.BeginBlocker so that
Expand Down Expand Up @@ -690,6 +703,7 @@ func New(
adminmodulemoduletypes.ModuleName,
ibchookstypes.ModuleName,
routertypes.ModuleName,
crontypes.ModuleName,
)

app.mm.SetOrderEndBlockers(
Expand Down Expand Up @@ -718,6 +732,7 @@ func New(
adminmodulemoduletypes.ModuleName,
ibchookstypes.ModuleName,
routertypes.ModuleName,
crontypes.ModuleName,
)

// NOTE: The genutils module must occur after staking so that pools are
Expand Down Expand Up @@ -751,6 +766,7 @@ func New(
adminmodulemoduletypes.ModuleName,
ibchookstypes.ModuleName, // after auth keeper
routertypes.ModuleName,
crontypes.ModuleName,
)

app.mm.RegisterInvariants(&app.CrisisKeeper)
Expand All @@ -772,6 +788,7 @@ func New(
transferModule,
interchainQueriesModule,
interchainTxsModule,
cronModule,
)
app.sm.RegisterStoreDecoders()

Expand Down Expand Up @@ -1008,6 +1025,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(wasm.ModuleName)
paramsKeeper.Subspace(feetypes.ModuleName)
paramsKeeper.Subspace(feeburnertypes.ModuleName)
paramsKeeper.Subspace(crontypes.ModuleName)

return paramsKeeper
}
Expand Down
Loading

0 comments on commit de02587

Please sign in to comment.