Skip to content

Commit

Permalink
fix(x/ecocredit): add back allow denom legacy proposal type (#1595)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com>
  • Loading branch information
aleem1314 and ryanchristo authored Nov 10, 2022
1 parent 9ccfbdf commit c4c8dad
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 51 deletions.
67 changes: 35 additions & 32 deletions api/regen/ecocredit/marketplace/v1/types.pulsar.go

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

2 changes: 2 additions & 0 deletions proto/regen/ecocredit/marketplace/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package regen.ecocredit.marketplace.v1;

import "gogoproto/gogo.proto";
import "regen/ecocredit/marketplace/v1/state.proto";

option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/types/v1";
Expand All @@ -12,6 +13,7 @@ option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketpla
// Deprecated (Since Revision 1): This message is no longer used and will be
// removed in the next version. See MsgAddAllowedDenom.
message AllowDenomProposal {
option (gogoproto.goproto_stringer) = false;

// title is the title of the proposal.
string title = 1;
Expand Down
2 changes: 2 additions & 0 deletions x/ecocredit/marketplace/types/v1/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

func RegisterTypes(registry codectypes.InterfaceRegistry) {
registry.RegisterImplementations((*govv1beta1.Content)(nil), &AllowDenomProposal{})
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)
}

Expand Down
40 changes: 40 additions & 0 deletions x/ecocredit/marketplace/types/v1/msg_allowed_denom_proposal.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package v1

import (
"fmt"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

var _ govtypes.Content = &AllowDenomProposal{}

const (
AllowDenomProposalType = "AllowDenomProposal"
)

func init() {
govtypes.RegisterProposalType(AllowDenomProposalType)
}

func (m AllowDenomProposal) ProposalRoute() string { return "ecocredit" }

func (m AllowDenomProposal) ProposalType() string { return AllowDenomProposalType }

func (m AllowDenomProposal) ValidateBasic() error {
if m.Denom == nil {
return sdkerrors.ErrInvalidRequest.Wrap("denom cannot be empty")
}
if err := m.Denom.Validate(); err != nil {
return err
}
return govtypes.ValidateAbstract(&m)
}

func (m AllowDenomProposal) String() string {
return fmt.Sprintf(`Allow Denom Proposal:
Title: %s
Description: %s
Allowed Denom: %v
`, m.Title, m.Description, m.Denom)
}
39 changes: 20 additions & 19 deletions x/ecocredit/marketplace/types/v1/types.pb.go

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

0 comments on commit c4c8dad

Please sign in to comment.