Skip to content

Commit

Permalink
feat: rename module
Browse files Browse the repository at this point in the history
  • Loading branch information
emidev98 committed Oct 29, 2023
1 parent da2727b commit aab8046
Show file tree
Hide file tree
Showing 57 changed files with 491 additions and 494 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<h1 align="center">CosmWasm Lifecycle Module</h1>
<h1 align="center">Lifecycle Hooks Module</h1>

![IMG](./docs/logo.jpg)

### Abstract

CosmWasm Lifecycle blockchain module leverages [CosmoSDK's lifecycle](https://docs.cosmos.network/main/build/building-modules/beginblock-endblock) to facilitate the execution of smart contracts at the initiation and conclusion of each block. Given the necessity for swift and resource-light execution in both stages, this module mandates [Gov](https://docs.cosmos.network/main/build/modules/gov) voting and demands a collateral deposit for each smart contract on an individual basis. This collateral deposit will be burned if the smart contract fails to execute multiple times.
Lifecycle Hooks is a CosmosSDK blockchain module that uses the [modules lifecycle](https://docs.cosmos.network/main/build/building-modules/beginblock-endblock) to facilitate the execution of smart contracts at the beign and end of each block.


### Usecases
Expand Down
52 changes: 26 additions & 26 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,23 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"

cosmwasmlifecyclemodule "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle"
cosmwasmlifecyclemodulekeeper "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/keeper"
cosmwasmlifecyclemoduletypes "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"
lifecyclehooksmodule "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks"
lifecyclehooksmodulekeeper "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks/keeper"
lifecyclehooksmoduletypes "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks/types"

// this line is used by starport scaffolding # stargate/app/moduleImport

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

appparams "github.com/emidev98/cosmwasm-lifecycle/app/params"
"github.com/emidev98/cosmwasm-lifecycle/docs"
appparams "github.com/emidev98/lifecycle-hooks/app/params"
"github.com/emidev98/lifecycle-hooks/docs"
)

const (
AccountAddressPrefix = "cosmos"
Name = "cosmwasm-lifecycle"
Name = "lifecycle-hooks"
)

// this line is used by starport scaffolding # stargate/wasm/app/enabledProposals
Expand Down Expand Up @@ -179,21 +179,21 @@ var (
ica.AppModuleBasic{},
vesting.AppModuleBasic{},
consensus.AppModuleBasic{},
cosmwasmlifecyclemodule.AppModuleBasic{},
lifecyclehooksmodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)

// module account permissions
maccPerms = map[string][]string{
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
icatypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
cosmwasmlifecyclemoduletypes.ModuleName: {authtypes.Burner},
authtypes.FeeCollectorName: nil,
distrtypes.ModuleName: nil,
icatypes.ModuleName: nil,
minttypes.ModuleName: {authtypes.Minter},
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
lifecyclehooksmoduletypes.ModuleName: {authtypes.Burner},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)
Expand Down Expand Up @@ -257,7 +257,7 @@ type App struct {
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedICAHostKeeper capabilitykeeper.ScopedKeeper

CosmwasmlifecycleKeeper cosmwasmlifecyclemodulekeeper.Keeper
LifecycleHooksKeeper lifecyclehooksmodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// mm is the module manager
Expand Down Expand Up @@ -304,7 +304,7 @@ func New(
govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey,
feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, icahosttypes.StoreKey,
capabilitytypes.StoreKey, group.StoreKey, icacontrollertypes.StoreKey, consensusparamtypes.StoreKey,
cosmwasmlifecyclemoduletypes.StoreKey,
lifecyclehooksmoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -555,14 +555,14 @@ func New(
GetWasmOpts(app, appOpts)...,
)

app.CosmwasmlifecycleKeeper = *cosmwasmlifecyclemodulekeeper.NewKeeper(
app.LifecycleHooksKeeper = *lifecyclehooksmodulekeeper.NewKeeper(
appCodec,
keys[cosmwasmlifecyclemoduletypes.StoreKey],
keys[lifecyclehooksmoduletypes.StoreKey],
app.WasmKeeper,
app.BankKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)
cosmwasmlifecycleModule := cosmwasmlifecyclemodule.NewAppModule(appCodec, app.CosmwasmlifecycleKeeper, app.WasmKeeper)
lifecyclehooksModule := lifecyclehooksmodule.NewAppModule(appCodec, app.LifecycleHooksKeeper, app.WasmKeeper)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

Expand Down Expand Up @@ -625,7 +625,7 @@ func New(
params.NewAppModule(app.ParamsKeeper),
transferModule,
icaModule,
cosmwasmlifecycleModule,
lifecyclehooksModule,
// this line is used by starport scaffolding # stargate/app/appModule

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
Expand Down Expand Up @@ -658,7 +658,7 @@ func New(
paramstypes.ModuleName,
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
cosmwasmlifecyclemoduletypes.ModuleName,
lifecyclehooksmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
)

Expand All @@ -684,7 +684,7 @@ func New(
upgradetypes.ModuleName,
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
cosmwasmlifecyclemoduletypes.ModuleName,
lifecyclehooksmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
)

Expand Down Expand Up @@ -715,7 +715,7 @@ func New(
upgradetypes.ModuleName,
vestingtypes.ModuleName,
consensusparamtypes.ModuleName,
cosmwasmlifecyclemoduletypes.ModuleName,
lifecyclehooksmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
}
app.mm.SetOrderInitGenesis(genesisModuleOrder...)
Expand Down Expand Up @@ -940,7 +940,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(ibcexported.ModuleName)
paramsKeeper.Subspace(icacontrollertypes.SubModuleName)
paramsKeeper.Subspace(icahosttypes.SubModuleName)
paramsKeeper.Subspace(cosmwasmlifecyclemoduletypes.ModuleName)
paramsKeeper.Subspace(lifecyclehooksmoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/x/auth/tx"

"github.com/emidev98/cosmwasm-lifecycle/app/params"
"github.com/emidev98/lifecycle-hooks/app/params"
)

// makeEncodingConfig creates an EncodingConfig for an amino based test configuration.
Expand Down
2 changes: 1 addition & 1 deletion app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/stretchr/testify/require"

"github.com/emidev98/cosmwasm-lifecycle/app"
"github.com/emidev98/lifecycle-hooks/app"
)

type storeKeysPrefixes struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/emidev98/cosmwasm-lifecycle/app"
"github.com/emidev98/lifecycle-hooks/app"
)

func initSDKConfig() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ import (
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/pflag"

// this line is used by starport scaffolding # root/moduleImport

"github.com/emidev98/cosmwasm-lifecycle/app"
appparams "github.com/emidev98/cosmwasm-lifecycle/app/params"
"github.com/emidev98/lifecycle-hooks/app"
appparams "github.com/emidev98/lifecycle-hooks/app/params"
)

// NewRootCmd creates a new root command for a Cosmos SDK application
Expand All @@ -57,7 +58,7 @@ func NewRootCmd() (*cobra.Command, appparams.EncodingConfig) {

rootCmd := &cobra.Command{
Use: app.Name + "d",
Short: "Start cosmwasmlifecycle node",
Short: "Start lifecyclehooks node",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"

"github.com/emidev98/cosmwasm-lifecycle/app"
"github.com/emidev98/cosmwasm-lifecycle/cmd/cosmwasm-lifecycled/cmd"
"github.com/emidev98/lifecycle-hooks/app"
"github.com/emidev98/lifecycle-hooks/cmd/lifecycle-hooksd/cmd"
)

func main() {
Expand Down
22 changes: 11 additions & 11 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34923,10 +34923,10 @@ paths:
format: int64
tags:
- Query
/cosmwasmlifecycle/params:
/lifecycle_hooks/params:
get:
summary: Parameters queries the parameters of the module.
operationId: Emidev98CosmwasmlifecycleParams
operationId: Emidev98LifecycleHooksParams
responses:
'200':
description: A successful response.
Expand Down Expand Up @@ -70593,30 +70593,30 @@ definitions:
NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
description: Period defines a length of time and amount of coins that will vest.
emidev98.cosmwasmlifecycle.ExecutionType:
emidev98.lifecycle_hooks.ExecutionType:
type: string
enum:
- BEGIN_BLOCK
- END_BLOCK
- BEGIN_AND_END_BLOCK
default: BEGIN_BLOCK
emidev98.cosmwasmlifecycle.ExecutionTypeOperation:
emidev98.lifecycle_hooks.ExecutionTypeOperation:
type: string
enum:
- ENABLE
- DISABLE
default: ENABLE
emidev98.cosmwasmlifecycle.MsgFundExistentContractResponse:
emidev98.lifecycle_hooks.MsgFundExistentContractResponse:
type: object
emidev98.cosmwasmlifecycle.MsgModifyContractProposalResponse:
emidev98.lifecycle_hooks.MsgModifyContractProposalResponse:
type: object
emidev98.cosmwasmlifecycle.MsgRegisterContractProposalResponse:
emidev98.lifecycle_hooks.MsgRegisterContractProposalResponse:
type: object
emidev98.cosmwasmlifecycle.MsgRemoveContractProposalResponse:
emidev98.lifecycle_hooks.MsgRemoveContractProposalResponse:
type: object
emidev98.cosmwasmlifecycle.MsgUpdateParamsProposalResponse:
emidev98.lifecycle_hooks.MsgUpdateParamsProposalResponse:
type: object
emidev98.cosmwasmlifecycle.Params:
emidev98.lifecycle_hooks.Params:
type: object
properties:
is_enabled:
Expand Down Expand Up @@ -70645,7 +70645,7 @@ definitions:
disabled from end and beging block executions.
When this happens the min_desposit will also be burned.
description: Params defines the parameters for the module.
emidev98.cosmwasmlifecycle.QueryParamsResponse:
emidev98.lifecycle_hooks.QueryParamsResponse:
type: object
properties:
params:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/emidev98/cosmwasm-lifecycle
module github.com/emidev98/lifecycle-hooks

go 1.19

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
syntax = "proto3";
package emidev98.cosmwasmlifecycle;
package emidev98.lifecycle_hooks;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "emidev98/cosmwasmlifecycle/execution_type.proto";
import "emidev98/lifecycle_hooks/execution_type.proto";

option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types";
option go_package = "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks/types";

// Contract defines the parameters for the module.
message Contract {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
syntax = "proto3";
package emidev98.cosmwasmlifecycle;
package emidev98.lifecycle_hooks;

import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "emidev98/cosmwasmlifecycle/execution_type.proto";
import "emidev98/lifecycle_hooks/execution_type.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types";
option go_package = "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks/types";

// This event is executed when a contract is registered using MsgRegisterContractProposal
message RegisterContractEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package emidev98.cosmwasmlifecycle;
package emidev98.lifecycle_hooks;

option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types";
option go_package = "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks/types";

enum ExecutionType {
BEGIN_BLOCK = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
syntax = "proto3";
package emidev98.cosmwasmlifecycle;
package emidev98.lifecycle_hooks;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "emidev98/cosmwasmlifecycle/params.proto";
import "emidev98/cosmwasmlifecycle/contract.proto";
import "emidev98/lifecycle_hooks/params.proto";
import "emidev98/lifecycle_hooks/contract.proto";

option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types";
option go_package = "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks/types";

// GenesisState defines the cosmwasmlifecycle module's genesis state.
// GenesisState defines the lifecycle_hooks module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
syntax = "proto3";
package emidev98.cosmwasmlifecycle;
package emidev98.lifecycle_hooks;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types";
option go_package = "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks/types";

// Params defines the parameters for the module.
message Params {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
syntax = "proto3";
package emidev98.cosmwasmlifecycle;
package emidev98.lifecycle_hooks;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "emidev98/cosmwasmlifecycle/params.proto";
import "emidev98/lifecycle_hooks/params.proto";

option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types";
option go_package = "github.com/emidev98/lifecycle-hooks/x/lifecycle-hooks/types";


// TODO: add remaining module query RPC methods
// Query defines the gRPC querier service.
service Query {
// Parameters queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/cosmwasmlifecycle/params";
option (google.api.http).get = "/lifecycle_hooks/params";
}
}

Expand Down
Loading

0 comments on commit aab8046

Please sign in to comment.