Skip to content

Commit

Permalink
refactor: cleanup unused parts
Browse files Browse the repository at this point in the history
  • Loading branch information
amimart committed Jan 11, 2024
1 parent 50db96a commit 64e63b8
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 120 deletions.
2 changes: 1 addition & 1 deletion x/logic/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (AppModuleBasic) Name() string {
// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs
// to/from []byte in order to persist them in the module's KVStore.
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterCodec(cdc)
types.RegisterLegacyAminoCodec(cdc)
}

// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message.
Expand Down
34 changes: 8 additions & 26 deletions x/logic/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,24 @@ package types

import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)

func RegisterCodec(_ *codec.LegacyAmino) {
// RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(Params{}, "okp4/logic/Params", nil)
legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "okp4/logic/MsgUpdateParams")
}

func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
// RegisterInterfaces registers the interfaces types with the interface registry.
func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgUpdateParams{},
)

msgservice.RegisterMsgServiceDesc(registry, &_MsgService_serviceDesc)
}

var (
Amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry())
// AminoCdc is a amino codec created to support amino JSON compatible msgs.
AminoCdc = codec.NewAminoCodec(Amino)
)

const (
// Amino names.
updateParamsName = "okp4/logic/MsgUpdateParams"
)

// NOTE: This is required for the GetSignBytes function.
func init() {
RegisterLegacyAminoCodec(Amino)
Amino.Seal()
}

// RegisterLegacyAminoCodec required for EIP-712.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateParams{}, updateParamsName, nil)
}
29 changes: 0 additions & 29 deletions x/logic/types/msg.go

This file was deleted.

5 changes: 0 additions & 5 deletions x/mint/migrations/v3/types/minter.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion x/mint/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ func (AppModuleBasic) Name() string {
}

// RegisterLegacyAminoCodec registers the mint module's types on the given LegacyAmino codec.
func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {}
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterLegacyAminoCodec(cdc)
}

// RegisterInterfaces registers the module's interface types.
func (b AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
Expand Down
36 changes: 8 additions & 28 deletions x/mint/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,24 @@ package types

import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)

var (
amino = codec.NewLegacyAmino()
// ModuleCdc references the global evm module codec. Note, the codec should
// ONLY be used in certain instances of tests and for JSON encoding.
ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())

// AminoCdc is a amino codec created to support amino JSON compatible msgs.
AminoCdc = codec.NewAminoCodec(amino)
)

func init() {
cryptocodec.RegisterCrypto(amino)
RegisterLegacyAminoCodec(amino)
amino.Seal()
// RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(Params{}, "okp4/mint/Params", nil)
legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "okp4/mint/MsgUpdateParams")
}

const (
// Amino names.
updateParamsName = "okp4/mint/MsgUpdateParams"
)

// RegisterInterfaces register implementations.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
// RegisterInterfaces registers the interfaces types with the interface registry.
func RegisterInterfaces(registry types.InterfaceRegistry) {
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgUpdateParams{},
)

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

// RegisterLegacyAminoCodec required for EIP-712.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgUpdateParams{}, updateParamsName, nil)
}
29 changes: 0 additions & 29 deletions x/mint/types/msg.go

This file was deleted.

2 changes: 1 addition & 1 deletion x/vesting/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
)

registry.RegisterImplementations(
(*authtypes.AccountI)(nil),
(*sdk.AccountI)(nil),
&BaseVestingAccount{},
&DelayedVestingAccount{},
&ContinuousVestingAccount{},
Expand Down

0 comments on commit 64e63b8

Please sign in to comment.