-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.go
48 lines (37 loc) · 1.39 KB
/
module.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package basic
import (
"encoding/json"
"github.com/ci123chain/ci123chain/pkg/abci/codec"
codectypes "github.com/ci123chain/ci123chain/pkg/abci/codec/types"
client "github.com/ci123chain/ci123chain/pkg/client/context"
"github.com/ci123chain/ci123chain/pkg/vm/evmtypes"
"github.com/ci123chain/ci123chain/pkg/vm/moduletypes"
"github.com/ci123chain/ci123chain/pkg/vm/wasmtypes"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
tmtypes "github.com/tendermint/tendermint/types"
)
type AppModuleBasic struct {}
func (am AppModuleBasic) RegisterCodec(codec *codec.Codec) {
types.RegisterCodec(codec)
evmtypes.RegisterCodec(codec)
}
func (am AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) {
return
}
func (am AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {}
func (am AppModuleBasic) Name() string {
return moduletypes.ModuleName
}
// DefaultGenesis is json default structure
func (am AppModuleBasic) DefaultGenesis(vals []tmtypes.GenesisValidator) json.RawMessage {
return evmtypes.ModuleCdc.MustMarshalJSON(evmtypes.DefaultGenesisState())
}
// ValidateGenesis is the validation check of the Genesis
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error {
var genesisState evmtypes.GenesisState
err := evmtypes.ModuleCdc.UnmarshalJSON(bz, &genesisState)
if err != nil {
return err
}
return genesisState.Validate()
}