-
Notifications
You must be signed in to change notification settings - Fork 289
/
codec.go
34 lines (27 loc) · 1.08 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
34
package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/gov"
)
// ModuleCdc defines module codec
var ModuleCdc = codec.New()
// RegisterCodec registers all the necessary types and interfaces for
// governance.
func RegisterCodec(cdc *codec.Codec) {
cdc.RegisterInterface((*gov.Content)(nil), nil)
cdc.RegisterConcrete(gov.MsgSubmitProposal{}, "gov/MsgSubmitProposal", nil)
cdc.RegisterConcrete(gov.MsgDeposit{}, "gov/MsgDeposit", nil)
cdc.RegisterConcrete(gov.MsgVote{}, "gov/MsgVote", nil)
cdc.RegisterConcrete(gov.TextProposal{}, "gov/TextProposal", nil)
cdc.RegisterConcrete(gov.SoftwareUpgradeProposal{}, "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)
}