2019-06-05 16:26:17 -07:00
|
|
|
package types
|
2019-03-28 16:27:47 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
|
|
)
|
|
|
|
|
2020-02-11 06:58:37 -08:00
|
|
|
type Codec struct {
|
|
|
|
codec.Marshaler
|
|
|
|
|
|
|
|
// Keep reference to the amino codec to allow backwards compatibility along
|
|
|
|
// with type, and interface registration.
|
|
|
|
amino *codec.Codec
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewCodec(amino *codec.Codec) *Codec {
|
|
|
|
return &Codec{Marshaler: codec.NewHybridCodec(amino), amino: amino}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// RegisterCodec registers all the necessary crisis module concrete types and
|
|
|
|
// interfaces with the provided codec reference.
|
2019-03-28 16:27:47 -07:00
|
|
|
func RegisterCodec(cdc *codec.Codec) {
|
|
|
|
cdc.RegisterConcrete(MsgVerifyInvariant{}, "cosmos-sdk/MsgVerifyInvariant", nil)
|
|
|
|
}
|
|
|
|
|
2020-02-11 06:58:37 -08:00
|
|
|
// ModuleCdc defines a crisis module global Amino codec.
|
|
|
|
var ModuleCdc *Codec
|
2019-03-28 16:27:47 -07:00
|
|
|
|
|
|
|
func init() {
|
2020-02-11 06:58:37 -08:00
|
|
|
ModuleCdc = NewCodec(codec.New())
|
|
|
|
RegisterCodec(ModuleCdc.amino)
|
|
|
|
codec.RegisterCrypto(ModuleCdc.amino)
|
|
|
|
ModuleCdc.amino.Seal()
|
2019-03-28 16:27:47 -07:00
|
|
|
}
|