diff --git a/app/app.go b/app/app.go index c90b0d68c9..b6247eaf87 100644 --- a/app/app.go +++ b/app/app.go @@ -134,6 +134,10 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + + "github.com/CosmosContracts/juno/v18/x/clock" + clockkeeper "github.com/CosmosContracts/juno/v18/x/clock/keeper" + clocktypes "github.com/CosmosContracts/juno/v18/x/clock/types" ) const appName = "WasmApp" @@ -233,6 +237,9 @@ type WasmApp struct { ScopedIBCFeeKeeper capabilitykeeper.ScopedKeeper ScopedWasmKeeper capabilitykeeper.ScopedKeeper + ContractKeeper *wasmkeeper.PermissionedKeeper + ClockKeeper clockkeeper.Keeper + // the module manager ModuleManager *module.Manager BasicModuleManager module.BasicManager @@ -274,6 +281,7 @@ func NewWasmApp( std.RegisterLegacyAminoCodec(legacyAmino) std.RegisterInterfaces(interfaceRegistry) + clockkeeper.RegisterProposalTypes() // Below we could construct and set an application specific mempool and // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are @@ -323,7 +331,7 @@ func NewWasmApp( // non sdk store keys capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey, wasmtypes.StoreKey, icahosttypes.StoreKey, - icacontrollertypes.StoreKey, + icacontrollertypes.StoreKey, clocktypes.StoreKey, ) tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) @@ -527,7 +535,8 @@ func NewWasmApp( // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter := govv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). + AddRoute(clocktypes.RouterKey, clockkeeper.NewClockProposalHandler(app.ClockKeeper)) govConfig := govtypes.DefaultConfig() /* Example of setting gov params: @@ -651,6 +660,13 @@ func NewWasmApp( wasmOpts..., ) + app.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper) + app.ClockKeeper = clockkeeper.NewKeeper( + app.keys[clocktypes.StoreKey], + appCodec, + *app.ContractKeeper, + ) + // Create fee enabled wasm ibc Stack var wasmStack porttypes.IBCModule wasmStackIBCHandler := wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper, app.IBCFeeKeeper) @@ -737,6 +753,7 @@ func NewWasmApp( ibctm.AppModule{}, // sdk 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 + clock.NewAppModule(appCodec, app.ClockKeeper), ) // BasicModuleManager defines the module BasicManager is in charge of setting up basic, @@ -752,6 +769,7 @@ func NewWasmApp( paramsclient.ProposalHandler, }, ), + clocktypes.ModuleName: clock.AppModuleBasic{}, }) app.BasicModuleManager.RegisterLegacyAminoCodec(legacyAmino) app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) @@ -780,6 +798,7 @@ func NewWasmApp( icatypes.ModuleName, ibcfeetypes.ModuleName, wasmtypes.ModuleName, + clocktypes.ModuleName, ) app.ModuleManager.SetOrderEndBlockers( @@ -796,6 +815,7 @@ func NewWasmApp( icatypes.ModuleName, ibcfeetypes.ModuleName, wasmtypes.ModuleName, + clocktypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -821,6 +841,7 @@ func NewWasmApp( ibcfeetypes.ModuleName, // wasm after ibc transfer wasmtypes.ModuleName, + clocktypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...) @@ -1198,5 +1219,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) paramsKeeper.Subspace(wasmtypes.ModuleName) + paramsKeeper.Subspace(clocktypes.ModuleName) + return paramsKeeper } diff --git a/go.mod b/go.mod index 30a7bce5a5..23d66fbbab 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.21 require ( github.com/CosmWasm/wasmvm/v2 v2.1.0 + github.com/CosmosContracts/juno/v18/x/clock v0.0.0-00010101000000-000000000000 github.com/cosmos/cosmos-proto v1.0.0-beta.5 github.com/cosmos/cosmos-sdk v0.50.7 github.com/cosmos/gogogateway v1.2.0 // indirect @@ -215,10 +216,13 @@ require ( replace ( github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 + github.com/CosmosContracts/juno/v18/x/clock => github.com/oraichain/juno/x/clock v0.0.0-20240730044630-b70856e973de + // indexer and timestamp added github.com/cometbft/cometbft => github.com/oraichain/cometbft v0.38.6-0.20240729034548-028d4fcc0fa4 // go list -m -json github.com/oraichain/cosmos-sdk@v0.50.7-epi191 | jq '.|"\(.Path) \(.Version)"' -r github.com/cosmos/cosmos-sdk => github.com/oraichain/cosmos-sdk v0.50.5-0.20240729032658-16fb0ec0a540 + // dgrijalva/jwt-go is deprecated and doesn't receive security updates. // See: https://github.com/cosmos/cosmos-sdk/issues/13134 github.com/dgrijalva/jwt-go => github.com/golang-jwt/jwt/v4 v4.4.2 diff --git a/go.sum b/go.sum index 603ff2763b..1cb22eaf41 100644 --- a/go.sum +++ b/go.sum @@ -859,6 +859,8 @@ github.com/oraichain/cometbft v0.38.6-0.20240729034548-028d4fcc0fa4 h1:xxiGoC9su github.com/oraichain/cometbft v0.38.6-0.20240729034548-028d4fcc0fa4/go.mod h1:jHPx9vQpWzPHEAiYI/7EDKaB1NXhK6o3SArrrY8ExKc= github.com/oraichain/cosmos-sdk v0.50.5-0.20240729032658-16fb0ec0a540 h1:eKScpVbDghsaMY/O7QrRZi1BvP6Q0JcQIJ367N0T2+A= github.com/oraichain/cosmos-sdk v0.50.5-0.20240729032658-16fb0ec0a540/go.mod h1:84xDDJEHttRT7NDGwBaUOLVOMN0JNE9x7NbsYIxXs1s= +github.com/oraichain/juno/x/clock v0.0.0-20240730044630-b70856e973de h1:rY6c793v6tOaZC66ExXqt+3b9rY+hAi/Jh/EbmCD61U= +github.com/oraichain/juno/x/clock v0.0.0-20240730044630-b70856e973de/go.mod h1:JAaOF+0j23OoyEgd6uhE3cgNDpZcfVZx4/DBbnMjUsc= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=