2018-10-05 03:41:38 -07: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-05-19 13:17:29 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/gov"
|
2018-10-05 03:41:38 -07:00
|
|
|
)
|
|
|
|
|
2020-02-18 04:50:13 -08:00
|
|
|
// RegisterCodec registers the necessary x/distribution interfaces and concrete types
|
|
|
|
// on the provided Amino codec. These types are used for Amino JSON serialization.
|
2018-10-05 03:41:38 -07:00
|
|
|
func RegisterCodec(cdc *codec.Codec) {
|
2020-06-03 12:52:05 -07:00
|
|
|
cdc.RegisterConcrete(&MsgWithdrawDelegatorReward{}, "cosmos-sdk/MsgWithdrawDelegationReward", nil)
|
|
|
|
cdc.RegisterConcrete(&MsgWithdrawValidatorCommission{}, "cosmos-sdk/MsgWithdrawValidatorCommission", nil)
|
|
|
|
cdc.RegisterConcrete(&MsgSetWithdrawAddress{}, "cosmos-sdk/MsgModifyWithdrawAddress", nil)
|
|
|
|
cdc.RegisterConcrete(&MsgFundCommunityPool{}, "cosmos-sdk/MsgFundCommunityPool", nil)
|
2020-04-14 12:05:14 -07:00
|
|
|
cdc.RegisterConcrete(&CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal", nil)
|
2018-10-05 03:41:38 -07:00
|
|
|
}
|
|
|
|
|
2020-05-19 13:17:29 -07:00
|
|
|
func RegisterInterfaces(registry types.InterfaceRegistry) {
|
|
|
|
registry.RegisterImplementations(
|
|
|
|
(*sdk.Msg)(nil),
|
|
|
|
&MsgWithdrawDelegatorReward{},
|
|
|
|
&MsgWithdrawValidatorCommission{},
|
|
|
|
&MsgSetWithdrawAddress{},
|
|
|
|
)
|
|
|
|
registry.RegisterImplementations(
|
|
|
|
(*gov.Content)(nil),
|
|
|
|
&CommunityPoolSpendProposal{},
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-02-18 04:50:13 -08:00
|
|
|
var (
|
|
|
|
amino = codec.New()
|
|
|
|
|
|
|
|
// ModuleCdc references the global x/distribution 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/distribution and
|
|
|
|
// defined at the application level.
|
2020-05-05 07:28:20 -07:00
|
|
|
ModuleCdc = codec.NewHybridCodec(amino, types.NewInterfaceRegistry())
|
2020-02-18 04:50:13 -08:00
|
|
|
)
|
2018-10-05 03:41:38 -07:00
|
|
|
|
|
|
|
func init() {
|
2020-02-18 04:50:13 -08:00
|
|
|
RegisterCodec(amino)
|
|
|
|
codec.RegisterCrypto(amino)
|
|
|
|
amino.Seal()
|
2018-10-05 03:41:38 -07:00
|
|
|
}
|