diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e029d7863..499966f818 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### app +### x/ecocredit + +#### API Breaking Changes + +- [#1342](https://github.com/regen-network/regen-ledger/pull/1342) The `NewKeeper` method in `ecocredit/marketplace` requires an `authority` address. +- [#1342](https://github.com/regen-network/regen-ledger/pull/1342) Removed `AllowedDenom` proposal handler. + +#### Added + +- [#1337](https://github.com/regen-network/regen-ledger/pull/1342) `AddAllowedDenom` is added for msg-based gov proposal. + + #### Removed - [#1258](https://github.com/regen-network/regen-ledger/pull/1258) Remove group module from experimental config diff --git a/api/regen/ecocredit/marketplace/v1/tx.pulsar.go b/api/regen/ecocredit/marketplace/v1/tx.pulsar.go index be243fd42c..82837d9518 100644 --- a/api/regen/ecocredit/marketplace/v1/tx.pulsar.go +++ b/api/regen/ecocredit/marketplace/v1/tx.pulsar.go @@ -601,7 +601,7 @@ func (x *MsgSell_Order) ProtoReflect() protoreflect.Message { } func (x *MsgSell_Order) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[8] + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2391,7 +2391,7 @@ func (x *MsgUpdateSellOrders_Update) ProtoReflect() protoreflect.Message { } func (x *MsgUpdateSellOrders_Update) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[9] + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4809,7 +4809,7 @@ func (x *MsgBuyDirect_Order) ProtoReflect() protoreflect.Message { } func (x *MsgBuyDirect_Order) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[10] + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5802,169 +5802,1121 @@ func (x *fastReflection_MsgBuyDirectResponse) ProtoMethods() *protoiface.Methods } } -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: regen/ecocredit/marketplace/v1/tx.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +var ( + md_MsgAddAllowedDenom protoreflect.MessageDescriptor + fd_MsgAddAllowedDenom_authority protoreflect.FieldDescriptor + fd_MsgAddAllowedDenom_bank_denom protoreflect.FieldDescriptor + fd_MsgAddAllowedDenom_display_denom protoreflect.FieldDescriptor + fd_MsgAddAllowedDenom_exponent protoreflect.FieldDescriptor ) -// MsgSell is the Msg/Sell request type. -type MsgSell struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func init() { + file_regen_ecocredit_marketplace_v1_tx_proto_init() + md_MsgAddAllowedDenom = File_regen_ecocredit_marketplace_v1_tx_proto.Messages().ByName("MsgAddAllowedDenom") + fd_MsgAddAllowedDenom_authority = md_MsgAddAllowedDenom.Fields().ByName("authority") + fd_MsgAddAllowedDenom_bank_denom = md_MsgAddAllowedDenom.Fields().ByName("bank_denom") + fd_MsgAddAllowedDenom_display_denom = md_MsgAddAllowedDenom.Fields().ByName("display_denom") + fd_MsgAddAllowedDenom_exponent = md_MsgAddAllowedDenom.Fields().ByName("exponent") +} - // seller is the address of the account that is selling credits. - Seller string `protobuf:"bytes,1,opt,name=seller,proto3" json:"seller,omitempty"` - // orders are the sell orders being created. - Orders []*MsgSell_Order `protobuf:"bytes,2,rep,name=orders,proto3" json:"orders,omitempty"` +var _ protoreflect.Message = (*fastReflection_MsgAddAllowedDenom)(nil) + +type fastReflection_MsgAddAllowedDenom MsgAddAllowedDenom + +func (x *MsgAddAllowedDenom) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgAddAllowedDenom)(x) } -func (x *MsgSell) Reset() { - *x = MsgSell{} - if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[0] +func (x *MsgAddAllowedDenom) slowProtoReflect() protoreflect.Message { + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } + return mi.MessageOf(x) } -func (x *MsgSell) String() string { - return protoimpl.X.MessageStringOf(x) -} +var _fastReflection_MsgAddAllowedDenom_messageType fastReflection_MsgAddAllowedDenom_messageType +var _ protoreflect.MessageType = fastReflection_MsgAddAllowedDenom_messageType{} -func (*MsgSell) ProtoMessage() {} +type fastReflection_MsgAddAllowedDenom_messageType struct{} -// Deprecated: Use MsgSell.ProtoReflect.Descriptor instead. -func (*MsgSell) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{0} +func (x fastReflection_MsgAddAllowedDenom_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgAddAllowedDenom)(nil) } - -func (x *MsgSell) GetSeller() string { - if x != nil { - return x.Seller - } - return "" +func (x fastReflection_MsgAddAllowedDenom_messageType) New() protoreflect.Message { + return new(fastReflection_MsgAddAllowedDenom) } - -func (x *MsgSell) GetOrders() []*MsgSell_Order { - if x != nil { - return x.Orders - } - return nil +func (x fastReflection_MsgAddAllowedDenom_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddAllowedDenom } -// MsgSellResponse is the Msg/Sell response type. -type MsgSellResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // sell_order_ids are the sell order IDs of the newly created sell orders. - SellOrderIds []uint64 `protobuf:"varint,1,rep,packed,name=sell_order_ids,json=sellOrderIds,proto3" json:"sell_order_ids,omitempty"` +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgAddAllowedDenom) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddAllowedDenom } -func (x *MsgSellResponse) Reset() { - *x = MsgSellResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgAddAllowedDenom) Type() protoreflect.MessageType { + return _fastReflection_MsgAddAllowedDenom_messageType } -func (x *MsgSellResponse) String() string { - return protoimpl.X.MessageStringOf(x) +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgAddAllowedDenom) New() protoreflect.Message { + return new(fastReflection_MsgAddAllowedDenom) } -func (*MsgSellResponse) ProtoMessage() {} - -// Deprecated: Use MsgSellResponse.ProtoReflect.Descriptor instead. -func (*MsgSellResponse) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{1} +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgAddAllowedDenom) Interface() protoreflect.ProtoMessage { + return (*MsgAddAllowedDenom)(x) } -func (x *MsgSellResponse) GetSellOrderIds() []uint64 { - if x != nil { - return x.SellOrderIds +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgAddAllowedDenom) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgAddAllowedDenom_authority, value) { + return + } + } + if x.BankDenom != "" { + value := protoreflect.ValueOfString(x.BankDenom) + if !f(fd_MsgAddAllowedDenom_bank_denom, value) { + return + } + } + if x.DisplayDenom != "" { + value := protoreflect.ValueOfString(x.DisplayDenom) + if !f(fd_MsgAddAllowedDenom_display_denom, value) { + return + } + } + if x.Exponent != uint32(0) { + value := protoreflect.ValueOfUint32(x.Exponent) + if !f(fd_MsgAddAllowedDenom_exponent, value) { + return + } } - return nil -} - -// MsgUpdateSellOrders is the Msg/UpdateSellOrders request type. -type MsgUpdateSellOrders struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // seller is the address of the account that is selling credits. - Seller string `protobuf:"bytes,1,opt,name=seller,proto3" json:"seller,omitempty"` - // updates are updates to existing sell orders. - Updates []*MsgUpdateSellOrders_Update `protobuf:"bytes,2,rep,name=updates,proto3" json:"updates,omitempty"` } -func (x *MsgUpdateSellOrders) Reset() { - *x = MsgUpdateSellOrders{} - if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgAddAllowedDenom) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.authority": + return x.Authority != "" + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.bank_denom": + return x.BankDenom != "" + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.display_denom": + return x.DisplayDenom != "" + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.exponent": + return x.Exponent != uint32(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenom")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom does not contain field %s", fd.FullName())) } } -func (x *MsgUpdateSellOrders) String() string { - return protoimpl.X.MessageStringOf(x) +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddAllowedDenom) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.authority": + x.Authority = "" + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.bank_denom": + x.BankDenom = "" + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.display_denom": + x.DisplayDenom = "" + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.exponent": + x.Exponent = uint32(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenom")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom does not contain field %s", fd.FullName())) + } } -func (*MsgUpdateSellOrders) ProtoMessage() {} - -// Deprecated: Use MsgUpdateSellOrders.ProtoReflect.Descriptor instead. -func (*MsgUpdateSellOrders) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{2} +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgAddAllowedDenom) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.bank_denom": + value := x.BankDenom + return protoreflect.ValueOfString(value) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.display_denom": + value := x.DisplayDenom + return protoreflect.ValueOfString(value) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.exponent": + value := x.Exponent + return protoreflect.ValueOfUint32(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenom")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom does not contain field %s", descriptor.FullName())) + } } -func (x *MsgUpdateSellOrders) GetSeller() string { - if x != nil { - return x.Seller +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddAllowedDenom) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.authority": + x.Authority = value.Interface().(string) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.bank_denom": + x.BankDenom = value.Interface().(string) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.display_denom": + x.DisplayDenom = value.Interface().(string) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.exponent": + x.Exponent = uint32(value.Uint()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenom")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom does not contain field %s", fd.FullName())) } - return "" } -func (x *MsgUpdateSellOrders) GetUpdates() []*MsgUpdateSellOrders_Update { - if x != nil { - return x.Updates +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddAllowedDenom) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.authority": + panic(fmt.Errorf("field authority of message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom is not mutable")) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.bank_denom": + panic(fmt.Errorf("field bank_denom of message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom is not mutable")) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.display_denom": + panic(fmt.Errorf("field display_denom of message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom is not mutable")) + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.exponent": + panic(fmt.Errorf("field exponent of message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenom")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom does not contain field %s", fd.FullName())) } - return nil } -// MsgUpdateSellOrdersResponse is the Msg/UpdateSellOrders response type. -type MsgUpdateSellOrdersResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgAddAllowedDenom) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.authority": + return protoreflect.ValueOfString("") + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.bank_denom": + return protoreflect.ValueOfString("") + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.display_denom": + return protoreflect.ValueOfString("") + case "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom.exponent": + return protoreflect.ValueOfUint32(uint32(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenom")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenom does not contain field %s", fd.FullName())) + } } -func (x *MsgUpdateSellOrdersResponse) Reset() { - *x = MsgUpdateSellOrdersResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgAddAllowedDenom) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.marketplace.v1.MsgAddAllowedDenom", d.FullName())) } + panic("unreachable") } -func (x *MsgUpdateSellOrdersResponse) String() string { - return protoimpl.X.MessageStringOf(x) +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgAddAllowedDenom) GetUnknown() protoreflect.RawFields { + return x.unknownFields } -func (*MsgUpdateSellOrdersResponse) ProtoMessage() {} +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddAllowedDenom) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgAddAllowedDenom) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgAddAllowedDenom) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgAddAllowedDenom) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.BankDenom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.DisplayDenom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Exponent != 0 { + n += 1 + runtime.Sov(uint64(x.Exponent)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgAddAllowedDenom) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if x.Exponent != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Exponent)) + i-- + dAtA[i] = 0x20 + } + if len(x.DisplayDenom) > 0 { + i -= len(x.DisplayDenom) + copy(dAtA[i:], x.DisplayDenom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DisplayDenom))) + i-- + dAtA[i] = 0x1a + } + if len(x.BankDenom) > 0 { + i -= len(x.BankDenom) + copy(dAtA[i:], x.BankDenom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.BankDenom))) + i-- + dAtA[i] = 0x12 + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgAddAllowedDenom) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddAllowedDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddAllowedDenom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BankDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.BankDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DisplayDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.DisplayDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + } + x.Exponent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.Exponent |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgAddAllowedDenomResponse protoreflect.MessageDescriptor +) + +func init() { + file_regen_ecocredit_marketplace_v1_tx_proto_init() + md_MsgAddAllowedDenomResponse = File_regen_ecocredit_marketplace_v1_tx_proto.Messages().ByName("MsgAddAllowedDenomResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgAddAllowedDenomResponse)(nil) + +type fastReflection_MsgAddAllowedDenomResponse MsgAddAllowedDenomResponse + +func (x *MsgAddAllowedDenomResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgAddAllowedDenomResponse)(x) +} + +func (x *MsgAddAllowedDenomResponse) slowProtoReflect() protoreflect.Message { + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_MsgAddAllowedDenomResponse_messageType fastReflection_MsgAddAllowedDenomResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgAddAllowedDenomResponse_messageType{} + +type fastReflection_MsgAddAllowedDenomResponse_messageType struct{} + +func (x fastReflection_MsgAddAllowedDenomResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgAddAllowedDenomResponse)(nil) +} +func (x fastReflection_MsgAddAllowedDenomResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgAddAllowedDenomResponse) +} +func (x fastReflection_MsgAddAllowedDenomResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddAllowedDenomResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgAddAllowedDenomResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgAddAllowedDenomResponse +} + +// Type returns the message type, which encapsulates both Go and protobuf +// type information. If the Go type information is not needed, +// it is recommended that the message descriptor be used instead. +func (x *fastReflection_MsgAddAllowedDenomResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgAddAllowedDenomResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgAddAllowedDenomResponse) New() protoreflect.Message { + return new(fastReflection_MsgAddAllowedDenomResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgAddAllowedDenomResponse) Interface() protoreflect.ProtoMessage { + return (*MsgAddAllowedDenomResponse)(x) +} + +// Range iterates over every populated field in an undefined order, +// calling f for each field descriptor and value encountered. +// Range returns immediately if f returns false. +// While iterating, mutating operations may only be performed +// on the current field descriptor. +func (x *fastReflection_MsgAddAllowedDenomResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgAddAllowedDenomResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse does not contain field %s", fd.FullName())) + } +} + +// Clear clears the field such that a subsequent Has call reports false. +// +// Clearing an extension field clears both the extension type and value +// associated with the given field number. +// +// Clear is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddAllowedDenomResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse does not contain field %s", fd.FullName())) + } +} + +// Get retrieves the value for a field. +// +// For unpopulated scalars, it returns the default value, where +// the default value of a bytes scalar is guaranteed to be a copy. +// For unpopulated composite types, it returns an empty, read-only view +// of the value; to obtain a mutable reference, use Mutable. +func (x *fastReflection_MsgAddAllowedDenomResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse does not contain field %s", descriptor.FullName())) + } +} + +// Set stores the value for a field. +// +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType. +// When setting a composite type, it is unspecified whether the stored value +// aliases the source's memory in any way. If the composite value is an +// empty, read-only value, then it panics. +// +// Set is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddAllowedDenomResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse does not contain field %s", fd.FullName())) + } +} + +// Mutable returns a mutable reference to a composite type. +// +// If the field is unpopulated, it may allocate a composite value. +// For a field belonging to a oneof, it implicitly clears any other field +// that may be currently set within the same oneof. +// For extension fields, it implicitly stores the provided ExtensionType +// if not already stored. +// It panics if the field does not contain a composite type. +// +// Mutable is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddAllowedDenomResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse does not contain field %s", fd.FullName())) + } +} + +// NewField returns a new value that is assignable to the field +// for the given descriptor. For scalars, this returns the default value. +// For lists, maps, and messages, this returns a new, empty, mutable value. +func (x *fastReflection_MsgAddAllowedDenomResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse does not contain field %s", fd.FullName())) + } +} + +// WhichOneof reports which field within the oneof is populated, +// returning nil if none are populated. +// It panics if the oneof descriptor does not belong to this message. +func (x *fastReflection_MsgAddAllowedDenomResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse", d.FullName())) + } + panic("unreachable") +} + +// GetUnknown retrieves the entire list of unknown fields. +// The caller may only mutate the contents of the RawFields +// if the mutated bytes are stored back into the message with SetUnknown. +func (x *fastReflection_MsgAddAllowedDenomResponse) GetUnknown() protoreflect.RawFields { + return x.unknownFields +} + +// SetUnknown stores an entire list of unknown fields. +// The raw fields must be syntactically valid according to the wire format. +// An implementation may panic if this is not the case. +// Once stored, the caller must not mutate the content of the RawFields. +// An empty RawFields may be passed to clear the fields. +// +// SetUnknown is a mutating operation and unsafe for concurrent use. +func (x *fastReflection_MsgAddAllowedDenomResponse) SetUnknown(fields protoreflect.RawFields) { + x.unknownFields = fields +} + +// IsValid reports whether the message is valid. +// +// An invalid message is an empty, read-only value. +// +// An invalid message often corresponds to a nil pointer of the concrete +// message type, but the details are implementation dependent. +// Validity is not part of the protobuf data model, and may not +// be preserved in marshaling or other operations. +func (x *fastReflection_MsgAddAllowedDenomResponse) IsValid() bool { + return x != nil +} + +// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. +// This method may return nil. +// +// The returned methods type is identical to +// "google.golang.org/protobuf/runtime/protoiface".Methods. +// Consult the protoiface package documentation for details. +func (x *fastReflection_MsgAddAllowedDenomResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgAddAllowedDenomResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgAddAllowedDenomResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgAddAllowedDenomResponse) + if x == nil { + return protoiface.UnmarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Flags: input.Flags, + }, nil + } + options := runtime.UnmarshalInputToOptions(input) + _ = options + dAtA := input.Buf + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddAllowedDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgAddAllowedDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: regen/ecocredit/marketplace/v1/tx.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// MsgSell is the Msg/Sell request type. +type MsgSell struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // seller is the address of the account that is selling credits. + Seller string `protobuf:"bytes,1,opt,name=seller,proto3" json:"seller,omitempty"` + // orders are the sell orders being created. + Orders []*MsgSell_Order `protobuf:"bytes,2,rep,name=orders,proto3" json:"orders,omitempty"` +} + +func (x *MsgSell) Reset() { + *x = MsgSell{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSell) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSell) ProtoMessage() {} + +// Deprecated: Use MsgSell.ProtoReflect.Descriptor instead. +func (*MsgSell) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *MsgSell) GetSeller() string { + if x != nil { + return x.Seller + } + return "" +} + +func (x *MsgSell) GetOrders() []*MsgSell_Order { + if x != nil { + return x.Orders + } + return nil +} + +// MsgSellResponse is the Msg/Sell response type. +type MsgSellResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // sell_order_ids are the sell order IDs of the newly created sell orders. + SellOrderIds []uint64 `protobuf:"varint,1,rep,packed,name=sell_order_ids,json=sellOrderIds,proto3" json:"sell_order_ids,omitempty"` +} + +func (x *MsgSellResponse) Reset() { + *x = MsgSellResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgSellResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgSellResponse) ProtoMessage() {} + +// Deprecated: Use MsgSellResponse.ProtoReflect.Descriptor instead. +func (*MsgSellResponse) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{1} +} + +func (x *MsgSellResponse) GetSellOrderIds() []uint64 { + if x != nil { + return x.SellOrderIds + } + return nil +} + +// MsgUpdateSellOrders is the Msg/UpdateSellOrders request type. +type MsgUpdateSellOrders struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // seller is the address of the account that is selling credits. + Seller string `protobuf:"bytes,1,opt,name=seller,proto3" json:"seller,omitempty"` + // updates are updates to existing sell orders. + Updates []*MsgUpdateSellOrders_Update `protobuf:"bytes,2,rep,name=updates,proto3" json:"updates,omitempty"` +} + +func (x *MsgUpdateSellOrders) Reset() { + *x = MsgUpdateSellOrders{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateSellOrders) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateSellOrders) ProtoMessage() {} + +// Deprecated: Use MsgUpdateSellOrders.ProtoReflect.Descriptor instead. +func (*MsgUpdateSellOrders) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgUpdateSellOrders) GetSeller() string { + if x != nil { + return x.Seller + } + return "" +} + +func (x *MsgUpdateSellOrders) GetUpdates() []*MsgUpdateSellOrders_Update { + if x != nil { + return x.Updates + } + return nil +} + +// MsgUpdateSellOrdersResponse is the Msg/UpdateSellOrders response type. +type MsgUpdateSellOrdersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgUpdateSellOrdersResponse) Reset() { + *x = MsgUpdateSellOrdersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgUpdateSellOrdersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgUpdateSellOrdersResponse) ProtoMessage() {} // Deprecated: Use MsgUpdateSellOrdersResponse.ProtoReflect.Descriptor instead. func (*MsgUpdateSellOrdersResponse) Descriptor() ([]byte, []int) { @@ -6118,6 +7070,102 @@ func (*MsgBuyDirectResponse) Descriptor() ([]byte, []int) { return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{7} } +// MsgAddAllowedDenom is the Msg/AddAllowedDenom request type. +// Since Revision 1 +type MsgAddAllowedDenom struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // denom is the bank denom to allow (ex. ibc/GLKHDSG423SGS) + BankDenom string `protobuf:"bytes,2,opt,name=bank_denom,json=bankDenom,proto3" json:"bank_denom,omitempty"` + // display_denom is the denom to display to the user and is informational. + // Because the denom is likely an IBC denom, this should be chosen by + // governance to represent the consensus trusted name of the denom. + DisplayDenom string `protobuf:"bytes,3,opt,name=display_denom,json=displayDenom,proto3" json:"display_denom,omitempty"` + // exponent is the exponent that relates the denom to the display_denom and is + // informational + Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"` +} + +func (x *MsgAddAllowedDenom) Reset() { + *x = MsgAddAllowedDenom{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgAddAllowedDenom) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgAddAllowedDenom) ProtoMessage() {} + +// Deprecated: Use MsgAddAllowedDenom.ProtoReflect.Descriptor instead. +func (*MsgAddAllowedDenom) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{8} +} + +func (x *MsgAddAllowedDenom) GetAuthority() string { + if x != nil { + return x.Authority + } + return "" +} + +func (x *MsgAddAllowedDenom) GetBankDenom() string { + if x != nil { + return x.BankDenom + } + return "" +} + +func (x *MsgAddAllowedDenom) GetDisplayDenom() string { + if x != nil { + return x.DisplayDenom + } + return "" +} + +func (x *MsgAddAllowedDenom) GetExponent() uint32 { + if x != nil { + return x.Exponent + } + return 0 +} + +// MsgAddAllowedDenomResponse is the Msg/AddAllowedDenom response type. +// Since Revision 1 +type MsgAddAllowedDenomResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgAddAllowedDenomResponse) Reset() { + *x = MsgAddAllowedDenomResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgAddAllowedDenomResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgAddAllowedDenomResponse) ProtoMessage() {} + +// Deprecated: Use MsgAddAllowedDenomResponse.ProtoReflect.Descriptor instead. +func (*MsgAddAllowedDenomResponse) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP(), []int{9} +} + // Order is the content of a new sell order. type MsgSell_Order struct { state protoimpl.MessageState @@ -6148,7 +7196,7 @@ type MsgSell_Order struct { func (x *MsgSell_Order) Reset() { *x = MsgSell_Order{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[8] + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6224,7 +7272,7 @@ type MsgUpdateSellOrders_Update struct { func (x *MsgUpdateSellOrders_Update) Reset() { *x = MsgUpdateSellOrders_Update{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[9] + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6303,7 +7351,7 @@ type MsgBuyDirect_Order struct { func (x *MsgBuyDirect_Order) Reset() { *x = MsgBuyDirect_Order{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[10] + mi := &file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -6450,56 +7498,76 @@ var file_regen_ecocredit_marketplace_v1_tx_proto_rawDesc = []byte{ 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x16, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x79, 0x44, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xe3, 0x03, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x60, 0x0a, 0x04, 0x53, 0x65, 0x6c, 0x6c, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, - 0x65, 0x6c, 0x6c, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x84, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, - 0x65, 0x6c, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x33, 0x2e, 0x72, 0x65, 0x67, 0x65, - 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x6c, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x1a, 0x3b, - 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x6c, 0x6c, 0x4f, 0x72, 0x64, - 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x0f, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, - 0x32, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4f, 0x72, - 0x64, 0x65, 0x72, 0x1a, 0x3a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, - 0x6c, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x6f, 0x0a, 0x09, 0x42, 0x75, 0x79, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, 0x2c, 0x2e, 0x72, + 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x12, 0x4d, + 0x73, 0x67, 0x41, 0x64, 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x44, 0x65, 0x6e, 0x6f, + 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, + 0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x6e, 0x6b, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x6e, 0x6b, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x23, + 0x0a, 0x0d, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x44, 0x65, + 0x6e, 0x6f, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22, + 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, + 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xe7, 0x04, + 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x60, 0x0a, 0x04, 0x53, 0x65, 0x6c, 0x6c, 0x12, 0x27, 0x2e, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x53, 0x65, 0x6c, 0x6c, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, + 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, + 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6c, 0x6c, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x84, 0x01, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x65, 0x6c, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x33, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x42, 0x75, 0x79, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x1a, 0x34, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x42, - 0x75, 0x79, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x42, 0xa0, 0x02, 0x0a, 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x6c, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, + 0x73, 0x1a, 0x3b, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x65, 0x6c, 0x6c, + 0x4f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x81, + 0x01, 0x0a, 0x0f, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4f, 0x72, 0x64, + 0x65, 0x72, 0x12, 0x32, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x6c, + 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x1a, 0x3a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, - 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x56, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, - 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2d, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, - 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x4d, - 0xaa, 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x56, - 0x31, 0xca, 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x2a, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x21, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x3a, - 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x6f, 0x0a, 0x09, 0x42, 0x75, 0x79, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x12, + 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x42, 0x75, 0x79, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x1a, 0x34, 0x2e, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x42, 0x75, 0x79, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x81, 0x01, 0x0a, 0x0f, 0x41, 0x64, 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x77, + 0x65, 0x64, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x32, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x41, 0x64, 0x64, 0x41, + 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x1a, 0x3a, 0x2e, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x41, 0x64, 0x64, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xa0, 0x02, 0x0a, 0x22, 0x63, 0x6f, 0x6d, 0x2e, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x07, + 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x56, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, + 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x76, + 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x4d, 0xaa, 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, + 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x2a, 0x52, 0x65, 0x67, 0x65, + 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x21, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, + 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -6514,7 +7582,7 @@ func file_regen_ecocredit_marketplace_v1_tx_proto_rawDescGZIP() []byte { return file_regen_ecocredit_marketplace_v1_tx_proto_rawDescData } -var file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_regen_ecocredit_marketplace_v1_tx_proto_goTypes = []interface{}{ (*MsgSell)(nil), // 0: regen.ecocredit.marketplace.v1.MsgSell (*MsgSellResponse)(nil), // 1: regen.ecocredit.marketplace.v1.MsgSellResponse @@ -6524,31 +7592,35 @@ var file_regen_ecocredit_marketplace_v1_tx_proto_goTypes = []interface{}{ (*MsgCancelSellOrderResponse)(nil), // 5: regen.ecocredit.marketplace.v1.MsgCancelSellOrderResponse (*MsgBuyDirect)(nil), // 6: regen.ecocredit.marketplace.v1.MsgBuyDirect (*MsgBuyDirectResponse)(nil), // 7: regen.ecocredit.marketplace.v1.MsgBuyDirectResponse - (*MsgSell_Order)(nil), // 8: regen.ecocredit.marketplace.v1.MsgSell.Order - (*MsgUpdateSellOrders_Update)(nil), // 9: regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.Update - (*MsgBuyDirect_Order)(nil), // 10: regen.ecocredit.marketplace.v1.MsgBuyDirect.Order - (*v1beta1.Coin)(nil), // 11: cosmos.base.v1beta1.Coin - (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp + (*MsgAddAllowedDenom)(nil), // 8: regen.ecocredit.marketplace.v1.MsgAddAllowedDenom + (*MsgAddAllowedDenomResponse)(nil), // 9: regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse + (*MsgSell_Order)(nil), // 10: regen.ecocredit.marketplace.v1.MsgSell.Order + (*MsgUpdateSellOrders_Update)(nil), // 11: regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.Update + (*MsgBuyDirect_Order)(nil), // 12: regen.ecocredit.marketplace.v1.MsgBuyDirect.Order + (*v1beta1.Coin)(nil), // 13: cosmos.base.v1beta1.Coin + (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp } var file_regen_ecocredit_marketplace_v1_tx_proto_depIdxs = []int32{ - 8, // 0: regen.ecocredit.marketplace.v1.MsgSell.orders:type_name -> regen.ecocredit.marketplace.v1.MsgSell.Order - 9, // 1: regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.updates:type_name -> regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.Update - 10, // 2: regen.ecocredit.marketplace.v1.MsgBuyDirect.orders:type_name -> regen.ecocredit.marketplace.v1.MsgBuyDirect.Order - 11, // 3: regen.ecocredit.marketplace.v1.MsgSell.Order.ask_price:type_name -> cosmos.base.v1beta1.Coin - 12, // 4: regen.ecocredit.marketplace.v1.MsgSell.Order.expiration:type_name -> google.protobuf.Timestamp - 11, // 5: regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.Update.new_ask_price:type_name -> cosmos.base.v1beta1.Coin - 12, // 6: regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.Update.new_expiration:type_name -> google.protobuf.Timestamp - 11, // 7: regen.ecocredit.marketplace.v1.MsgBuyDirect.Order.bid_price:type_name -> cosmos.base.v1beta1.Coin + 10, // 0: regen.ecocredit.marketplace.v1.MsgSell.orders:type_name -> regen.ecocredit.marketplace.v1.MsgSell.Order + 11, // 1: regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.updates:type_name -> regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.Update + 12, // 2: regen.ecocredit.marketplace.v1.MsgBuyDirect.orders:type_name -> regen.ecocredit.marketplace.v1.MsgBuyDirect.Order + 13, // 3: regen.ecocredit.marketplace.v1.MsgSell.Order.ask_price:type_name -> cosmos.base.v1beta1.Coin + 14, // 4: regen.ecocredit.marketplace.v1.MsgSell.Order.expiration:type_name -> google.protobuf.Timestamp + 13, // 5: regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.Update.new_ask_price:type_name -> cosmos.base.v1beta1.Coin + 14, // 6: regen.ecocredit.marketplace.v1.MsgUpdateSellOrders.Update.new_expiration:type_name -> google.protobuf.Timestamp + 13, // 7: regen.ecocredit.marketplace.v1.MsgBuyDirect.Order.bid_price:type_name -> cosmos.base.v1beta1.Coin 0, // 8: regen.ecocredit.marketplace.v1.Msg.Sell:input_type -> regen.ecocredit.marketplace.v1.MsgSell 2, // 9: regen.ecocredit.marketplace.v1.Msg.UpdateSellOrders:input_type -> regen.ecocredit.marketplace.v1.MsgUpdateSellOrders 4, // 10: regen.ecocredit.marketplace.v1.Msg.CancelSellOrder:input_type -> regen.ecocredit.marketplace.v1.MsgCancelSellOrder 6, // 11: regen.ecocredit.marketplace.v1.Msg.BuyDirect:input_type -> regen.ecocredit.marketplace.v1.MsgBuyDirect - 1, // 12: regen.ecocredit.marketplace.v1.Msg.Sell:output_type -> regen.ecocredit.marketplace.v1.MsgSellResponse - 3, // 13: regen.ecocredit.marketplace.v1.Msg.UpdateSellOrders:output_type -> regen.ecocredit.marketplace.v1.MsgUpdateSellOrdersResponse - 5, // 14: regen.ecocredit.marketplace.v1.Msg.CancelSellOrder:output_type -> regen.ecocredit.marketplace.v1.MsgCancelSellOrderResponse - 7, // 15: regen.ecocredit.marketplace.v1.Msg.BuyDirect:output_type -> regen.ecocredit.marketplace.v1.MsgBuyDirectResponse - 12, // [12:16] is the sub-list for method output_type - 8, // [8:12] is the sub-list for method input_type + 8, // 12: regen.ecocredit.marketplace.v1.Msg.AddAllowedDenom:input_type -> regen.ecocredit.marketplace.v1.MsgAddAllowedDenom + 1, // 13: regen.ecocredit.marketplace.v1.Msg.Sell:output_type -> regen.ecocredit.marketplace.v1.MsgSellResponse + 3, // 14: regen.ecocredit.marketplace.v1.Msg.UpdateSellOrders:output_type -> regen.ecocredit.marketplace.v1.MsgUpdateSellOrdersResponse + 5, // 15: regen.ecocredit.marketplace.v1.Msg.CancelSellOrder:output_type -> regen.ecocredit.marketplace.v1.MsgCancelSellOrderResponse + 7, // 16: regen.ecocredit.marketplace.v1.Msg.BuyDirect:output_type -> regen.ecocredit.marketplace.v1.MsgBuyDirectResponse + 9, // 17: regen.ecocredit.marketplace.v1.Msg.AddAllowedDenom:output_type -> regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse + 13, // [13:18] is the sub-list for method output_type + 8, // [8:13] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name 8, // [8:8] is the sub-list for extension extendee 0, // [0:8] is the sub-list for field type_name @@ -6657,7 +7729,7 @@ func file_regen_ecocredit_marketplace_v1_tx_proto_init() { } } file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgSell_Order); i { + switch v := v.(*MsgAddAllowedDenom); i { case 0: return &v.state case 1: @@ -6669,7 +7741,7 @@ func file_regen_ecocredit_marketplace_v1_tx_proto_init() { } } file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUpdateSellOrders_Update); i { + switch v := v.(*MsgAddAllowedDenomResponse); i { case 0: return &v.state case 1: @@ -6681,6 +7753,30 @@ func file_regen_ecocredit_marketplace_v1_tx_proto_init() { } } file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgSell_Order); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgUpdateSellOrders_Update); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_regen_ecocredit_marketplace_v1_tx_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgBuyDirect_Order); i { case 0: return &v.state @@ -6699,7 +7795,7 @@ func file_regen_ecocredit_marketplace_v1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_regen_ecocredit_marketplace_v1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 13, NumExtensions: 0, NumServices: 1, }, diff --git a/api/regen/ecocredit/marketplace/v1/tx_grpc.pb.go b/api/regen/ecocredit/marketplace/v1/tx_grpc.pb.go index 8556f5555a..ef476550f7 100644 --- a/api/regen/ecocredit/marketplace/v1/tx_grpc.pb.go +++ b/api/regen/ecocredit/marketplace/v1/tx_grpc.pb.go @@ -30,6 +30,10 @@ type MsgClient interface { CancelSellOrder(ctx context.Context, in *MsgCancelSellOrder, opts ...grpc.CallOption) (*MsgCancelSellOrderResponse, error) // BuyDirect purchases credits directly from the specified sell order. BuyDirect(ctx context.Context, in *MsgBuyDirect, opts ...grpc.CallOption) (*MsgBuyDirectResponse, error) + // AddAllowedDenom is a governance method that allows the addition of + // new allowed denom. + // Since Revision 1 + AddAllowedDenom(ctx context.Context, in *MsgAddAllowedDenom, opts ...grpc.CallOption) (*MsgAddAllowedDenomResponse, error) } type msgClient struct { @@ -76,6 +80,15 @@ func (c *msgClient) BuyDirect(ctx context.Context, in *MsgBuyDirect, opts ...grp return out, nil } +func (c *msgClient) AddAllowedDenom(ctx context.Context, in *MsgAddAllowedDenom, opts ...grpc.CallOption) (*MsgAddAllowedDenomResponse, error) { + out := new(MsgAddAllowedDenomResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1.Msg/AddAllowedDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -88,6 +101,10 @@ type MsgServer interface { CancelSellOrder(context.Context, *MsgCancelSellOrder) (*MsgCancelSellOrderResponse, error) // BuyDirect purchases credits directly from the specified sell order. BuyDirect(context.Context, *MsgBuyDirect) (*MsgBuyDirectResponse, error) + // AddAllowedDenom is a governance method that allows the addition of + // new allowed denom. + // Since Revision 1 + AddAllowedDenom(context.Context, *MsgAddAllowedDenom) (*MsgAddAllowedDenomResponse, error) mustEmbedUnimplementedMsgServer() } @@ -107,6 +124,9 @@ func (UnimplementedMsgServer) CancelSellOrder(context.Context, *MsgCancelSellOrd func (UnimplementedMsgServer) BuyDirect(context.Context, *MsgBuyDirect) (*MsgBuyDirectResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BuyDirect not implemented") } +func (UnimplementedMsgServer) AddAllowedDenom(context.Context, *MsgAddAllowedDenom) (*MsgAddAllowedDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddAllowedDenom not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -192,6 +212,24 @@ func _Msg_BuyDirect_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _Msg_AddAllowedDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddAllowedDenom) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddAllowedDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1.Msg/AddAllowedDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddAllowedDenom(ctx, req.(*MsgAddAllowedDenom)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -215,6 +253,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "BuyDirect", Handler: _Msg_BuyDirect_Handler, }, + { + MethodName: "AddAllowedDenom", + Handler: _Msg_AddAllowedDenom_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "regen/ecocredit/marketplace/v1/tx.proto", diff --git a/api/regen/ecocredit/marketplace/v1/types.pulsar.go b/api/regen/ecocredit/marketplace/v1/types.pulsar.go index 8e21f34417..a4683f1b75 100644 --- a/api/regen/ecocredit/marketplace/v1/types.pulsar.go +++ b/api/regen/ecocredit/marketplace/v1/types.pulsar.go @@ -4,7 +4,6 @@ package marketplacev1 import ( fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/gogo/protobuf/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -591,6 +590,8 @@ const ( // AllowDenomProposal is a gov Content type for approving a denom for use in the // marketplace. +// Deprecated (Since Revision 1): This message is no longer used and will be removed +// in the next version. See MsgAddAllowedDenom. type AllowDenomProposal struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -653,40 +654,38 @@ var file_regen_ecocredit_marketplace_v1_types_proto_rawDesc = []byte{ 0x74, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, - 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x2a, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2f, - 0x76, 0x31, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x96, - 0x01, 0x0a, 0x12, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x50, 0x72, 0x6f, - 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, - 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x72, - 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, - 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, - 0x6d, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0xa3, 0x02, 0x0a, 0x22, 0x63, 0x6f, 0x6d, 0x2e, - 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0a, - 0x54, 0x79, 0x70, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x56, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6c, 0x65, 0x64, - 0x67, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, - 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, - 0x61, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, - 0x63, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x4d, 0xaa, 0x02, 0x1e, 0x52, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x4d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x1e, 0x52, 0x65, - 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x2a, 0x52, - 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, - 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x21, 0x52, 0x65, 0x67, 0x65, - 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x2a, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x90, 0x01, 0x0a, 0x12, 0x41, 0x6c, 0x6c, + 0x6f, 0x77, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x50, 0x72, 0x6f, 0x70, 0x6f, 0x73, 0x61, 0x6c, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x42, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, + 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, + 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x44, + 0x65, 0x6e, 0x6f, 0x6d, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x42, 0xa3, 0x02, 0x0a, 0x22, + 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, + 0x76, 0x31, 0x42, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x56, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x2d, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x67, 0x65, + 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x4d, 0xaa, 0x02, + 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x2e, 0x56, 0x31, 0xca, + 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5c, 0x56, 0x31, + 0xe2, 0x02, 0x2a, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, + 0x69, 0x74, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x5c, 0x56, + 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x21, + 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x3a, 0x3a, 0x56, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/regen/ecocredit/v1/types.pulsar.go b/api/regen/ecocredit/v1/types.pulsar.go index 17dc079a8b..0959e628ac 100644 --- a/api/regen/ecocredit/v1/types.pulsar.go +++ b/api/regen/ecocredit/v1/types.pulsar.go @@ -3376,6 +3376,8 @@ func (x *OriginTx) GetNote() string { } // CreditTypeProposal is a gov Content type for adding a credit type. +// Deprecated (Since Revision 1): This message is no longer used and will be removed +// in the next version. See MsgAddCreditType. type CreditTypeProposal struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/app/app.go b/app/app.go index c055cb3fd5..137e2c9f21 100644 --- a/app/app.go +++ b/app/app.go @@ -100,7 +100,6 @@ import ( "github.com/regen-network/regen-ledger/x/ecocredit" "github.com/regen-network/regen-ledger/x/ecocredit/basket" ecocreditmodule "github.com/regen-network/regen-ledger/x/ecocredit/module" - ecoServer "github.com/regen-network/regen-ledger/x/ecocredit/server" // unnamed import of statik for swagger UI support _ "github.com/regen-network/regen-ledger/v4/client/docs/statik" @@ -389,8 +388,6 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest } app.smm.RegisterInvariants(&app.CrisisKeeper) - govRouter.AddRoute(ecocredit.RouterKey, ecoServer.NewProposalHandler(ecocreditModule.Keeper)) - govConfig := govtypes.DefaultConfig() app.GovKeeper = govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, diff --git a/proto/regen/ecocredit/marketplace/v1/tx.proto b/proto/regen/ecocredit/marketplace/v1/tx.proto index 287d3f8e96..0828e7f482 100644 --- a/proto/regen/ecocredit/marketplace/v1/tx.proto +++ b/proto/regen/ecocredit/marketplace/v1/tx.proto @@ -23,6 +23,11 @@ service Msg { // BuyDirect purchases credits directly from the specified sell order. rpc BuyDirect(MsgBuyDirect) returns (MsgBuyDirectResponse); + + // AddAllowedDenom is a governance method that allows the addition of + // new allowed denom. + // Since Revision 1 + rpc AddAllowedDenom(MsgAddAllowedDenom) returns (MsgAddAllowedDenomResponse); } // MsgSell is the Msg/Sell request type. @@ -155,3 +160,26 @@ message MsgBuyDirect { // MsgBuyDirectResponse is the Msg/BuyDirect response type. message MsgBuyDirectResponse {} + +// MsgAddAllowedDenom is the Msg/AddAllowedDenom request type. +// Since Revision 1 +message MsgAddAllowedDenom { + // authority is the address of the governance account. + string authority = 1; + + // denom is the bank denom to allow (ex. ibc/GLKHDSG423SGS) + string bank_denom = 2; + + // display_denom is the denom to display to the user and is informational. + // Because the denom is likely an IBC denom, this should be chosen by + // governance to represent the consensus trusted name of the denom. + string display_denom = 3; + + // exponent is the exponent that relates the denom to the display_denom and is + // informational + uint32 exponent = 4; +} + +// MsgAddAllowedDenomResponse is the Msg/AddAllowedDenom response type. +// Since Revision 1 +message MsgAddAllowedDenomResponse {} \ No newline at end of file diff --git a/proto/regen/ecocredit/marketplace/v1/types.proto b/proto/regen/ecocredit/marketplace/v1/types.proto index 1acea7552c..9c47e2db1c 100644 --- a/proto/regen/ecocredit/marketplace/v1/types.proto +++ b/proto/regen/ecocredit/marketplace/v1/types.proto @@ -2,15 +2,15 @@ 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"; // AllowDenomProposal is a gov Content type for approving a denom for use in the // marketplace. +// 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; @@ -21,4 +21,4 @@ message AllowDenomProposal { // denom contains coin denom information that will be added to the // list of allowed denoms for use in the marketplace. AllowedDenom denom = 3; -} \ No newline at end of file +} diff --git a/proto/regen/ecocredit/v1/types.proto b/proto/regen/ecocredit/v1/types.proto index 8dbe9dc767..25343233a9 100644 --- a/proto/regen/ecocredit/v1/types.proto +++ b/proto/regen/ecocredit/v1/types.proto @@ -102,6 +102,8 @@ message OriginTx { } // CreditTypeProposal is a gov Content type for adding a credit type. +// Deprecated (Since Revision 1): This message is no longer used and will be removed +// in the next version. See MsgAddCreditType. message CreditTypeProposal { option (gogoproto.goproto_stringer) = false; diff --git a/x/ecocredit/client/marketplace/proposal.go b/x/ecocredit/client/marketplace/proposal.go deleted file mode 100644 index 2699716804..0000000000 --- a/x/ecocredit/client/marketplace/proposal.go +++ /dev/null @@ -1,80 +0,0 @@ -package marketplace - -import ( - "encoding/json" - "fmt" - "io/ioutil" - "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" -) - -var AllowDenomProposalHandler = govclient.NewProposalHandler(TxAllowDenomProposal) - -func TxAllowDenomProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "allow-denom-proposal [path_to_file.json] [flags]", - Args: cobra.ExactArgs(1), - Short: "Submit a proposal to add a denom to the list of allowed denoms", - Long: strings.TrimSpace(`Submit a proposal to add a denom to the list of allowed denoms for use in the marketplace. -The json file MUST take the following form: -{ - "title": "some title", - "description": "some description", - "denom": { - "bank_denom": "uregen", - "display_denom": "regen", - "exponent": 6 - } -} -The bank denom is the underlying coin denom (i.e. ibc/CDC4587874B85BEA4FCEC3CEA5A1195139799A1FEE711A07D972537E18FD). -Display denom is used for display purposes, and serves as the name of the coin denom (i.e. ATOM). Exponent is used to -relate the bank_denom to the display_denom and is informational`), - Example: `regen tx gov submit-proposal allow-denom-proposal my_file.json --deposit=100regen`, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - proposalFile, err := ioutil.ReadFile(args[0]) - if err != nil { - return err - } - - var proposal marketplace.AllowDenomProposal - err = json.Unmarshal(proposalFile, &proposal) - if err != nil { - return err - } - if err := proposal.ValidateBasic(); err != nil { - return fmt.Errorf("invalid proposal: %w", err) - } - - depositStr, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - deposit, err := sdk.ParseCoinsNormalized(depositStr) - if err != nil { - return err - } - var content govv1beta1.Content = &proposal - msg, err := govv1beta1.NewMsgSubmitProposal(content, deposit, clientCtx.GetFromAddress()) - if err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - cmd.Flags().String(cli.FlagDeposit, "", "deposit of proposal") - return cmd -} diff --git a/x/ecocredit/core/types.pb.go b/x/ecocredit/core/types.pb.go index bee70fd866..dd2e8125e3 100644 --- a/x/ecocredit/core/types.pb.go +++ b/x/ecocredit/core/types.pb.go @@ -329,6 +329,8 @@ func (m *OriginTx) GetNote() string { } // CreditTypeProposal is a gov Content type for adding a credit type. +// Deprecated (Since Revision 1): This message is no longer used and will be removed +// in the next version. See MsgAddCreditType. type CreditTypeProposal struct { // title is the title of the proposal. Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` diff --git a/x/ecocredit/marketplace/codec.go b/x/ecocredit/marketplace/codec.go index a93207d69e..b892750c1f 100644 --- a/x/ecocredit/marketplace/codec.go +++ b/x/ecocredit/marketplace/codec.go @@ -8,11 +8,9 @@ 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) } @@ -21,6 +19,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgSell{}, "regen.marketplace/MsgSell", nil) cdc.RegisterConcrete(&MsgCancelSellOrder{}, "regen.marketplace/MsgCancelSellOrder", nil) cdc.RegisterConcrete(&MsgUpdateSellOrders{}, "regen.marketplace/MsgUpdateSellOrders", nil) + cdc.RegisterConcrete(&MsgAddAllowedDenom{}, "regen.marketplace/MsgAddAllowedDenom", nil) } var ( diff --git a/x/ecocredit/marketplace/features/msg_add_allowed_denom.feature b/x/ecocredit/marketplace/features/msg_add_allowed_denom.feature new file mode 100644 index 0000000000..cc15f96bb0 --- /dev/null +++ b/x/ecocredit/marketplace/features/msg_add_allowed_denom.feature @@ -0,0 +1,64 @@ +Feature: MsgAddAllowedDenom + + Scenario: a valid message + Given the message + """ + { + "authority": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", + "bank_denom": "uregen", + "display_denom": "REGEN", + "exponent": 6 + } + """ + When the message is validated + Then expect no error + + Scenario: an error is returned if authority is empty + Given the message + """ + {} + """ + When the message is validated + Then expect the error "invalid authority address: empty address string is not allowed" + + Scenario: an error is returned if authority is not a valid bech32 address + Given the message + """ + { + "authority": "foo" + } + """ + When the message is validated + Then expect the error "invalid authority address: decoding bech32 failed: invalid bech32 string length 3" + + Scenario: an error is returned if bank denom is empty + Given the message + """ + { + "authority": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw" + } + """ + When the message is validated + Then expect the error "invalid bank denom: invalid denom: : invalid request" + + Scenario: an error is returned if bank denom is not valid denom + Given the message + """ + { + "authority": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", + "bank_denom": "A+b" + } + """ + When the message is validated + Then expect the error "invalid bank denom: invalid denom: A+b: invalid request" + + Scenario: an error is returned if bank display denom is empty + Given the message + """ + { + "authority": "regen1elq7ys34gpkj3jyvqee0h6yk4h9wsfxmgqelsw", + "bank_denom": "uregen" + } + """ + When the message is validated + Then expect the error "invalid display_denom: invalid denom: : invalid request" diff --git a/x/ecocredit/marketplace/msg_add_allowed_denom.go b/x/ecocredit/marketplace/msg_add_allowed_denom.go new file mode 100644 index 0000000000..7b8ddb62cb --- /dev/null +++ b/x/ecocredit/marketplace/msg_add_allowed_denom.go @@ -0,0 +1,43 @@ +package marketplace + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/regen-network/regen-ledger/x/ecocredit" + + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" +) + +var _ legacytx.LegacyMsg = &MsgAddAllowedDenom{} + +// ValidateBasic does a sanity check on the provided data. +func (m MsgAddAllowedDenom) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return sdkerrors.Wrapf(err, "invalid authority address") + } + + msg := AllowedDenom{ + BankDenom: m.BankDenom, + DisplayDenom: m.DisplayDenom, + Exponent: m.Exponent, + } + + return msg.Validate() +} + +// GetSigners returns the expected signers for MsgAddAllowedDenom. +func (m MsgAddAllowedDenom) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// GetSignBytes implements the LegacyMsg interface. +func (m MsgAddAllowedDenom) GetSignBytes() []byte { + return sdk.MustSortJSON(ecocredit.ModuleCdc.MustMarshalJSON(&m)) +} + +// Route implements the LegacyMsg interface. +func (m MsgAddAllowedDenom) Route() string { return sdk.MsgTypeURL(&m) } + +// Route implements the LegacyMsg interface. +func (m MsgAddAllowedDenom) Type() string { return sdk.MsgTypeURL(&m) } diff --git a/x/ecocredit/marketplace/msg_add_allowed_denom_test.go b/x/ecocredit/marketplace/msg_add_allowed_denom_test.go new file mode 100644 index 0000000000..72adca5258 --- /dev/null +++ b/x/ecocredit/marketplace/msg_add_allowed_denom_test.go @@ -0,0 +1,41 @@ +package marketplace + +import ( + "testing" + + "github.com/gogo/protobuf/jsonpb" + "github.com/regen-network/gocuke" + "github.com/stretchr/testify/require" +) + +type msgAddAllowedDenomSuite struct { + t gocuke.TestingT + msg *MsgAddAllowedDenom + err error +} + +func TestMsgAddAllowedDenomSuite(t *testing.T) { + gocuke.NewRunner(t, &msgAddAllowedDenomSuite{}).Path("./features/msg_add_allowed_denom.feature").Run() +} + +func (s *msgAddAllowedDenomSuite) Before(t gocuke.TestingT) { + s.t = t +} + +func (s *msgAddAllowedDenomSuite) TheMessage(a gocuke.DocString) { + s.msg = &MsgAddAllowedDenom{} + err := jsonpb.UnmarshalString(a.Content, s.msg) + require.NoError(s.t, err) +} + +func (s *msgAddAllowedDenomSuite) TheMessageIsValidated() { + s.err = s.msg.ValidateBasic() +} + +func (s *msgAddAllowedDenomSuite) ExpectTheError(a string) { + require.EqualError(s.t, s.err, a) +} + +func (s *msgAddAllowedDenomSuite) ExpectNoError() { + require.NoError(s.t, s.err) +} diff --git a/x/ecocredit/marketplace/msg_allowed_denom_proposal.go b/x/ecocredit/marketplace/msg_allowed_denom_proposal.go deleted file mode 100644 index 2977a85a87..0000000000 --- a/x/ecocredit/marketplace/msg_allowed_denom_proposal.go +++ /dev/null @@ -1,42 +0,0 @@ -package marketplace - -import ( - "fmt" - - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/regen-network/regen-ledger/x/ecocredit" -) - -var _ govv1beta1.Content = &AllowDenomProposal{} - -const ( - AllowDenomProposalType = "AllowDenomProposal" -) - -func init() { - govv1beta1.RegisterProposalType(AllowDenomProposalType) -} - -func (m AllowDenomProposal) ProposalRoute() string { return ecocredit.RouterKey } - -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 govv1beta1.ValidateAbstract(&m) -} - -func (m AllowDenomProposal) String() string { - return fmt.Sprintf(`Credit Type Proposal: - Title: %s - Description: %s - Allowed Denom: %v -`, m.Title, m.Description, m.Denom) -} diff --git a/x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go b/x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go deleted file mode 100644 index a67a4b9b6a..0000000000 --- a/x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package marketplace - -import ( - "testing" -) - -func TestAllowDenomProposal_ValidateBasic(t *testing.T) { - type fields struct { - Title string - Description string - Denom *AllowedDenom - } - validDenom := &AllowedDenom{ - BankDenom: "uregen", - DisplayDenom: "regen", - Exponent: 18, - } - tests := []struct { - name string - fields fields - wantErr bool - }{ - { - name: "valid", - fields: fields{ - Title: "foo", - Description: "bar", - Denom: validDenom, - }, - wantErr: false, - }, - { - name: "no title", - fields: fields{ - Description: "foo", - Denom: validDenom, - }, - wantErr: true, - }, - { - name: "no desc", - fields: fields{ - Title: "foo", - Denom: validDenom, - }, - wantErr: true, - }, - { - name: "no allowed denom", - fields: fields{ - Title: "foo", - Description: "bar", - }, - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - m := &AllowDenomProposal{ - Title: tt.fields.Title, - Description: tt.fields.Description, - Denom: tt.fields.Denom, - } - if err := m.ValidateBasic(); (err != nil) != tt.wantErr { - t.Errorf("ValidateBasic() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} diff --git a/x/ecocredit/marketplace/tx.pb.go b/x/ecocredit/marketplace/tx.pb.go index 0b5e09afda..ba3d09305b 100644 --- a/x/ecocredit/marketplace/tx.pb.go +++ b/x/ecocredit/marketplace/tx.pb.go @@ -675,6 +675,121 @@ func (m *MsgBuyDirectResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBuyDirectResponse proto.InternalMessageInfo +// MsgAddAllowedDenom is the Msg/AddAllowedDenom request type. +// Since Revision 1 +type MsgAddAllowedDenom struct { + // authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // denom is the bank denom to allow (ex. ibc/GLKHDSG423SGS) + BankDenom string `protobuf:"bytes,2,opt,name=bank_denom,json=bankDenom,proto3" json:"bank_denom,omitempty"` + // display_denom is the denom to display to the user and is informational. + // Because the denom is likely an IBC denom, this should be chosen by + // governance to represent the consensus trusted name of the denom. + DisplayDenom string `protobuf:"bytes,3,opt,name=display_denom,json=displayDenom,proto3" json:"display_denom,omitempty"` + // exponent is the exponent that relates the denom to the display_denom and is + // informational + Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"` +} + +func (m *MsgAddAllowedDenom) Reset() { *m = MsgAddAllowedDenom{} } +func (m *MsgAddAllowedDenom) String() string { return proto.CompactTextString(m) } +func (*MsgAddAllowedDenom) ProtoMessage() {} +func (*MsgAddAllowedDenom) Descriptor() ([]byte, []int) { + return fileDescriptor_68c9b4e4b7fcb584, []int{8} +} +func (m *MsgAddAllowedDenom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAllowedDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAllowedDenom.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddAllowedDenom) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAllowedDenom.Merge(m, src) +} +func (m *MsgAddAllowedDenom) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAllowedDenom) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAllowedDenom.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAllowedDenom proto.InternalMessageInfo + +func (m *MsgAddAllowedDenom) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgAddAllowedDenom) GetBankDenom() string { + if m != nil { + return m.BankDenom + } + return "" +} + +func (m *MsgAddAllowedDenom) GetDisplayDenom() string { + if m != nil { + return m.DisplayDenom + } + return "" +} + +func (m *MsgAddAllowedDenom) GetExponent() uint32 { + if m != nil { + return m.Exponent + } + return 0 +} + +// MsgAddAllowedDenomResponse is the Msg/AddAllowedDenom response type. +// Since Revision 1 +type MsgAddAllowedDenomResponse struct { +} + +func (m *MsgAddAllowedDenomResponse) Reset() { *m = MsgAddAllowedDenomResponse{} } +func (m *MsgAddAllowedDenomResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddAllowedDenomResponse) ProtoMessage() {} +func (*MsgAddAllowedDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_68c9b4e4b7fcb584, []int{9} +} +func (m *MsgAddAllowedDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddAllowedDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddAllowedDenomResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgAddAllowedDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddAllowedDenomResponse.Merge(m, src) +} +func (m *MsgAddAllowedDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddAllowedDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddAllowedDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddAllowedDenomResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSell)(nil), "regen.ecocredit.marketplace.v1.MsgSell") proto.RegisterType((*MsgSell_Order)(nil), "regen.ecocredit.marketplace.v1.MsgSell.Order") @@ -687,6 +802,8 @@ func init() { proto.RegisterType((*MsgBuyDirect)(nil), "regen.ecocredit.marketplace.v1.MsgBuyDirect") proto.RegisterType((*MsgBuyDirect_Order)(nil), "regen.ecocredit.marketplace.v1.MsgBuyDirect.Order") proto.RegisterType((*MsgBuyDirectResponse)(nil), "regen.ecocredit.marketplace.v1.MsgBuyDirectResponse") + proto.RegisterType((*MsgAddAllowedDenom)(nil), "regen.ecocredit.marketplace.v1.MsgAddAllowedDenom") + proto.RegisterType((*MsgAddAllowedDenomResponse)(nil), "regen.ecocredit.marketplace.v1.MsgAddAllowedDenomResponse") } func init() { @@ -694,55 +811,61 @@ func init() { } var fileDescriptor_68c9b4e4b7fcb584 = []byte{ - // 766 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0x49, 0x6f, 0xdb, 0x46, - 0x14, 0x36, 0xb5, 0xd9, 0x7e, 0xf2, 0xd2, 0xd2, 0x86, 0xab, 0xb2, 0x2d, 0xad, 0x0a, 0x05, 0xac, - 0x43, 0x3d, 0x84, 0xe5, 0xa2, 0x06, 0x5c, 0x18, 0xa8, 0x37, 0x14, 0x35, 0x20, 0xd4, 0xa5, 0x1d, - 0x04, 0xc8, 0x85, 0xe1, 0x32, 0xa1, 0x27, 0xa2, 0x38, 0x0a, 0x67, 0xe8, 0xe5, 0x18, 0x20, 0x40, - 0x4e, 0x01, 0xfc, 0xb3, 0x72, 0xf4, 0x31, 0x41, 0x0e, 0x09, 0xac, 0x4b, 0x4e, 0xf9, 0x0d, 0x01, - 0x87, 0x8b, 0x65, 0xc9, 0x76, 0x24, 0xdd, 0xf8, 0xde, 0xfb, 0xde, 0x82, 0xef, 0x7b, 0x6f, 0x08, - 0x2b, 0x01, 0x76, 0xb1, 0xaf, 0x61, 0x9b, 0xda, 0x01, 0x76, 0x08, 0xd7, 0xda, 0x66, 0xd0, 0xc2, - 0xbc, 0xe3, 0x99, 0x36, 0xd6, 0x4e, 0xd7, 0x34, 0x7e, 0x8e, 0x3a, 0x01, 0xe5, 0x54, 0x56, 0x05, - 0x10, 0x65, 0x40, 0xd4, 0x03, 0x44, 0xa7, 0x6b, 0x8a, 0x6a, 0x53, 0xd6, 0xa6, 0x4c, 0xb3, 0x4c, - 0x16, 0x25, 0x5a, 0x98, 0x9b, 0x6b, 0x9a, 0x4d, 0x89, 0x1f, 0xe7, 0x2b, 0x8b, 0x2e, 0x75, 0xa9, - 0xf8, 0xd4, 0xa2, 0xaf, 0xc4, 0xbb, 0xec, 0x52, 0xea, 0x7a, 0x58, 0x13, 0x96, 0x15, 0x3e, 0xd3, - 0x38, 0x69, 0x63, 0xc6, 0xcd, 0x76, 0x27, 0x06, 0xd4, 0xde, 0xe7, 0x60, 0xb2, 0xc9, 0xdc, 0x23, - 0xec, 0x79, 0xf2, 0x12, 0x94, 0x18, 0xf6, 0x3c, 0x1c, 0x54, 0xa4, 0xaa, 0x54, 0x9f, 0xd6, 0x13, - 0x4b, 0xde, 0x87, 0x12, 0x0d, 0x1c, 0x1c, 0xb0, 0x4a, 0xae, 0x9a, 0xaf, 0x97, 0x1b, 0xab, 0xe8, - 0xe1, 0x59, 0x51, 0x52, 0x10, 0xfd, 0x17, 0x65, 0xe9, 0x49, 0xb2, 0xf2, 0x45, 0x82, 0xa2, 0xf0, - 0xc8, 0xcb, 0x50, 0xb6, 0x4c, 0x6e, 0x9f, 0x18, 0x0e, 0xf6, 0x69, 0x3b, 0xe9, 0x06, 0xc2, 0xb5, - 0x17, 0x79, 0x64, 0x05, 0xa6, 0x5e, 0x84, 0xa6, 0xcf, 0x09, 0xbf, 0xa8, 0xe4, 0x44, 0x34, 0xb3, - 0xe5, 0x3f, 0x61, 0xda, 0x64, 0x2d, 0xa3, 0x13, 0x10, 0x1b, 0x57, 0xf2, 0x55, 0xa9, 0x5e, 0x6e, - 0xfc, 0x88, 0x62, 0x72, 0x50, 0x44, 0x0e, 0x4a, 0xc8, 0x41, 0xbb, 0x94, 0xf8, 0xfa, 0x94, 0xc9, - 0x5a, 0x87, 0x11, 0x54, 0x46, 0xb0, 0xe0, 0x10, 0x66, 0x5a, 0x1e, 0x36, 0xcc, 0x90, 0x53, 0x23, - 0xc0, 0x9c, 0x04, 0xb8, 0x52, 0xa8, 0x4a, 0xf5, 0x29, 0xfd, 0xfb, 0x24, 0xb4, 0x1d, 0x72, 0xaa, - 0x8b, 0x80, 0xfc, 0x37, 0x00, 0x3e, 0xef, 0x90, 0xc0, 0xe4, 0x84, 0xfa, 0x95, 0xa2, 0x68, 0xa4, - 0xa0, 0x98, 0x4f, 0x94, 0xf2, 0x89, 0x8e, 0x53, 0x3e, 0x77, 0x0a, 0x97, 0x1f, 0x97, 0x25, 0xbd, - 0x27, 0xa7, 0xb6, 0x01, 0xf3, 0x09, 0x13, 0x3a, 0x66, 0x1d, 0xea, 0x33, 0x2c, 0xff, 0x06, 0x73, - 0x11, 0xa9, 0x86, 0xa0, 0xc4, 0x20, 0x0e, 0xab, 0x48, 0xd5, 0x7c, 0xbd, 0xa0, 0xcf, 0x44, 0x5e, - 0x41, 0xce, 0xbf, 0x0e, 0xab, 0xbd, 0xc9, 0xc3, 0x42, 0x93, 0xb9, 0x8f, 0x3a, 0x8e, 0xc9, 0xf1, - 0x51, 0x1a, 0x61, 0xf7, 0x0a, 0x74, 0x0c, 0x93, 0xa1, 0xc0, 0xa6, 0x0a, 0x6d, 0x0e, 0xa1, 0x50, - 0x7f, 0x75, 0x14, 0x3b, 0xf4, 0xb4, 0x94, 0xf2, 0x3a, 0x07, 0xa5, 0xd8, 0x27, 0xd7, 0x60, 0xf6, - 0xd6, 0xd8, 0xa2, 0x7f, 0x41, 0x2f, 0xf7, 0x4c, 0x2d, 0xff, 0x0a, 0x33, 0x3e, 0x3e, 0x33, 0xfa, - 0x74, 0x2b, 0xfb, 0xf8, 0xec, 0xff, 0x54, 0xba, 0x2d, 0x98, 0x8d, 0x20, 0x23, 0xc8, 0x17, 0xa5, - 0x6f, 0x8f, 0xab, 0xe0, 0x3f, 0x30, 0x17, 0xb5, 0x1b, 0x43, 0xc5, 0x68, 0xcc, 0xfd, 0x1b, 0x21, - 0x7f, 0x81, 0x9f, 0xee, 0x20, 0x2c, 0x15, 0xb5, 0x76, 0x08, 0x72, 0x93, 0xb9, 0xbb, 0xa6, 0x6f, - 0x63, 0x2f, 0x0b, 0xdf, 0x2b, 0xd6, 0x00, 0x97, 0xb9, 0x01, 0x2e, 0x6b, 0x3f, 0x83, 0x32, 0x58, - 0x31, 0xeb, 0xf7, 0x21, 0x07, 0x33, 0x4d, 0xe6, 0xee, 0x84, 0x17, 0x7b, 0x24, 0xc0, 0x36, 0x97, - 0x17, 0xa1, 0x68, 0x85, 0x17, 0x59, 0xa7, 0xd8, 0x90, 0x0f, 0xfa, 0xce, 0xb6, 0x31, 0xc4, 0x52, - 0x64, 0x35, 0xfb, 0x6e, 0xf7, 0x73, 0x76, 0xbb, 0x43, 0x8c, 0x7f, 0xeb, 0x7c, 0xf3, 0x83, 0xe7, - 0x6b, 0x11, 0x27, 0xd1, 0xbf, 0xf0, 0xcd, 0xf3, 0xb5, 0x88, 0xf3, 0xa0, 0xf8, 0xc5, 0xfb, 0xc4, - 0xdf, 0x80, 0x1f, 0x62, 0x48, 0x1b, 0xfb, 0xdc, 0x78, 0x1e, 0x06, 0x84, 0x39, 0xc4, 0x16, 0x5b, - 0x50, 0x12, 0x23, 0x2d, 0xdd, 0x84, 0x0f, 0x7a, 0xa2, 0xb5, 0x25, 0x58, 0xec, 0x25, 0x22, 0x65, - 0xbd, 0xd1, 0xcd, 0x43, 0xbe, 0xc9, 0x5c, 0xf9, 0x29, 0x14, 0xc4, 0x6b, 0xb9, 0x32, 0xe4, 0x2b, - 0xa8, 0x68, 0x43, 0x02, 0xb3, 0x47, 0xe2, 0x95, 0x04, 0xdf, 0x0d, 0xdc, 0xfe, 0xfa, 0x18, 0x27, - 0xad, 0xfc, 0x35, 0x46, 0x52, 0x36, 0xc6, 0x4b, 0x09, 0xe6, 0xfb, 0x97, 0x7a, 0x98, 0x1d, 0xea, - 0xcb, 0x51, 0x36, 0x47, 0xcf, 0xc9, 0x66, 0xa0, 0x30, 0x7d, 0xb3, 0xe6, 0xbf, 0x8f, 0xb2, 0xc0, - 0xca, 0x1f, 0xa3, 0xa0, 0xd3, 0x86, 0x3b, 0x8f, 0xdf, 0x5e, 0xab, 0xd2, 0xd5, 0xb5, 0x2a, 0x7d, - 0xba, 0x56, 0xa5, 0xcb, 0xae, 0x3a, 0x71, 0xd5, 0x55, 0x27, 0xde, 0x75, 0xd5, 0x89, 0x27, 0x5b, - 0x2e, 0xe1, 0x27, 0xa1, 0x85, 0x6c, 0xda, 0xd6, 0x44, 0xe5, 0x55, 0x1f, 0xf3, 0x33, 0x1a, 0xb4, - 0x12, 0xcb, 0xc3, 0x8e, 0x8b, 0x03, 0xed, 0xfc, 0xee, 0x7f, 0xbd, 0x55, 0x12, 0x8f, 0xcd, 0xfa, - 0xd7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x68, 0xb8, 0x0b, 0xf6, 0x11, 0x08, 0x00, 0x00, + // 858 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0xda, 0x8e, 0x1b, 0x3f, 0x27, 0x2d, 0x4c, 0xa3, 0x60, 0x96, 0xd6, 0x31, 0x06, 0xa9, + 0x3e, 0xd0, 0x59, 0x25, 0x45, 0x54, 0x2a, 0xaa, 0x44, 0xd2, 0x56, 0x88, 0x4a, 0x16, 0x65, 0x5b, + 0x84, 0xc4, 0xc5, 0xcc, 0xee, 0x3e, 0x36, 0x83, 0xd7, 0x3b, 0xcb, 0xcc, 0x6c, 0x93, 0x1c, 0x91, + 0x90, 0x38, 0x21, 0x55, 0x7c, 0x2a, 0x8e, 0x3d, 0x82, 0x38, 0x80, 0x92, 0x03, 0x9c, 0xf8, 0x0c, + 0x68, 0x67, 0xd7, 0x1b, 0x67, 0xdd, 0x14, 0xc7, 0xb7, 0x7d, 0xff, 0xdf, 0xfc, 0x7e, 0xef, 0x3d, + 0x2d, 0xdc, 0x92, 0x18, 0x62, 0xec, 0xa0, 0x2f, 0x7c, 0x89, 0x01, 0xd7, 0xce, 0x84, 0xc9, 0x31, + 0xea, 0x24, 0x62, 0x3e, 0x3a, 0xcf, 0x77, 0x1c, 0x7d, 0x44, 0x13, 0x29, 0xb4, 0x20, 0x5d, 0xe3, + 0x48, 0x4b, 0x47, 0x3a, 0xe3, 0x48, 0x9f, 0xef, 0xd8, 0x5d, 0x5f, 0xa8, 0x89, 0x50, 0x8e, 0xc7, + 0x54, 0x16, 0xe8, 0xa1, 0x66, 0x3b, 0x8e, 0x2f, 0x78, 0x9c, 0xc7, 0xdb, 0x9b, 0xa1, 0x08, 0x85, + 0xf9, 0x74, 0xb2, 0xaf, 0x42, 0xbb, 0x1d, 0x0a, 0x11, 0x46, 0xe8, 0x18, 0xc9, 0x4b, 0xbf, 0x75, + 0x34, 0x9f, 0xa0, 0xd2, 0x6c, 0x92, 0xe4, 0x0e, 0xfd, 0xdf, 0x6b, 0x70, 0x65, 0xa8, 0xc2, 0xa7, + 0x18, 0x45, 0x64, 0x0b, 0x9a, 0x0a, 0xa3, 0x08, 0x65, 0xc7, 0xea, 0x59, 0x83, 0x96, 0x5b, 0x48, + 0xe4, 0x11, 0x34, 0x85, 0x0c, 0x50, 0xaa, 0x4e, 0xad, 0x57, 0x1f, 0xb4, 0x77, 0x6f, 0xd3, 0xd7, + 0xf7, 0x4a, 0x8b, 0x84, 0xf4, 0xf3, 0x2c, 0xca, 0x2d, 0x82, 0xed, 0x7f, 0x2d, 0x58, 0x35, 0x1a, + 0xb2, 0x0d, 0x6d, 0x8f, 0x69, 0xff, 0x60, 0x14, 0x60, 0x2c, 0x26, 0x45, 0x35, 0x30, 0xaa, 0x87, + 0x99, 0x86, 0xd8, 0xb0, 0xf6, 0x7d, 0xca, 0x62, 0xcd, 0xf5, 0x71, 0xa7, 0x66, 0xac, 0xa5, 0x4c, + 0x3e, 0x82, 0x16, 0x53, 0xe3, 0x51, 0x22, 0xb9, 0x8f, 0x9d, 0x7a, 0xcf, 0x1a, 0xb4, 0x77, 0xdf, + 0xa6, 0x39, 0x38, 0x34, 0x03, 0x87, 0x16, 0xe0, 0xd0, 0x07, 0x82, 0xc7, 0xee, 0x1a, 0x53, 0xe3, + 0x27, 0x99, 0x2b, 0xa1, 0x70, 0x3d, 0xe0, 0x8a, 0x79, 0x11, 0x8e, 0x58, 0xaa, 0xc5, 0x48, 0xa2, + 0xe6, 0x12, 0x3b, 0x8d, 0x9e, 0x35, 0x58, 0x73, 0xdf, 0x2c, 0x4c, 0x7b, 0xa9, 0x16, 0xae, 0x31, + 0x90, 0x4f, 0x00, 0xf0, 0x28, 0xe1, 0x92, 0x69, 0x2e, 0xe2, 0xce, 0xaa, 0x29, 0x64, 0xd3, 0x1c, + 0x4f, 0x3a, 0xc5, 0x93, 0x3e, 0x9b, 0xe2, 0xb9, 0xdf, 0x78, 0xf1, 0xe7, 0xb6, 0xe5, 0xce, 0xc4, + 0xf4, 0xef, 0xc2, 0xb5, 0x02, 0x09, 0x17, 0x55, 0x22, 0x62, 0x85, 0xe4, 0x7d, 0xb8, 0x9a, 0x81, + 0x3a, 0x32, 0x90, 0x8c, 0x78, 0xa0, 0x3a, 0x56, 0xaf, 0x3e, 0x68, 0xb8, 0xeb, 0x99, 0xd6, 0x80, + 0xf3, 0x59, 0xa0, 0xfa, 0x3f, 0xd7, 0xe1, 0xfa, 0x50, 0x85, 0x5f, 0x26, 0x01, 0xd3, 0xf8, 0x74, + 0x6a, 0x51, 0x17, 0x12, 0xf4, 0x0c, 0xae, 0xa4, 0xc6, 0x77, 0xca, 0xd0, 0xbd, 0x05, 0x18, 0xaa, + 0x66, 0xa7, 0xb9, 0xc2, 0x9d, 0xa6, 0xb2, 0x7f, 0xaa, 0x41, 0x33, 0xd7, 0x91, 0x3e, 0x6c, 0x9c, + 0x6b, 0xdb, 0xd4, 0x6f, 0xb8, 0xed, 0x99, 0xae, 0xc9, 0xbb, 0xb0, 0x1e, 0xe3, 0xe1, 0xa8, 0xc2, + 0x5b, 0x3b, 0xc6, 0xc3, 0x2f, 0xa6, 0xd4, 0xdd, 0x87, 0x8d, 0xcc, 0xe5, 0x12, 0xf4, 0x65, 0xe1, + 0x7b, 0xcb, 0x32, 0xf8, 0x29, 0x5c, 0xcd, 0xca, 0x2d, 0xc1, 0x62, 0xd6, 0xe6, 0xa3, 0x33, 0x22, + 0x6f, 0xc2, 0x3b, 0xaf, 0x00, 0x6c, 0x4a, 0x6a, 0xff, 0x09, 0x90, 0xa1, 0x0a, 0x1f, 0xb0, 0xd8, + 0xc7, 0xa8, 0x34, 0x5f, 0x48, 0xd6, 0x1c, 0x96, 0xb5, 0x39, 0x2c, 0xfb, 0x37, 0xc0, 0x9e, 0xcf, + 0x58, 0xd6, 0xfb, 0xa3, 0x06, 0xeb, 0x43, 0x15, 0xee, 0xa7, 0xc7, 0x0f, 0xb9, 0x44, 0x5f, 0x93, + 0x4d, 0x58, 0xf5, 0xd2, 0xe3, 0xb2, 0x52, 0x2e, 0x90, 0xc7, 0x95, 0xb5, 0xdd, 0x5d, 0x60, 0x28, + 0xca, 0x9c, 0x95, 0xdd, 0xfd, 0xa7, 0xdc, 0xdd, 0x05, 0xda, 0x3f, 0xb7, 0xbe, 0xf5, 0xf9, 0xf5, + 0xf5, 0x78, 0x50, 0xf0, 0xdf, 0xf8, 0xdf, 0xf5, 0xf5, 0x78, 0xf0, 0x5a, 0xf2, 0x57, 0x2f, 0x22, + 0xff, 0x2e, 0xbc, 0x95, 0xbb, 0x4c, 0x30, 0xd6, 0xa3, 0xef, 0x52, 0xc9, 0x55, 0xc0, 0x7d, 0x33, + 0x05, 0x4d, 0xd3, 0xd2, 0xd6, 0x99, 0xf9, 0xf1, 0x8c, 0xb5, 0xbf, 0x05, 0x9b, 0xb3, 0x40, 0x94, + 0xa8, 0xff, 0x62, 0x19, 0x9a, 0xf7, 0x82, 0x60, 0x2f, 0x8a, 0xc4, 0x21, 0x06, 0xf9, 0xa9, 0xba, + 0x01, 0x2d, 0x96, 0xea, 0x03, 0x21, 0xb3, 0xc7, 0xe6, 0xf8, 0x9f, 0x29, 0xc8, 0x4d, 0x00, 0x8f, + 0xc5, 0xe3, 0xe2, 0xd0, 0xe5, 0x2b, 0xd1, 0xca, 0x34, 0x79, 0xf0, 0x7b, 0xb0, 0x11, 0x70, 0x95, + 0x44, 0xec, 0xb8, 0xf0, 0xc8, 0xd1, 0x5a, 0x2f, 0x94, 0xe5, 0x31, 0xc4, 0xa3, 0x44, 0xc4, 0x18, + 0x6b, 0x03, 0xd8, 0x86, 0x5b, 0xca, 0xc5, 0xa0, 0x54, 0x7a, 0x9a, 0xb6, 0xbc, 0xfb, 0x77, 0x03, + 0xea, 0x43, 0x15, 0x92, 0x6f, 0xa0, 0x61, 0x0e, 0xfc, 0xad, 0x05, 0x0f, 0xb7, 0xed, 0x2c, 0xe8, + 0x58, 0xde, 0xb5, 0x1f, 0x2d, 0x78, 0x63, 0xee, 0x5c, 0xdd, 0x59, 0xe2, 0x0a, 0xd9, 0x1f, 0x2f, + 0x11, 0x54, 0xb6, 0xf1, 0x83, 0x05, 0xd7, 0xaa, 0x7b, 0xb8, 0xc8, 0xd8, 0x57, 0x62, 0xec, 0x7b, + 0x97, 0x8f, 0x29, 0x7b, 0x10, 0xd0, 0x3a, 0xdb, 0xcc, 0x0f, 0x2e, 0xb3, 0x73, 0xf6, 0x87, 0x97, + 0xf1, 0x3e, 0xf7, 0xe8, 0xea, 0x54, 0x2e, 0xf2, 0xe8, 0x4a, 0xcc, 0x42, 0x8f, 0xbe, 0x60, 0xd2, + 0xf6, 0xbf, 0xfa, 0xf5, 0xa4, 0x6b, 0xbd, 0x3c, 0xe9, 0x5a, 0x7f, 0x9d, 0x74, 0xad, 0x17, 0xa7, + 0xdd, 0x95, 0x97, 0xa7, 0xdd, 0x95, 0xdf, 0x4e, 0xbb, 0x2b, 0x5f, 0xdf, 0x0f, 0xb9, 0x3e, 0x48, + 0x3d, 0xea, 0x8b, 0x89, 0x63, 0xf2, 0xdf, 0x8e, 0x51, 0x1f, 0x0a, 0x39, 0x2e, 0xa4, 0x08, 0x83, + 0x10, 0xa5, 0x73, 0xf4, 0xea, 0x5f, 0x24, 0xaf, 0x69, 0x6e, 0xf4, 0x9d, 0xff, 0x02, 0x00, 0x00, + 0xff, 0xff, 0x48, 0xae, 0x39, 0xbd, 0x48, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -765,6 +888,10 @@ type MsgClient interface { CancelSellOrder(ctx context.Context, in *MsgCancelSellOrder, opts ...grpc.CallOption) (*MsgCancelSellOrderResponse, error) // BuyDirect purchases credits directly from the specified sell order. BuyDirect(ctx context.Context, in *MsgBuyDirect, opts ...grpc.CallOption) (*MsgBuyDirectResponse, error) + // AddAllowedDenom is a governance method that allows the addition of + // new allowed denom. + // Since Revision 1 + AddAllowedDenom(ctx context.Context, in *MsgAddAllowedDenom, opts ...grpc.CallOption) (*MsgAddAllowedDenomResponse, error) } type msgClient struct { @@ -811,6 +938,15 @@ func (c *msgClient) BuyDirect(ctx context.Context, in *MsgBuyDirect, opts ...grp return out, nil } +func (c *msgClient) AddAllowedDenom(ctx context.Context, in *MsgAddAllowedDenom, opts ...grpc.CallOption) (*MsgAddAllowedDenomResponse, error) { + out := new(MsgAddAllowedDenomResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1.Msg/AddAllowedDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // Sell creates new sell orders. @@ -821,6 +957,10 @@ type MsgServer interface { CancelSellOrder(context.Context, *MsgCancelSellOrder) (*MsgCancelSellOrderResponse, error) // BuyDirect purchases credits directly from the specified sell order. BuyDirect(context.Context, *MsgBuyDirect) (*MsgBuyDirectResponse, error) + // AddAllowedDenom is a governance method that allows the addition of + // new allowed denom. + // Since Revision 1 + AddAllowedDenom(context.Context, *MsgAddAllowedDenom) (*MsgAddAllowedDenomResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -839,6 +979,9 @@ func (*UnimplementedMsgServer) CancelSellOrder(ctx context.Context, req *MsgCanc func (*UnimplementedMsgServer) BuyDirect(ctx context.Context, req *MsgBuyDirect) (*MsgBuyDirectResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BuyDirect not implemented") } +func (*UnimplementedMsgServer) AddAllowedDenom(ctx context.Context, req *MsgAddAllowedDenom) (*MsgAddAllowedDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddAllowedDenom not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -916,6 +1059,24 @@ func _Msg_BuyDirect_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _Msg_AddAllowedDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddAllowedDenom) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddAllowedDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1.Msg/AddAllowedDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddAllowedDenom(ctx, req.(*MsgAddAllowedDenom)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "regen.ecocredit.marketplace.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -936,6 +1097,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "BuyDirect", Handler: _Msg_BuyDirect_Handler, }, + { + MethodName: "AddAllowedDenom", + Handler: _Msg_AddAllowedDenom_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "regen/ecocredit/marketplace/v1/tx.proto", @@ -1418,6 +1583,78 @@ func (m *MsgBuyDirectResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgAddAllowedDenom) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddAllowedDenom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAllowedDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Exponent != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x20 + } + if len(m.DisplayDenom) > 0 { + i -= len(m.DisplayDenom) + copy(dAtA[i:], m.DisplayDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.DisplayDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.BankDenom) > 0 { + i -= len(m.BankDenom) + copy(dAtA[i:], m.BankDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BankDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddAllowedDenomResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgAddAllowedDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddAllowedDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1627,6 +1864,39 @@ func (m *MsgBuyDirectResponse) Size() (n int) { return n } +func (m *MsgAddAllowedDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BankDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DisplayDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovTx(uint64(m.Exponent)) + } + return n +} + +func (m *MsgAddAllowedDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2946,6 +3216,221 @@ func (m *MsgBuyDirectResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgAddAllowedDenom) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddAllowedDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddAllowedDenom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BankDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BankDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisplayDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisplayDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + } + m.Exponent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exponent |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddAllowedDenomResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddAllowedDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddAllowedDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ecocredit/marketplace/types.pb.go b/x/ecocredit/marketplace/types.pb.go index 9f7eb698ec..d0f4318b9d 100644 --- a/x/ecocredit/marketplace/types.pb.go +++ b/x/ecocredit/marketplace/types.pb.go @@ -5,7 +5,6 @@ package marketplace import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" math "math" @@ -25,6 +24,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // AllowDenomProposal is a gov Content type for approving a denom for use in the // marketplace. +// Deprecated (Since Revision 1): This message is no longer used and will be removed +// in the next version. See MsgAddAllowedDenom. type AllowDenomProposal struct { // title is the title of the proposal. Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` @@ -35,8 +36,9 @@ type AllowDenomProposal struct { Denom *AllowedDenom `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` } -func (m *AllowDenomProposal) Reset() { *m = AllowDenomProposal{} } -func (*AllowDenomProposal) ProtoMessage() {} +func (m *AllowDenomProposal) Reset() { *m = AllowDenomProposal{} } +func (m *AllowDenomProposal) String() string { return proto.CompactTextString(m) } +func (*AllowDenomProposal) ProtoMessage() {} func (*AllowDenomProposal) Descriptor() ([]byte, []int) { return fileDescriptor_eff2ca0c007ee426, []int{0} } @@ -97,24 +99,23 @@ func init() { } var fileDescriptor_eff2ca0c007ee426 = []byte{ - // 269 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x31, 0x4b, 0x03, 0x31, - 0x1c, 0xc5, 0x2f, 0x6a, 0x05, 0xaf, 0xdb, 0xd1, 0xa1, 0x74, 0x88, 0x87, 0x53, 0x11, 0x4d, 0xa8, - 0x6e, 0x82, 0x83, 0xc5, 0x0f, 0x20, 0x5d, 0x04, 0xb7, 0x6b, 0xf2, 0x27, 0x86, 0xe6, 0xee, 0x1f, - 0x72, 0x7f, 0x5b, 0xfd, 0x16, 0x4e, 0xe2, 0xe8, 0xc7, 0x71, 0xec, 0xe8, 0x28, 0x77, 0x5f, 0x44, - 0x9a, 0x13, 0xe9, 0x20, 0xba, 0xe5, 0x25, 0xbf, 0xf7, 0x1e, 0x2f, 0xe9, 0x71, 0x00, 0x03, 0x95, - 0x04, 0x85, 0x2a, 0x80, 0xb6, 0x24, 0xcb, 0x22, 0x2c, 0x80, 0xbc, 0x2b, 0x14, 0xc8, 0xe5, 0x44, - 0xd2, 0x93, 0x87, 0x5a, 0xf8, 0x80, 0x84, 0x19, 0x8f, 0xac, 0xf8, 0x61, 0xc5, 0x16, 0x2b, 0x96, - 0x93, 0xd1, 0xc0, 0xa0, 0xc1, 0x88, 0xca, 0xcd, 0xa9, 0x73, 0x8d, 0xfe, 0x6b, 0xa8, 0xa9, 0x20, - 0xe8, 0xd8, 0xa3, 0x17, 0x96, 0x66, 0x57, 0xce, 0xe1, 0xea, 0x1a, 0x2a, 0x2c, 0x6f, 0x02, 0x7a, - 0xac, 0x0b, 0x97, 0x0d, 0xd2, 0x1e, 0x59, 0x72, 0x30, 0x64, 0x39, 0x1b, 0x1f, 0xcc, 0x3a, 0x91, - 0xe5, 0x69, 0x5f, 0x43, 0xad, 0x82, 0xf5, 0x64, 0xb1, 0x1a, 0xee, 0xc4, 0xb7, 0xed, 0xab, 0x6c, - 0x9a, 0xf6, 0xf4, 0x26, 0x68, 0xb8, 0x9b, 0xb3, 0x71, 0xff, 0xec, 0x44, 0xfc, 0x3d, 0x40, 0xc4, - 0x6a, 0xd0, 0xb1, 0x7c, 0xd6, 0x59, 0x2f, 0xf6, 0x5e, 0xdf, 0x0e, 0x93, 0xe9, 0xed, 0x7b, 0xc3, - 0xd9, 0xba, 0xe1, 0xec, 0xb3, 0xe1, 0xec, 0xb9, 0xe5, 0xc9, 0xba, 0xe5, 0xc9, 0x47, 0xcb, 0x93, - 0xbb, 0x4b, 0x63, 0xe9, 0xfe, 0x61, 0x2e, 0x14, 0x96, 0x32, 0xc6, 0x9f, 0x56, 0x40, 0x2b, 0x0c, - 0x8b, 0x6f, 0xe5, 0x40, 0x1b, 0x08, 0xf2, 0xf1, 0xf7, 0x0f, 0x98, 0xef, 0xc7, 0xe1, 0xe7, 0x5f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xd6, 0x4d, 0x03, 0x95, 0x88, 0x01, 0x00, 0x00, + // 248 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x8f, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x86, 0x63, 0x50, 0x91, 0x70, 0x37, 0x8b, 0x21, 0x62, 0xb0, 0x22, 0xa6, 0x0a, 0x81, 0xad, + 0xc2, 0xcc, 0x40, 0xc5, 0x03, 0xa0, 0x2e, 0x48, 0x6c, 0xa9, 0x7d, 0x0a, 0x56, 0x9d, 0x9c, 0xe5, + 0x1c, 0x2d, 0xbc, 0x45, 0x1f, 0x8b, 0xb1, 0x23, 0x23, 0x4a, 0x5e, 0x04, 0xe1, 0x20, 0x94, 0x01, + 0xc1, 0xf8, 0xdf, 0xfd, 0xf7, 0xfd, 0xf7, 0xf3, 0xf3, 0x08, 0x15, 0x34, 0x1a, 0x0c, 0x9a, 0x08, + 0xd6, 0x91, 0xae, 0xcb, 0xb8, 0x06, 0x0a, 0xbe, 0x34, 0xa0, 0x37, 0x73, 0x4d, 0xaf, 0x01, 0x5a, + 0x15, 0x22, 0x12, 0x0a, 0x99, 0xbc, 0xea, 0xc7, 0xab, 0x46, 0x5e, 0xb5, 0x99, 0x9f, 0xfe, 0xc7, + 0x6a, 0xa9, 0x24, 0x18, 0x58, 0x67, 0x3b, 0xc6, 0xc5, 0xad, 0xf7, 0xb8, 0xbd, 0x83, 0x06, 0xeb, + 0xfb, 0x88, 0x01, 0xdb, 0xd2, 0x8b, 0x13, 0x3e, 0x21, 0x47, 0x1e, 0x72, 0x56, 0xb0, 0xd9, 0xf1, + 0x72, 0x10, 0xa2, 0xe0, 0x53, 0x0b, 0xad, 0x89, 0x2e, 0x90, 0xc3, 0x26, 0x3f, 0x48, 0xbb, 0xf1, + 0x48, 0x2c, 0xf8, 0xc4, 0x7e, 0x81, 0xf2, 0xc3, 0x82, 0xcd, 0xa6, 0x57, 0x17, 0xea, 0xef, 0x57, + 0x55, 0x8a, 0x06, 0x9b, 0xc2, 0x97, 0xc3, 0xe9, 0xe2, 0xe1, 0xad, 0x93, 0x6c, 0xdf, 0x49, 0xf6, + 0xd1, 0x49, 0xb6, 0xeb, 0x65, 0xb6, 0xef, 0x65, 0xf6, 0xde, 0xcb, 0xec, 0xf1, 0xa6, 0x72, 0xf4, + 0xf4, 0xbc, 0x52, 0x06, 0x6b, 0x9d, 0xc0, 0x97, 0x0d, 0xd0, 0x16, 0xe3, 0xfa, 0x5b, 0x79, 0xb0, + 0x15, 0x44, 0xfd, 0xf2, 0x7b, 0xf5, 0xd5, 0x51, 0xaa, 0x7c, 0xfd, 0x19, 0x00, 0x00, 0xff, 0xff, + 0x3b, 0xf1, 0x94, 0xcf, 0x6c, 0x01, 0x00, 0x00, } func (m *AllowDenomProposal) Marshal() (dAtA []byte, err error) { diff --git a/x/ecocredit/server/expected_keepers.go b/x/ecocredit/server/expected_keepers.go index 8206097aa3..bf0a42c16a 100644 --- a/x/ecocredit/server/expected_keepers.go +++ b/x/ecocredit/server/expected_keepers.go @@ -6,6 +6,5 @@ import ( // Keeper defines a set of methods the ecocredit module exposes. type Keeper interface { - ProposalKeeper PruneOrders(ctx sdk.Context) error } diff --git a/x/ecocredit/server/marketplace/allow_denom.go b/x/ecocredit/server/marketplace/allow_denom.go deleted file mode 100644 index 23e73c50bc..0000000000 --- a/x/ecocredit/server/marketplace/allow_denom.go +++ /dev/null @@ -1,29 +0,0 @@ -package marketplace - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" -) - -// AllowDenom is a gov handler method that adds a denom to the list of approved denoms that may be used in the -// marketplace. -func (k Keeper) AllowDenom(ctx sdk.Context, p *marketplace.AllowDenomProposal) error { - if p == nil { - return sdkerrors.ErrInvalidRequest.Wrap("nil proposal") - } - if err := p.ValidateBasic(); err != nil { - return err - } - denom := p.Denom - if err := k.stateStore.AllowedDenomTable().Insert(sdk.WrapSDKContext(ctx), &api.AllowedDenom{ - BankDenom: denom.BankDenom, - DisplayDenom: denom.DisplayDenom, - Exponent: denom.Exponent, - }); err != nil { - return sdkerrors.ErrInvalidRequest.Wrapf("could not add denom %s: %s", denom.BankDenom, err.Error()) - } - return ctx.EventManager().EmitTypedEvent(&marketplace.EventAllowDenom{Denom: denom.BankDenom}) -} diff --git a/x/ecocredit/server/marketplace/features/msg_add_allowed_denom.feature b/x/ecocredit/server/marketplace/features/msg_add_allowed_denom.feature new file mode 100644 index 0000000000..6e3e0c0758 --- /dev/null +++ b/x/ecocredit/server/marketplace/features/msg_add_allowed_denom.feature @@ -0,0 +1,88 @@ +Feature: Msg/AddAllowedDenom + + An allowed denom can be added: + - when the authority is a governance account address + - when the denom does not exist + - the allowed denom is added + + Rule: The authority must be governance account address + + Scenario: The authority is a governance account address + When alice attempts to add a denom with properties + """ + { + "authority":"regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68", + "bank_denom":"uregen", + "display_denom":"REGEN", + "exponent":6 + } + """ + Then expect no error + + Scenario: The authority is not a governance account address + When alice attempts to add a denom with properties + """ + { + "authority":"regen1fua8speyxgempgy06gpfs0p4z32zznkqakm57s", + "bank_denom":"uregen", + "display_denom":"REGEN", + "exponent":6 + } + """ + Then expect error contains "expected gov account as only signer for proposal message" + + Rule: The allowed denom does not exists + + Scenario: The allowed denom does not exist + When alice attempts to add a denom with properties + """ + { + "authority":"regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68", + "bank_denom":"uregen", + "display_denom":"REGEN", + "exponent":6 + } + """ + Then expect no error + + Scenario: The bank denom exists + Given an allowed denom with properties + """ + { + "authority":"regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68", + "bank_denom":"uregen", + "display_denom":"REGEN", + "exponent":6 + } + """ + When alice attempts to add a denom with properties + """ + { + "authority":"regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68", + "bank_denom":"uregen", + "display_denom":"REGEN", + "exponent":6 + } + """ + Then expect the error "bank denom uregen already exists: conflict" + + Scenario: The display denom exists + Given an allowed denom with properties + """ + { + "authority":"regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68", + "bank_denom":"uregen", + "display_denom":"REGEN", + "exponent":6 + } + """ + When alice attempts to add a denom with properties + """ + { + "authority":"regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68", + "bank_denom":"uatom", + "display_denom":"REGEN", + "exponent":6 + } + """ + Then expect the error "display denom REGEN already exists: conflict" diff --git a/x/ecocredit/server/marketplace/keeper.go b/x/ecocredit/server/marketplace/keeper.go index 7c103b8cbe..2ed5c7bc23 100644 --- a/x/ecocredit/server/marketplace/keeper.go +++ b/x/ecocredit/server/marketplace/keeper.go @@ -1,6 +1,7 @@ package marketplace import ( + sdk "github.com/cosmos/cosmos-sdk/types" marketApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" ecoApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/x/ecocredit" @@ -12,14 +13,17 @@ type Keeper struct { coreStore ecoApi.StateStore bankKeeper ecocredit.BankKeeper paramsKeeper ecocredit.ParamKeeper + authority sdk.AccAddress } -func NewKeeper(ss marketApi.StateStore, cs ecoApi.StateStore, bk ecocredit.BankKeeper, params ecocredit.ParamKeeper) Keeper { +func NewKeeper(ss marketApi.StateStore, cs ecoApi.StateStore, bk ecocredit.BankKeeper, + params ecocredit.ParamKeeper, authority sdk.AccAddress) Keeper { return Keeper{ coreStore: cs, stateStore: ss, bankKeeper: bk, paramsKeeper: params, + authority: authority, } } diff --git a/x/ecocredit/server/marketplace/keeper_test.go b/x/ecocredit/server/marketplace/keeper_test.go index 2745b86c86..1ccd956064 100644 --- a/x/ecocredit/server/marketplace/keeper_test.go +++ b/x/ecocredit/server/marketplace/keeper_test.go @@ -74,7 +74,10 @@ func setupBase(t gocuke.TestingT, numAddresses int) *baseSuite { assert.NilError(t, err) s.bankKeeper = mocks.NewMockBankKeeper(s.ctrl) s.paramsKeeper = mocks.NewMockParamKeeper(s.ctrl) - s.k = NewKeeper(s.marketStore, s.coreStore, s.bankKeeper, s.paramsKeeper) + + authority, err := sdk.AccAddressFromBech32("regen1nzh226hxrsvf4k69sa8v0nfuzx5vgwkczk8j68") + assert.NilError(t, err) + s.k = NewKeeper(s.marketStore, s.coreStore, s.bankKeeper, s.paramsKeeper, authority) // set test accounts for i := 0; i < numAddresses; i++ { diff --git a/x/ecocredit/server/marketplace/msg_add_allowed_denom.go b/x/ecocredit/server/marketplace/msg_add_allowed_denom.go new file mode 100644 index 0000000000..13cd99ea00 --- /dev/null +++ b/x/ecocredit/server/marketplace/msg_add_allowed_denom.go @@ -0,0 +1,40 @@ +package marketplace + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" + "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" +) + +// AddAllowedDenom adds a denom to the list of approved denoms that may be used in the +// marketplace. +func (k Keeper) AddAllowedDenom(ctx context.Context, req *marketplace.MsgAddAllowedDenom) (*marketplace.MsgAddAllowedDenomResponse, error) { + if k.authority.String() != req.Authority { + return nil, govtypes.ErrInvalidSigner.Wrapf("invalid authority: expected %s, got %s", k.authority, req.Authority) + } + + if err := k.stateStore.AllowedDenomTable().Insert(ctx, &api.AllowedDenom{ + BankDenom: req.BankDenom, + DisplayDenom: req.DisplayDenom, + Exponent: req.Exponent, + }); err != nil { + if ormerrors.PrimaryKeyConstraintViolation.Is(err) { + return nil, sdkerrors.ErrConflict.Wrapf("bank denom %s already exists", req.BankDenom) + } else if ormerrors.UniqueKeyViolation.Is(err) { + return nil, sdkerrors.ErrConflict.Wrapf("display denom %s already exists", req.DisplayDenom) + } + + return nil, sdkerrors.ErrInvalidRequest.Wrapf("could not add denom: %s", err.Error()) + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + sdkCtx.EventManager().EmitTypedEvent(&marketplace.EventAllowDenom{Denom: req.BankDenom}) + + return &marketplace.MsgAddAllowedDenomResponse{}, nil +} diff --git a/x/ecocredit/server/marketplace/msg_add_allowed_denom_test.go b/x/ecocredit/server/marketplace/msg_add_allowed_denom_test.go new file mode 100644 index 0000000000..ec3a64b026 --- /dev/null +++ b/x/ecocredit/server/marketplace/msg_add_allowed_denom_test.go @@ -0,0 +1,60 @@ +package marketplace + +import ( + "encoding/json" + "testing" + + "github.com/regen-network/gocuke" + "github.com/stretchr/testify/require" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" + "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" +) + +type addAllowedDenomSuite struct { + *baseSuite + err error +} + +func TestAddAllowedDenom(t *testing.T) { + gocuke.NewRunner(t, &addAllowedDenomSuite{}).Path("./features/msg_add_allowed_denom.feature").Run() +} + +func (s *addAllowedDenomSuite) Before(t gocuke.TestingT) { + s.baseSuite = setupBase(t, 1) +} + +func (s *addAllowedDenomSuite) AnAllowedDenomWithProperties(a gocuke.DocString) { + var msg *marketplace.MsgAddAllowedDenom + + err := json.Unmarshal([]byte(a.Content), &msg) + require.NoError(s.t, err) + + err = s.k.stateStore.AllowedDenomTable().Insert(s.ctx, &api.AllowedDenom{ + BankDenom: msg.BankDenom, + DisplayDenom: msg.DisplayDenom, + Exponent: msg.Exponent, + }) + require.NoError(s.t, err) +} + +func (s *addAllowedDenomSuite) AliceAttemptsToAddADenomWithProperties(a gocuke.DocString) { + var msg *marketplace.MsgAddAllowedDenom + + err := json.Unmarshal([]byte(a.Content), &msg) + require.NoError(s.t, err) + + _, s.err = s.k.AddAllowedDenom(s.ctx, msg) +} + +func (s *addAllowedDenomSuite) ExpectNoError() { + require.NoError(s.t, s.err) +} + +func (s *addAllowedDenomSuite) ExpectTheError(a string) { + require.EqualError(s.t, s.err, a) +} + +func (s *addAllowedDenomSuite) ExpectErrorContains(a string) { + require.ErrorContains(s.t, s.err, a) +} diff --git a/x/ecocredit/server/proposal.go b/x/ecocredit/server/proposal.go deleted file mode 100644 index 3d9c636c5a..0000000000 --- a/x/ecocredit/server/proposal.go +++ /dev/null @@ -1,33 +0,0 @@ -package server - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - - "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" -) - -// ProposalKeeper defines methods for ecocredit gov handlers. -type ProposalKeeper interface { - AllowDenom(ctx sdk.Context, proposal *marketplace.AllowDenomProposal) error -} - -func (s serverImpl) AllowDenom(ctx sdk.Context, proposal *marketplace.AllowDenomProposal) error { - return s.marketplaceKeeper.AllowDenom(ctx, proposal) -} - -func NewProposalHandler(k ProposalKeeper) govv1beta1.Handler { - return func(ctx sdk.Context, content govv1beta1.Content) error { - switch c := content.(type) { - case *marketplace.AllowDenomProposal: - return handleAllowDenomProposal(ctx, k, c) - default: - return sdkerrors.ErrUnknownRequest.Wrapf("unrecognized proposal content type: %T", c) - } - } -} - -func handleAllowDenomProposal(ctx sdk.Context, k ProposalKeeper, proposal *marketplace.AllowDenomProposal) error { - return k.AllowDenom(ctx, proposal) -} diff --git a/x/ecocredit/server/proposal_test.go b/x/ecocredit/server/proposal_test.go deleted file mode 100644 index 5bc046348c..0000000000 --- a/x/ecocredit/server/proposal_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package server - -import ( - "context" - "testing" - - "github.com/golang/mock/gomock" - dbm "github.com/tendermint/tm-db" - "gotest.tools/v3/assert" - - "github.com/cosmos/cosmos-sdk/orm/model/ormtable" - "github.com/cosmos/cosmos-sdk/orm/testing/ormtest" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/basket" - "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" - "github.com/regen-network/regen-ledger/x/ecocredit/mocks" -) - -type baseSuite struct { - sdkCtx sdk.Context - ctx context.Context - server serverImpl -} - -func setup(t *testing.T) baseSuite { - s := baseSuite{} - storeKey := sdk.NewKVStoreKey("proposal_test.go") - ctrl := gomock.NewController(t) - accountKeeper := mocks.NewMockAccountKeeper(ctrl) - bankKeeper := mocks.NewMockBankKeeper(ctrl) - accountKeeper.EXPECT().GetModuleAddress(ecocredit.ModuleName).Return(sdk.AccAddress{}).Times(1) - accountKeeper.EXPECT().GetModuleAddress(basket.BasketSubModuleName).Return(sdk.AccAddress{}).Times(1) - s.server = newServer(storeKey, paramtypes.Subspace{}, accountKeeper, bankKeeper, sdk.AccAddress("")) - db := dbm.NewMemDB() - cms := store.NewCommitMultiStore(db) - cms.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - assert.NilError(t, cms.LoadLatestVersion()) - ormCtx := ormtable.WrapContextDefault(ormtest.NewMemoryBackend()) - s.sdkCtx = sdk.NewContext(cms, tmproto.Header{}, false, log.NewNopLogger()).WithContext(ormCtx) - s.ctx = sdk.WrapSDKContext(s.sdkCtx) - return s -} - -func TestProposal_AllowedDenom(t *testing.T) { - t.Parallel() - s := setup(t) - handler := NewProposalHandler(s.server) - proposal := marketplace.AllowDenomProposal{ - Title: "regen token", - Description: "i would like to use the regen token in the marketplace", - Denom: &marketplace.AllowedDenom{ - BankDenom: "uregen", - DisplayDenom: "regen", - Exponent: 18, - }, - } - err := handler(s.sdkCtx, &proposal) - assert.NilError(t, err) - res, err := s.server.marketplaceKeeper.AllowedDenoms(s.ctx, &marketplace.QueryAllowedDenomsRequest{}) - assert.NilError(t, err) - assert.Check(t, len(res.AllowedDenoms) == 1) - assert.DeepEqual(t, proposal.Denom, res.AllowedDenoms[0]) -} - -func TestProposal_Invalid(t *testing.T) { - t.Parallel() - s := setup(t) - handler := NewProposalHandler(s.server) - err := handler(s.sdkCtx, nil) - assert.ErrorContains(t, err, "unrecognized proposal content type") -} diff --git a/x/ecocredit/server/server.go b/x/ecocredit/server/server.go index a5064da68f..a0fbde1ba2 100644 --- a/x/ecocredit/server/server.go +++ b/x/ecocredit/server/server.go @@ -70,7 +70,7 @@ func newServer(storeKey storetypes.StoreKey, paramSpace paramtypes.Subspace, s.basketStore = basketStore s.coreKeeper = core.NewKeeper(coreStore, bankKeeper, s.paramSpace, coreAddr, authority) s.basketKeeper = basket.NewKeeper(basketStore, coreStore, bankKeeper, s.paramSpace, basketAddr) - s.marketplaceKeeper = marketplace.NewKeeper(marketStore, coreStore, bankKeeper, s.paramSpace) + s.marketplaceKeeper = marketplace.NewKeeper(marketStore, coreStore, bankKeeper, s.paramSpace, authority) return s }