github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/evidence/internal/types/codec.go (about) 1 package types 2 3 import ( 4 "github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec" 5 "github.com/fibonacci-chain/fbc/x/evidence/exported" 6 ) 7 8 // ModuleCdc defines the evidence module's codec. The codec is not sealed as to 9 // allow other modules to register their concrete Evidence types. 10 var ModuleCdc = codec.New() 11 12 // RegisterCodec registers all the necessary types and interfaces for the 13 // evidence module. 14 func RegisterCodec(cdc *codec.Codec) { 15 cdc.RegisterInterface((*exported.Evidence)(nil), nil) 16 cdc.RegisterConcrete(MsgSubmitEvidence{}, "cosmos-sdk/MsgSubmitEvidence", nil) 17 cdc.RegisterConcrete(Equivocation{}, "cosmos-sdk/Equivocation", nil) 18 } 19 20 // RegisterEvidenceTypeCodec registers an external concrete Evidence type defined 21 // in another module for the internal ModuleCdc. This allows the MsgSubmitEvidence 22 // to be correctly Amino encoded and decoded. 23 func RegisterEvidenceTypeCodec(o interface{}, name string) { 24 ModuleCdc.RegisterConcrete(o, name, nil) 25 } 26 27 func init() { 28 RegisterCodec(ModuleCdc) 29 }