1d490ba4d9
* Adds AppModuleBasic implementation and genesis functions * Fixes broken links * Adds .idea/ * Adds starter for missing genesis funcs * Completes AppModuleBasic interface * Removes comment
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
package evm
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/cosmos/cosmos-sdk/client/context"
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
"github.com/cosmos/ethermint/x/evm/types"
|
|
"github.com/gorilla/mux"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// app module Basics object
|
|
type AppModuleBasic struct{}
|
|
|
|
func (AppModuleBasic) Name() string {
|
|
return types.ModuleName
|
|
}
|
|
|
|
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec) {
|
|
types.RegisterCodec(cdc)
|
|
}
|
|
|
|
func (AppModuleBasic) DefaultGenesis() json.RawMessage {
|
|
return types.ModuleCdc.MustMarshalJSON(DefaultGenesisState())
|
|
}
|
|
|
|
// Validation check of the Genesis
|
|
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error {
|
|
var data GenesisState
|
|
err := types.ModuleCdc.UnmarshalJSON(bz, &data)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// Once json successfully marshalled, passes along to genesis.go
|
|
return ValidateGenesis(data)
|
|
}
|
|
|
|
// Register rest routes
|
|
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router) {
|
|
//rpc.RegisterRoutes(ctx, rtr, StoreKey)
|
|
}
|
|
|
|
// Get the root query command of this module
|
|
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command {
|
|
return nil // cli.GetQueryCmd(StoreKey, cdc)
|
|
}
|
|
|
|
// Get the root tx command of this module
|
|
func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command {
|
|
return nil // cli.GetTxCmd(StoreKey, cdc)
|
|
}
|