-
Notifications
You must be signed in to change notification settings - Fork 182
/
codec.go
33 lines (26 loc) · 1.05 KB
/
codec.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
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
)
// module codec
var ModuleCdc = codec.New()
// RegisterCodec registers all the necessary types and interfaces for
// governance.
func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterInterface((*Content)(nil), nil)
cdc.RegisterConcrete(MsgSubmitProposal{}, "okexchain/gov/MsgSubmitProposal", nil)
cdc.RegisterConcrete(MsgDeposit{}, "okexchain/gov/MsgDeposit", nil)
cdc.RegisterConcrete(MsgVote{}, "okexchain/gov/MsgVote", nil)
cdc.RegisterConcrete(TextProposal{}, "okexchain/gov/TextProposal", nil)
cdc.RegisterConcrete(SoftwareUpgradeProposal{}, "okexchain/gov/SoftwareUpgradeProposal", nil)
}
// RegisterProposalTypeCodec registers an external proposal content type defined
// in another module for the internal ModuleCdc. This allows the MsgSubmitProposal
// to be correctly Amino encoded and decoded.
func RegisterProposalTypeCodec(o interface{}, name string) {
ModuleCdc.RegisterConcrete(o, name, nil)
}
// TODO determine a good place to seal this codec
func init() {
RegisterCodec(ModuleCdc)
}