|
| 1 | +package evm |
| 2 | + |
| 3 | +import ( |
| 4 | + "encoding/json" |
| 5 | + "github.com/cosmos/cosmos-sdk/client/context" |
| 6 | + "github.com/cosmos/cosmos-sdk/codec" |
| 7 | + "github.com/cosmos/ethermint/x/evm/types" |
| 8 | + "github.com/gorilla/mux" |
| 9 | + "github.com/spf13/cobra" |
| 10 | +) |
| 11 | + |
| 12 | +// app module Basics object |
| 13 | +type AppModuleBasic struct{} |
| 14 | + |
| 15 | +func (AppModuleBasic) Name() string { |
| 16 | + return types.ModuleName |
| 17 | +} |
| 18 | + |
| 19 | +func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) { |
| 20 | + types.RegisterCodec(cdc) |
| 21 | +} |
| 22 | + |
| 23 | +func (AppModuleBasic) DefaultGenesis() json.RawMessage { |
| 24 | + return types.ModuleCdc.MustMarshalJSON(DefaultGenesisState()) |
| 25 | +} |
| 26 | + |
| 27 | +// Validation check of the Genesis |
| 28 | +func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error { |
| 29 | + var data GenesisState |
| 30 | + err := types.ModuleCdc.UnmarshalJSON(bz, &data) |
| 31 | + if err != nil { |
| 32 | + return err |
| 33 | + } |
| 34 | + // Once json successfully marshalled, passes along to genesis.go |
| 35 | + return ValidateGenesis(data) |
| 36 | +} |
| 37 | + |
| 38 | +// Register rest routes |
| 39 | +func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router) { |
| 40 | + //rpc.RegisterRoutes(ctx, rtr, StoreKey) |
| 41 | +} |
| 42 | + |
| 43 | +// Get the root query command of this module |
| 44 | +func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command { |
| 45 | + return nil // cli.GetQueryCmd(StoreKey, cdc) |
| 46 | +} |
| 47 | + |
| 48 | +// Get the root tx command of this module |
| 49 | +func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command { |
| 50 | + return nil // cli.GetTxCmd(StoreKey, cdc) |
| 51 | +} |
0 commit comments