Skip to content

Commit

Permalink
remove useless implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Feb 20, 2024
1 parent 810553b commit e2c3600
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 321 deletions.
17 changes: 0 additions & 17 deletions x/collection/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
)
Expand Down Expand Up @@ -56,19 +55,3 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {

msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

var (
amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewAminoCodec(amino)
)

func init() {
cryptocodec.RegisterCrypto(amino)
// TODO: check, Can i remove commented out code?

//// Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be
//// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
// RegisterLegacyAminoCodec(authzcodec.Amino)
// RegisterLegacyAminoCodec(govcodec.Amino)
// RegisterLegacyAminoCodec(fdncodec.Amino)
}
3 changes: 0 additions & 3 deletions x/collection/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,4 @@ const (

// StoreKey defines the primary module store key
StoreKey = ModuleName

// RouterKey defines the module's message routing key
RouterKey = ModuleName
)
276 changes: 0 additions & 276 deletions x/collection/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ func canonicalKey(key string) string {
return key
}

var _ sdk.Msg = (*MsgSendNFT)(nil)

// ValidateBasic implements Msg.
func (m MsgSendNFT) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand All @@ -221,29 +219,6 @@ func (m MsgSendNFT) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgSendNFT) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.From)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgSendNFT) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgSendNFT) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgSendNFT) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgOperatorSendNFT)(nil)

// ValidateBasic implements Msg.
func (m MsgOperatorSendNFT) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand Down Expand Up @@ -272,29 +247,6 @@ func (m MsgOperatorSendNFT) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgOperatorSendNFT) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.Operator)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgOperatorSendNFT) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgOperatorSendNFT) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgOperatorSendNFT) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgAuthorizeOperator)(nil)

// ValidateBasic implements Msg.
func (m MsgAuthorizeOperator) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand All @@ -315,29 +267,6 @@ func (m MsgAuthorizeOperator) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgAuthorizeOperator) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.Holder)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgAuthorizeOperator) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgAuthorizeOperator) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgAuthorizeOperator) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgRevokeOperator)(nil)

// ValidateBasic implements Msg.
func (m MsgRevokeOperator) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand All @@ -358,29 +287,6 @@ func (m MsgRevokeOperator) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgRevokeOperator) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.Holder)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgRevokeOperator) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgRevokeOperator) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgRevokeOperator) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgCreateContract)(nil)

// ValidateBasic implements Msg.
func (m MsgCreateContract) ValidateBasic() error {
if _, err := sdk.AccAddressFromBech32(m.Owner); err != nil {
Expand All @@ -402,29 +308,6 @@ func (m MsgCreateContract) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgCreateContract) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.Owner)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgCreateContract) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgCreateContract) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgCreateContract) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgIssueNFT)(nil)

// ValidateBasic implements Msg.
func (m MsgIssueNFT) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand All @@ -446,29 +329,6 @@ func (m MsgIssueNFT) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgIssueNFT) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.Owner)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgIssueNFT) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgIssueNFT) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgIssueNFT) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgMintNFT)(nil)

// ValidateBasic implements Msg.
func (m MsgMintNFT) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand Down Expand Up @@ -506,29 +366,6 @@ func (m MsgMintNFT) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgMintNFT) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.From)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgMintNFT) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgMintNFT) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgMintNFT) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgBurnNFT)(nil)

// ValidateBasic implements Msg.
func (m MsgBurnNFT) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand All @@ -551,29 +388,6 @@ func (m MsgBurnNFT) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgBurnNFT) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.From)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgBurnNFT) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgBurnNFT) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgBurnNFT) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgOperatorBurnNFT)(nil)

// ValidateBasic implements Msg.
func (m MsgOperatorBurnNFT) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand All @@ -599,29 +413,6 @@ func (m MsgOperatorBurnNFT) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgOperatorBurnNFT) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.Operator)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgOperatorBurnNFT) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgOperatorBurnNFT) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgOperatorBurnNFT) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgModify)(nil)

// ValidateBasic implements Msg.
func (m MsgModify) ValidateBasic() error {
UpdateMsgModify(&m)
Expand Down Expand Up @@ -696,29 +487,6 @@ func UpdateMsgModify(msg *MsgModify) {
}
}

// GetSigners implements Msg
func (m MsgModify) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.Owner)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgModify) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgModify) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgModify) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgGrantPermission)(nil)

// ValidateBasic implements Msg.
func (m MsgGrantPermission) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand All @@ -739,29 +507,6 @@ func (m MsgGrantPermission) ValidateBasic() error {
return nil
}

// GetSigners implements Msg
func (m MsgGrantPermission) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.From)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgGrantPermission) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgGrantPermission) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgGrantPermission) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgRevokePermission)(nil)

// ValidateBasic implements Msg.
func (m MsgRevokePermission) ValidateBasic() error {
if err := ValidateContractID(m.ContractId); err != nil {
Expand All @@ -778,24 +523,3 @@ func (m MsgRevokePermission) ValidateBasic() error {

return nil
}

// GetSigners implements Msg
func (m MsgRevokePermission) GetSigners() []sdk.AccAddress {
signer, _ := sdk.AccAddressFromBech32(m.From)
return []sdk.AccAddress{signer}
}

// Type implements the LegacyMsg.Type method.
func (m MsgRevokePermission) Type() string {
return sdk.MsgTypeURL(&m)
}

// Route implements the LegacyMsg.Route method.
func (m MsgRevokePermission) Route() string {
return RouterKey
}

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgRevokePermission) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
}
Loading

0 comments on commit e2c3600

Please sign in to comment.