2020-02-24 08:05:21 -08:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2020-05-05 07:28:20 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
2020-06-04 03:38:24 -07:00
|
|
|
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
2020-05-05 07:28:20 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2020-02-24 08:05:21 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/evidence/exported"
|
|
|
|
)
|
|
|
|
|
|
|
|
// RegisterCodec registers all the necessary types and interfaces for the
|
|
|
|
// evidence module.
|
|
|
|
func RegisterCodec(cdc *codec.Codec) {
|
|
|
|
cdc.RegisterInterface((*exported.Evidence)(nil), nil)
|
2020-06-03 12:52:05 -07:00
|
|
|
cdc.RegisterConcrete(&MsgSubmitEvidence{}, "cosmos-sdk/MsgSubmitEvidence", nil)
|
2020-05-05 07:28:20 -07:00
|
|
|
cdc.RegisterConcrete(&Equivocation{}, "cosmos-sdk/Equivocation", nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
|
|
|
registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSubmitEvidence{})
|
|
|
|
registry.RegisterInterface(
|
|
|
|
"cosmos_sdk.evidence.v1.Evidence",
|
|
|
|
(*exported.Evidence)(nil),
|
|
|
|
&Equivocation{},
|
|
|
|
)
|
2020-02-24 08:05:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
amino = codec.New()
|
|
|
|
|
|
|
|
// ModuleCdc references the global x/evidence module codec. Note, the codec should
|
|
|
|
// ONLY be used in certain instances of tests and for JSON encoding as Amino is
|
|
|
|
// still used for that purpose.
|
|
|
|
//
|
|
|
|
// The actual codec used for serialization should be provided to x/evidence and
|
|
|
|
// defined at the application level.
|
2020-05-05 07:28:20 -07:00
|
|
|
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
|
2020-02-24 08:05:21 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
RegisterCodec(amino)
|
2020-06-04 03:38:24 -07:00
|
|
|
cryptocodec.RegisterCrypto(amino)
|
2020-02-24 08:05:21 -08:00
|
|
|
amino.Seal()
|
|
|
|
}
|