github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/x/gov/types/codec.go (about)

     1  package types
     2  
     3  import (
     4  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/codec"
     5  )
     6  
     7  // module codec
     8  var ModuleCdc = codec.New()
     9  
    10  // RegisterCodec registers all the necessary types and interfaces for
    11  // governance.
    12  func RegisterCodec(cdc *codec.Codec) {
    13  	cdc.RegisterInterface((*Content)(nil), nil)
    14  
    15  	cdc.RegisterConcrete(MsgSubmitProposal{}, "fbexchain/gov/MsgSubmitProposal", nil)
    16  	cdc.RegisterConcrete(MsgDeposit{}, "fbexchain/gov/MsgDeposit", nil)
    17  	cdc.RegisterConcrete(MsgVote{}, "fbexchain/gov/MsgVote", nil)
    18  
    19  	cdc.RegisterConcrete(TextProposal{}, "fbexchain/gov/TextProposal", nil)
    20  	cdc.RegisterConcrete(SoftwareUpgradeProposal{}, "fbexchain/gov/SoftwareUpgradeProposal", nil)
    21  }
    22  
    23  // RegisterProposalTypeCodec registers an external proposal content type defined
    24  // in another module for the internal ModuleCdc. This allows the MsgSubmitProposal
    25  // to be correctly Amino encoded and decoded.
    26  func RegisterProposalTypeCodec(o interface{}, name string) {
    27  	ModuleCdc.RegisterConcrete(o, name, nil)
    28  }
    29  
    30  // TODO determine a good place to seal this codec
    31  func init() {
    32  	RegisterCodec(ModuleCdc)
    33  }