From ea43f141a82238ca16784b77e1ca3a469e6ddde5 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Fri, 6 May 2022 08:41:43 -0700 Subject: [PATCH] feat(ecocredit): allow denom proposal handler (#1072) * wip: ask denom proposal * chore: move proposal to core * feat: ask denom proposal handler * fix: add ask denom setup to integration tests * fix: add ask denom to cli integration tests * chore: add proto message comment * fix: grpc test use default bond denom * chore: cleanup * feat: added event to credit type handler * chore: fix param changes test * perf: switch to single regexp match for credit type validation * chore: fix error strings, cli doc * chore: cleanup * fix: cli example str * refactor: consolidate naming * chore: remove edit * chore: cleanup * chore: apply suggestions from code review Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> * chore: fix cli string, remove exponent check * chore: address review, cleanup askDenom remnants, change event name * chore: imports * fix: integration test fail * chore: check SI units * fix: add type registration * chore: address review comments * refactor: AllowedDenomProposal -> AllowDenomProposal * refactor: file rename add_allowed_denom.go -> allow_denom.go * refactor: change handle function name * chore: address review * chore: use go install * Revert "chore: use go install" This reverts commit 44996371f7b9d1f2bac75ff66a8d6d5c43e01ab5. * refactor: change handlefunc name * chore: fix example string, remove flags * Update x/ecocredit/client/marketplace/proposal.go Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> * fix: add required gov proposal type registration for credit type proposal Co-authored-by: technicallyty <48813565+tytech3@users.noreply.github.com> Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> Co-authored-by: Tyler Goodman --- .../ecocredit/marketplace/v1/events.pulsar.go | 195 +-- .../ecocredit/marketplace/v1/types.pulsar.go | 756 ++++++++++ api/regen/ecocredit/v1/events.pulsar.go | 511 ++++++- api/regen/ecocredit/v1/types.pulsar.go | 1221 +++------------ app/app.go | 4 +- app/experimental_appconfig.go | 3 +- app/stable_appconfig.go | 3 +- .../ecocredit/marketplace/v1/events.proto | 5 +- .../ecocredit/marketplace/v1/types.proto | 24 + proto/regen/ecocredit/v1/events.proto | 7 + proto/regen/ecocredit/v1/types.proto | 18 - x/ecocredit/client/marketplace/proposal.go | 86 ++ x/ecocredit/client/testsuite/grpc.go | 8 +- x/ecocredit/client/testsuite/query.go | 8 +- x/ecocredit/client/testsuite/tx.go | 13 +- x/ecocredit/client/tx.go | 2 - x/ecocredit/core/codec.go | 3 + x/ecocredit/core/events.pb.go | 258 +++- x/ecocredit/core/msg_credit_type.go | 15 +- x/ecocredit/core/msg_credit_type_proposal.go | 1 + x/ecocredit/core/params.go | 27 +- x/ecocredit/core/types.pb.go | 394 +---- x/ecocredit/core/utils.go | 3 +- x/ecocredit/marketplace/codec.go | 2 + x/ecocredit/marketplace/events.pb.go | 67 +- x/ecocredit/marketplace/msg_allowed_denom.go | 21 + .../marketplace/msg_allowed_denom_proposal.go | 43 + .../msg_allowed_denom_proposal_test.go | 69 + .../marketplace/msg_allowed_denom_test.go | 82 + x/ecocredit/marketplace/types.pb.go | 1344 ++--------------- x/ecocredit/server/core/add_credit_type.go | 4 +- x/ecocredit/server/core/proposal_handler.go | 29 - .../server/core/proposal_handler_test.go | 133 -- x/ecocredit/server/expected_keepers.go | 6 +- x/ecocredit/server/marketplace/allow_denom.go | 29 + .../marketplace/cancel_sell_order_test.go | 8 - x/ecocredit/server/marketplace/keeper_test.go | 18 +- x/ecocredit/server/marketplace/prune_test.go | 4 - .../marketplace/query_allowed_denoms.go | 30 +- .../marketplace/query_allowed_denoms_test.go | 43 + x/ecocredit/server/marketplace/sell.go | 6 +- x/ecocredit/server/marketplace/sell_test.go | 16 +- .../server/marketplace/update_sell_orders.go | 10 +- .../marketplace/update_sell_orders_test.go | 28 +- x/ecocredit/server/marketplace/utils.go | 11 +- x/ecocredit/server/proposal.go | 45 + x/ecocredit/server/proposal_test.go | 96 ++ x/ecocredit/server/server.go | 6 +- x/ecocredit/server/testsuite/suite.go | 12 +- x/ecocredit/simulation/genesis.go | 34 +- x/ecocredit/simulation/params.go | 10 - x/ecocredit/simulation/params_test.go | 14 +- 52 files changed, 2671 insertions(+), 3114 deletions(-) create mode 100644 api/regen/ecocredit/marketplace/v1/types.pulsar.go create mode 100644 proto/regen/ecocredit/marketplace/v1/types.proto create mode 100644 x/ecocredit/client/marketplace/proposal.go create mode 100644 x/ecocredit/marketplace/msg_allowed_denom.go create mode 100644 x/ecocredit/marketplace/msg_allowed_denom_proposal.go create mode 100644 x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go create mode 100644 x/ecocredit/marketplace/msg_allowed_denom_test.go delete mode 100644 x/ecocredit/server/core/proposal_handler.go delete mode 100644 x/ecocredit/server/core/proposal_handler_test.go create mode 100644 x/ecocredit/server/marketplace/allow_denom.go create mode 100644 x/ecocredit/server/marketplace/query_allowed_denoms_test.go create mode 100644 x/ecocredit/server/proposal.go create mode 100644 x/ecocredit/server/proposal_test.go diff --git a/api/regen/ecocredit/marketplace/v1/events.pulsar.go b/api/regen/ecocredit/marketplace/v1/events.pulsar.go index c4ce918e52..716a5ee10b 100644 --- a/api/regen/ecocredit/marketplace/v1/events.pulsar.go +++ b/api/regen/ecocredit/marketplace/v1/events.pulsar.go @@ -949,25 +949,25 @@ func (x *fastReflection_EventUpdateSellOrder) ProtoMethods() *protoiface.Methods } var ( - md_EventAllowAskDenom protoreflect.MessageDescriptor - fd_EventAllowAskDenom_denom protoreflect.FieldDescriptor + md_EventAllowDenom protoreflect.MessageDescriptor + fd_EventAllowDenom_denom protoreflect.FieldDescriptor ) func init() { file_regen_ecocredit_marketplace_v1_events_proto_init() - md_EventAllowAskDenom = File_regen_ecocredit_marketplace_v1_events_proto.Messages().ByName("EventAllowAskDenom") - fd_EventAllowAskDenom_denom = md_EventAllowAskDenom.Fields().ByName("denom") + md_EventAllowDenom = File_regen_ecocredit_marketplace_v1_events_proto.Messages().ByName("EventAllowDenom") + fd_EventAllowDenom_denom = md_EventAllowDenom.Fields().ByName("denom") } -var _ protoreflect.Message = (*fastReflection_EventAllowAskDenom)(nil) +var _ protoreflect.Message = (*fastReflection_EventAllowDenom)(nil) -type fastReflection_EventAllowAskDenom EventAllowAskDenom +type fastReflection_EventAllowDenom EventAllowDenom -func (x *EventAllowAskDenom) ProtoReflect() protoreflect.Message { - return (*fastReflection_EventAllowAskDenom)(x) +func (x *EventAllowDenom) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventAllowDenom)(x) } -func (x *EventAllowAskDenom) slowProtoReflect() protoreflect.Message { +func (x *EventAllowDenom) slowProtoReflect() protoreflect.Message { mi := &file_regen_ecocredit_marketplace_v1_events_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -979,43 +979,43 @@ func (x *EventAllowAskDenom) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_EventAllowAskDenom_messageType fastReflection_EventAllowAskDenom_messageType -var _ protoreflect.MessageType = fastReflection_EventAllowAskDenom_messageType{} +var _fastReflection_EventAllowDenom_messageType fastReflection_EventAllowDenom_messageType +var _ protoreflect.MessageType = fastReflection_EventAllowDenom_messageType{} -type fastReflection_EventAllowAskDenom_messageType struct{} +type fastReflection_EventAllowDenom_messageType struct{} -func (x fastReflection_EventAllowAskDenom_messageType) Zero() protoreflect.Message { - return (*fastReflection_EventAllowAskDenom)(nil) +func (x fastReflection_EventAllowDenom_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventAllowDenom)(nil) } -func (x fastReflection_EventAllowAskDenom_messageType) New() protoreflect.Message { - return new(fastReflection_EventAllowAskDenom) +func (x fastReflection_EventAllowDenom_messageType) New() protoreflect.Message { + return new(fastReflection_EventAllowDenom) } -func (x fastReflection_EventAllowAskDenom_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_EventAllowAskDenom +func (x fastReflection_EventAllowDenom_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventAllowDenom } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_EventAllowAskDenom) Descriptor() protoreflect.MessageDescriptor { - return md_EventAllowAskDenom +func (x *fastReflection_EventAllowDenom) Descriptor() protoreflect.MessageDescriptor { + return md_EventAllowDenom } // 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_EventAllowAskDenom) Type() protoreflect.MessageType { - return _fastReflection_EventAllowAskDenom_messageType +func (x *fastReflection_EventAllowDenom) Type() protoreflect.MessageType { + return _fastReflection_EventAllowDenom_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_EventAllowAskDenom) New() protoreflect.Message { - return new(fastReflection_EventAllowAskDenom) +func (x *fastReflection_EventAllowDenom) New() protoreflect.Message { + return new(fastReflection_EventAllowDenom) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_EventAllowAskDenom) Interface() protoreflect.ProtoMessage { - return (*EventAllowAskDenom)(x) +func (x *fastReflection_EventAllowDenom) Interface() protoreflect.ProtoMessage { + return (*EventAllowDenom)(x) } // Range iterates over every populated field in an undefined order, @@ -1023,10 +1023,10 @@ func (x *fastReflection_EventAllowAskDenom) Interface() protoreflect.ProtoMessag // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_EventAllowAskDenom) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_EventAllowDenom) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.Denom != "" { value := protoreflect.ValueOfString(x.Denom) - if !f(fd_EventAllowAskDenom_denom, value) { + if !f(fd_EventAllowDenom_denom, value) { return } } @@ -1043,15 +1043,15 @@ func (x *fastReflection_EventAllowAskDenom) Range(f func(protoreflect.FieldDescr // 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_EventAllowAskDenom) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_EventAllowDenom) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "regen.ecocredit.marketplace.v1.EventAllowAskDenom.denom": + case "regen.ecocredit.marketplace.v1.EventAllowDenom.denom": return x.Denom != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowAskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowDenom")) } - panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowAskDenom does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowDenom does not contain field %s", fd.FullName())) } } @@ -1061,15 +1061,15 @@ func (x *fastReflection_EventAllowAskDenom) Has(fd protoreflect.FieldDescriptor) // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventAllowAskDenom) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_EventAllowDenom) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "regen.ecocredit.marketplace.v1.EventAllowAskDenom.denom": + case "regen.ecocredit.marketplace.v1.EventAllowDenom.denom": x.Denom = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowAskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowDenom")) } - panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowAskDenom does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowDenom does not contain field %s", fd.FullName())) } } @@ -1079,16 +1079,16 @@ func (x *fastReflection_EventAllowAskDenom) Clear(fd protoreflect.FieldDescripto // 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_EventAllowAskDenom) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventAllowDenom) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "regen.ecocredit.marketplace.v1.EventAllowAskDenom.denom": + case "regen.ecocredit.marketplace.v1.EventAllowDenom.denom": value := x.Denom return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowAskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowDenom")) } - panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowAskDenom does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowDenom does not contain field %s", descriptor.FullName())) } } @@ -1102,15 +1102,15 @@ func (x *fastReflection_EventAllowAskDenom) Get(descriptor protoreflect.FieldDes // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventAllowAskDenom) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_EventAllowDenom) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "regen.ecocredit.marketplace.v1.EventAllowAskDenom.denom": + case "regen.ecocredit.marketplace.v1.EventAllowDenom.denom": x.Denom = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowAskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowDenom")) } - panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowAskDenom does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowDenom does not contain field %s", fd.FullName())) } } @@ -1124,40 +1124,40 @@ func (x *fastReflection_EventAllowAskDenom) Set(fd protoreflect.FieldDescriptor, // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventAllowAskDenom) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventAllowDenom) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.marketplace.v1.EventAllowAskDenom.denom": - panic(fmt.Errorf("field denom of message regen.ecocredit.marketplace.v1.EventAllowAskDenom is not mutable")) + case "regen.ecocredit.marketplace.v1.EventAllowDenom.denom": + panic(fmt.Errorf("field denom of message regen.ecocredit.marketplace.v1.EventAllowDenom is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowAskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowDenom")) } - panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowAskDenom does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowDenom 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_EventAllowAskDenom) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_EventAllowDenom) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.marketplace.v1.EventAllowAskDenom.denom": + case "regen.ecocredit.marketplace.v1.EventAllowDenom.denom": return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowAskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.EventAllowDenom")) } - panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowAskDenom does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.EventAllowDenom 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_EventAllowAskDenom) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_EventAllowDenom) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.marketplace.v1.EventAllowAskDenom", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.marketplace.v1.EventAllowDenom", d.FullName())) } panic("unreachable") } @@ -1165,7 +1165,7 @@ func (x *fastReflection_EventAllowAskDenom) WhichOneof(d protoreflect.OneofDescr // 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_EventAllowAskDenom) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_EventAllowDenom) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1176,7 +1176,7 @@ func (x *fastReflection_EventAllowAskDenom) GetUnknown() protoreflect.RawFields // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_EventAllowAskDenom) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_EventAllowDenom) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1188,7 +1188,7 @@ func (x *fastReflection_EventAllowAskDenom) SetUnknown(fields protoreflect.RawFi // 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_EventAllowAskDenom) IsValid() bool { +func (x *fastReflection_EventAllowDenom) IsValid() bool { return x != nil } @@ -1198,9 +1198,9 @@ func (x *fastReflection_EventAllowAskDenom) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_EventAllowAskDenom) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_EventAllowDenom) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*EventAllowAskDenom) + x := input.Message.Interface().(*EventAllowDenom) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1226,7 +1226,7 @@ func (x *fastReflection_EventAllowAskDenom) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*EventAllowAskDenom) + x := input.Message.Interface().(*EventAllowDenom) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1263,7 +1263,7 @@ func (x *fastReflection_EventAllowAskDenom) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*EventAllowAskDenom) + x := input.Message.Interface().(*EventAllowDenom) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1295,10 +1295,10 @@ func (x *fastReflection_EventAllowAskDenom) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventAllowAskDenom: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventAllowDenom: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventAllowAskDenom: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventAllowDenom: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1473,8 +1473,9 @@ func (x *EventUpdateSellOrder) GetOrderId() uint64 { return 0 } -// EventAllowAskDenom is an event emitted when an ask denom is added. -type EventAllowAskDenom struct { +// EventAllowDenom is an event emitted when a new denom is added for use in the +// marketplace. +type EventAllowDenom struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1483,8 +1484,8 @@ type EventAllowAskDenom struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` } -func (x *EventAllowAskDenom) Reset() { - *x = EventAllowAskDenom{} +func (x *EventAllowDenom) Reset() { + *x = EventAllowDenom{} if protoimpl.UnsafeEnabled { mi := &file_regen_ecocredit_marketplace_v1_events_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1492,18 +1493,18 @@ func (x *EventAllowAskDenom) Reset() { } } -func (x *EventAllowAskDenom) String() string { +func (x *EventAllowDenom) String() string { return protoimpl.X.MessageStringOf(x) } -func (*EventAllowAskDenom) ProtoMessage() {} +func (*EventAllowDenom) ProtoMessage() {} -// Deprecated: Use EventAllowAskDenom.ProtoReflect.Descriptor instead. -func (*EventAllowAskDenom) Descriptor() ([]byte, []int) { +// Deprecated: Use EventAllowDenom.ProtoReflect.Descriptor instead. +func (*EventAllowDenom) Descriptor() ([]byte, []int) { return file_regen_ecocredit_marketplace_v1_events_proto_rawDescGZIP(), []int{2} } -func (x *EventAllowAskDenom) GetDenom() string { +func (x *EventAllowDenom) GetDenom() string { if x != nil { return x.Denom } @@ -1526,28 +1527,28 @@ var file_regen_ecocredit_marketplace_v1_events_proto_rawDesc = []byte{ 0x64, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x6f, 0x72, 0x64, - 0x65, 0x72, 0x49, 0x64, 0x22, 0x2a, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c, - 0x6f, 0x77, 0x41, 0x73, 0x6b, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, - 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, - 0x42, 0xa4, 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, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 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, + 0x65, 0x72, 0x49, 0x64, 0x22, 0x27, 0x0a, 0x0f, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x6c, 0x6c, + 0x6f, 0x77, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x42, 0xa4, 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, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 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 ( @@ -1566,7 +1567,7 @@ var file_regen_ecocredit_marketplace_v1_events_proto_msgTypes = make([]protoimpl var file_regen_ecocredit_marketplace_v1_events_proto_goTypes = []interface{}{ (*EventSell)(nil), // 0: regen.ecocredit.marketplace.v1.EventSell (*EventUpdateSellOrder)(nil), // 1: regen.ecocredit.marketplace.v1.EventUpdateSellOrder - (*EventAllowAskDenom)(nil), // 2: regen.ecocredit.marketplace.v1.EventAllowAskDenom + (*EventAllowDenom)(nil), // 2: regen.ecocredit.marketplace.v1.EventAllowDenom } var file_regen_ecocredit_marketplace_v1_events_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for method output_type @@ -1607,7 +1608,7 @@ func file_regen_ecocredit_marketplace_v1_events_proto_init() { } } file_regen_ecocredit_marketplace_v1_events_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EventAllowAskDenom); i { + switch v := v.(*EventAllowDenom); i { case 0: return &v.state case 1: diff --git a/api/regen/ecocredit/marketplace/v1/types.pulsar.go b/api/regen/ecocredit/marketplace/v1/types.pulsar.go new file mode 100644 index 0000000000..8743dc5ad2 --- /dev/null +++ b/api/regen/ecocredit/marketplace/v1/types.pulsar.go @@ -0,0 +1,756 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +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" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_AllowDenomProposal protoreflect.MessageDescriptor + fd_AllowDenomProposal_title protoreflect.FieldDescriptor + fd_AllowDenomProposal_description protoreflect.FieldDescriptor + fd_AllowDenomProposal_denom protoreflect.FieldDescriptor +) + +func init() { + file_regen_ecocredit_marketplace_v1_types_proto_init() + md_AllowDenomProposal = File_regen_ecocredit_marketplace_v1_types_proto.Messages().ByName("AllowDenomProposal") + fd_AllowDenomProposal_title = md_AllowDenomProposal.Fields().ByName("title") + fd_AllowDenomProposal_description = md_AllowDenomProposal.Fields().ByName("description") + fd_AllowDenomProposal_denom = md_AllowDenomProposal.Fields().ByName("denom") +} + +var _ protoreflect.Message = (*fastReflection_AllowDenomProposal)(nil) + +type fastReflection_AllowDenomProposal AllowDenomProposal + +func (x *AllowDenomProposal) ProtoReflect() protoreflect.Message { + return (*fastReflection_AllowDenomProposal)(x) +} + +func (x *AllowDenomProposal) slowProtoReflect() protoreflect.Message { + mi := &file_regen_ecocredit_marketplace_v1_types_proto_msgTypes[0] + 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_AllowDenomProposal_messageType fastReflection_AllowDenomProposal_messageType +var _ protoreflect.MessageType = fastReflection_AllowDenomProposal_messageType{} + +type fastReflection_AllowDenomProposal_messageType struct{} + +func (x fastReflection_AllowDenomProposal_messageType) Zero() protoreflect.Message { + return (*fastReflection_AllowDenomProposal)(nil) +} +func (x fastReflection_AllowDenomProposal_messageType) New() protoreflect.Message { + return new(fastReflection_AllowDenomProposal) +} +func (x fastReflection_AllowDenomProposal_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_AllowDenomProposal +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_AllowDenomProposal) Descriptor() protoreflect.MessageDescriptor { + return md_AllowDenomProposal +} + +// 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_AllowDenomProposal) Type() protoreflect.MessageType { + return _fastReflection_AllowDenomProposal_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_AllowDenomProposal) New() protoreflect.Message { + return new(fastReflection_AllowDenomProposal) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_AllowDenomProposal) Interface() protoreflect.ProtoMessage { + return (*AllowDenomProposal)(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_AllowDenomProposal) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Title != "" { + value := protoreflect.ValueOfString(x.Title) + if !f(fd_AllowDenomProposal_title, value) { + return + } + } + if x.Description != "" { + value := protoreflect.ValueOfString(x.Description) + if !f(fd_AllowDenomProposal_description, value) { + return + } + } + if x.Denom != nil { + value := protoreflect.ValueOfMessage(x.Denom.ProtoReflect()) + if !f(fd_AllowDenomProposal_denom, value) { + return + } + } +} + +// 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_AllowDenomProposal) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.title": + return x.Title != "" + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.description": + return x.Description != "" + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.denom": + return x.Denom != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.AllowDenomProposal")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.AllowDenomProposal 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_AllowDenomProposal) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.title": + x.Title = "" + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.description": + x.Description = "" + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.denom": + x.Denom = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.AllowDenomProposal")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.AllowDenomProposal 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_AllowDenomProposal) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.title": + value := x.Title + return protoreflect.ValueOfString(value) + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.description": + value := x.Description + return protoreflect.ValueOfString(value) + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.denom": + value := x.Denom + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.AllowDenomProposal")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.AllowDenomProposal 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_AllowDenomProposal) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.title": + x.Title = value.Interface().(string) + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.description": + x.Description = value.Interface().(string) + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.denom": + x.Denom = value.Message().Interface().(*AllowedDenom) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.AllowDenomProposal")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.AllowDenomProposal 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_AllowDenomProposal) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.denom": + if x.Denom == nil { + x.Denom = new(AllowedDenom) + } + return protoreflect.ValueOfMessage(x.Denom.ProtoReflect()) + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.title": + panic(fmt.Errorf("field title of message regen.ecocredit.marketplace.v1.AllowDenomProposal is not mutable")) + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.description": + panic(fmt.Errorf("field description of message regen.ecocredit.marketplace.v1.AllowDenomProposal is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.AllowDenomProposal")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.AllowDenomProposal 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_AllowDenomProposal) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.title": + return protoreflect.ValueOfString("") + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.description": + return protoreflect.ValueOfString("") + case "regen.ecocredit.marketplace.v1.AllowDenomProposal.denom": + m := new(AllowedDenom) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.marketplace.v1.AllowDenomProposal")) + } + panic(fmt.Errorf("message regen.ecocredit.marketplace.v1.AllowDenomProposal 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_AllowDenomProposal) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.marketplace.v1.AllowDenomProposal", 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_AllowDenomProposal) 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_AllowDenomProposal) 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_AllowDenomProposal) 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_AllowDenomProposal) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*AllowDenomProposal) + 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.Title) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Description) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Denom != nil { + l = options.Size(x.Denom) + n += 1 + l + runtime.Sov(uint64(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().(*AllowDenomProposal) + 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.Denom != nil { + encoded, err := options.Marshal(x.Denom) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.Description) > 0 { + i -= len(x.Description) + copy(dAtA[i:], x.Description) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Description))) + i-- + dAtA[i] = 0x12 + } + if len(x.Title) > 0 { + i -= len(x.Title) + copy(dAtA[i:], x.Title) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Title))) + 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().(*AllowDenomProposal) + 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: AllowDenomProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AllowDenomProposal: 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 Title", 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.Title = 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 Description", 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.Description = 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 Denom", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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 + } + if x.Denom == nil { + x.Denom = &AllowedDenom{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Denom); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + 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/types.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) +) + +// AllowDenomProposal is a gov Content type for approving a denom for use in the +// marketplace. +type AllowDenomProposal struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // title is the title of the proposal. + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // description is the description of the proposal. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // denom contains coin denom information that will be added to the + // list of allowed denoms for use in the marketplace. + Denom *AllowedDenom `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (x *AllowDenomProposal) Reset() { + *x = AllowDenomProposal{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_marketplace_v1_types_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AllowDenomProposal) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllowDenomProposal) ProtoMessage() {} + +// Deprecated: Use AllowDenomProposal.ProtoReflect.Descriptor instead. +func (*AllowDenomProposal) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_marketplace_v1_types_proto_rawDescGZIP(), []int{0} +} + +func (x *AllowDenomProposal) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *AllowDenomProposal) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *AllowDenomProposal) GetDenom() *AllowedDenom { + if x != nil { + return x.Denom + } + return nil +} + +var File_regen_ecocredit_marketplace_v1_types_proto protoreflect.FileDescriptor + +var file_regen_ecocredit_marketplace_v1_types_proto_rawDesc = []byte{ + 0x0a, 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, 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, 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, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 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, +} + +var ( + file_regen_ecocredit_marketplace_v1_types_proto_rawDescOnce sync.Once + file_regen_ecocredit_marketplace_v1_types_proto_rawDescData = file_regen_ecocredit_marketplace_v1_types_proto_rawDesc +) + +func file_regen_ecocredit_marketplace_v1_types_proto_rawDescGZIP() []byte { + file_regen_ecocredit_marketplace_v1_types_proto_rawDescOnce.Do(func() { + file_regen_ecocredit_marketplace_v1_types_proto_rawDescData = protoimpl.X.CompressGZIP(file_regen_ecocredit_marketplace_v1_types_proto_rawDescData) + }) + return file_regen_ecocredit_marketplace_v1_types_proto_rawDescData +} + +var file_regen_ecocredit_marketplace_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_regen_ecocredit_marketplace_v1_types_proto_goTypes = []interface{}{ + (*AllowDenomProposal)(nil), // 0: regen.ecocredit.marketplace.v1.AllowDenomProposal + (*AllowedDenom)(nil), // 1: regen.ecocredit.marketplace.v1.AllowedDenom +} +var file_regen_ecocredit_marketplace_v1_types_proto_depIdxs = []int32{ + 1, // 0: regen.ecocredit.marketplace.v1.AllowDenomProposal.denom:type_name -> regen.ecocredit.marketplace.v1.AllowedDenom + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_regen_ecocredit_marketplace_v1_types_proto_init() } +func file_regen_ecocredit_marketplace_v1_types_proto_init() { + if File_regen_ecocredit_marketplace_v1_types_proto != nil { + return + } + file_regen_ecocredit_marketplace_v1_state_proto_init() + if !protoimpl.UnsafeEnabled { + file_regen_ecocredit_marketplace_v1_types_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AllowDenomProposal); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_regen_ecocredit_marketplace_v1_types_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_regen_ecocredit_marketplace_v1_types_proto_goTypes, + DependencyIndexes: file_regen_ecocredit_marketplace_v1_types_proto_depIdxs, + MessageInfos: file_regen_ecocredit_marketplace_v1_types_proto_msgTypes, + }.Build() + File_regen_ecocredit_marketplace_v1_types_proto = out.File + file_regen_ecocredit_marketplace_v1_types_proto_rawDesc = nil + file_regen_ecocredit_marketplace_v1_types_proto_goTypes = nil + file_regen_ecocredit_marketplace_v1_types_proto_depIdxs = nil +} diff --git a/api/regen/ecocredit/v1/events.pulsar.go b/api/regen/ecocredit/v1/events.pulsar.go index 86d4baf70e..3dd86a2453 100644 --- a/api/regen/ecocredit/v1/events.pulsar.go +++ b/api/regen/ecocredit/v1/events.pulsar.go @@ -7143,6 +7143,426 @@ func (x *fastReflection_EventBatchSealed) ProtoMethods() *protoiface.Methods { } } +var ( + md_EventAddCreditType protoreflect.MessageDescriptor + fd_EventAddCreditType_abbreviation protoreflect.FieldDescriptor +) + +func init() { + file_regen_ecocredit_v1_events_proto_init() + md_EventAddCreditType = File_regen_ecocredit_v1_events_proto.Messages().ByName("EventAddCreditType") + fd_EventAddCreditType_abbreviation = md_EventAddCreditType.Fields().ByName("abbreviation") +} + +var _ protoreflect.Message = (*fastReflection_EventAddCreditType)(nil) + +type fastReflection_EventAddCreditType EventAddCreditType + +func (x *EventAddCreditType) ProtoReflect() protoreflect.Message { + return (*fastReflection_EventAddCreditType)(x) +} + +func (x *EventAddCreditType) slowProtoReflect() protoreflect.Message { + mi := &file_regen_ecocredit_v1_events_proto_msgTypes[13] + 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_EventAddCreditType_messageType fastReflection_EventAddCreditType_messageType +var _ protoreflect.MessageType = fastReflection_EventAddCreditType_messageType{} + +type fastReflection_EventAddCreditType_messageType struct{} + +func (x fastReflection_EventAddCreditType_messageType) Zero() protoreflect.Message { + return (*fastReflection_EventAddCreditType)(nil) +} +func (x fastReflection_EventAddCreditType_messageType) New() protoreflect.Message { + return new(fastReflection_EventAddCreditType) +} +func (x fastReflection_EventAddCreditType_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_EventAddCreditType +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_EventAddCreditType) Descriptor() protoreflect.MessageDescriptor { + return md_EventAddCreditType +} + +// 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_EventAddCreditType) Type() protoreflect.MessageType { + return _fastReflection_EventAddCreditType_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_EventAddCreditType) New() protoreflect.Message { + return new(fastReflection_EventAddCreditType) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_EventAddCreditType) Interface() protoreflect.ProtoMessage { + return (*EventAddCreditType)(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_EventAddCreditType) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Abbreviation != "" { + value := protoreflect.ValueOfString(x.Abbreviation) + if !f(fd_EventAddCreditType_abbreviation, value) { + return + } + } +} + +// 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_EventAddCreditType) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "regen.ecocredit.v1.EventAddCreditType.abbreviation": + return x.Abbreviation != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.EventAddCreditType")) + } + panic(fmt.Errorf("message regen.ecocredit.v1.EventAddCreditType 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_EventAddCreditType) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "regen.ecocredit.v1.EventAddCreditType.abbreviation": + x.Abbreviation = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.EventAddCreditType")) + } + panic(fmt.Errorf("message regen.ecocredit.v1.EventAddCreditType 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_EventAddCreditType) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "regen.ecocredit.v1.EventAddCreditType.abbreviation": + value := x.Abbreviation + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.EventAddCreditType")) + } + panic(fmt.Errorf("message regen.ecocredit.v1.EventAddCreditType 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_EventAddCreditType) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "regen.ecocredit.v1.EventAddCreditType.abbreviation": + x.Abbreviation = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.EventAddCreditType")) + } + panic(fmt.Errorf("message regen.ecocredit.v1.EventAddCreditType 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_EventAddCreditType) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.v1.EventAddCreditType.abbreviation": + panic(fmt.Errorf("field abbreviation of message regen.ecocredit.v1.EventAddCreditType is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.EventAddCreditType")) + } + panic(fmt.Errorf("message regen.ecocredit.v1.EventAddCreditType 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_EventAddCreditType) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.v1.EventAddCreditType.abbreviation": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.EventAddCreditType")) + } + panic(fmt.Errorf("message regen.ecocredit.v1.EventAddCreditType 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_EventAddCreditType) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.v1.EventAddCreditType", 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_EventAddCreditType) 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_EventAddCreditType) 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_EventAddCreditType) 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_EventAddCreditType) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*EventAddCreditType) + 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.Abbreviation) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(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().(*EventAddCreditType) + 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 len(x.Abbreviation) > 0 { + i -= len(x.Abbreviation) + copy(dAtA[i:], x.Abbreviation) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Abbreviation))) + 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().(*EventAddCreditType) + 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: EventAddCreditType: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: EventAddCreditType: 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 Abbreviation", 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.Abbreviation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + 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 @@ -7880,6 +8300,43 @@ func (x *EventBatchSealed) GetBatchDenom() string { return "" } +// EventAddCreditType is emitted when governance approves a new credit type. +type EventAddCreditType struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // abbreviation is the abbreviation of the credit type. + Abbreviation string `protobuf:"bytes,1,opt,name=abbreviation,proto3" json:"abbreviation,omitempty"` +} + +func (x *EventAddCreditType) Reset() { + *x = EventAddCreditType{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_v1_events_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EventAddCreditType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventAddCreditType) ProtoMessage() {} + +// Deprecated: Use EventAddCreditType.ProtoReflect.Descriptor instead. +func (*EventAddCreditType) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_v1_events_proto_rawDescGZIP(), []int{13} +} + +func (x *EventAddCreditType) GetAbbreviation() string { + if x != nil { + return x.Abbreviation + } + return "" +} + var File_regen_ecocredit_v1_events_proto protoreflect.FileDescriptor var file_regen_ecocredit_v1_events_proto_rawDesc = []byte{ @@ -7980,21 +8437,24 @@ var file_regen_ecocredit_v1_events_proto_rawDesc = []byte{ 0x45, 0x76, 0x65, 0x6e, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x53, 0x65, 0x61, 0x6c, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, - 0x6d, 0x42, 0xd9, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x48, 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, 0x76, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, - 0xca, 0x02, 0x12, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, - 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, - 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x22, 0x38, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x43, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x61, 0x62, 0x62, 0x72, 0x65, + 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, + 0x62, 0x62, 0x72, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0xd9, 0x01, 0x0a, 0x16, + 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x48, 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, 0x76, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0xa2, + 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, + 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x52, 0x65, 0x67, + 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0xe2, + 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x14, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -8009,7 +8469,7 @@ func file_regen_ecocredit_v1_events_proto_rawDescGZIP() []byte { return file_regen_ecocredit_v1_events_proto_rawDescData } -var file_regen_ecocredit_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 13) +var file_regen_ecocredit_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_regen_ecocredit_v1_events_proto_goTypes = []interface{}{ (*EventCreateClass)(nil), // 0: regen.ecocredit.v1.EventCreateClass (*EventCreateProject)(nil), // 1: regen.ecocredit.v1.EventCreateProject @@ -8024,10 +8484,11 @@ var file_regen_ecocredit_v1_events_proto_goTypes = []interface{}{ (*EventProjectAdminUpdated)(nil), // 10: regen.ecocredit.v1.EventProjectAdminUpdated (*EventProjectMetadataUpdated)(nil), // 11: regen.ecocredit.v1.EventProjectMetadataUpdated (*EventBatchSealed)(nil), // 12: regen.ecocredit.v1.EventBatchSealed - (*OriginTx)(nil), // 13: regen.ecocredit.v1.OriginTx + (*EventAddCreditType)(nil), // 13: regen.ecocredit.v1.EventAddCreditType + (*OriginTx)(nil), // 14: regen.ecocredit.v1.OriginTx } var file_regen_ecocredit_v1_events_proto_depIdxs = []int32{ - 13, // 0: regen.ecocredit.v1.EventMintBatchCredits.origin_tx:type_name -> regen.ecocredit.v1.OriginTx + 14, // 0: regen.ecocredit.v1.EventMintBatchCredits.origin_tx:type_name -> regen.ecocredit.v1.OriginTx 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -8198,6 +8659,18 @@ func file_regen_ecocredit_v1_events_proto_init() { return nil } } + file_regen_ecocredit_v1_events_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EventAddCreditType); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -8205,7 +8678,7 @@ func file_regen_ecocredit_v1_events_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_regen_ecocredit_v1_events_proto_rawDesc, NumEnums: 0, - NumMessages: 13, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/api/regen/ecocredit/v1/types.pulsar.go b/api/regen/ecocredit/v1/types.pulsar.go index e1d14d2fc9..90dca5ba91 100644 --- a/api/regen/ecocredit/v1/types.pulsar.go +++ b/api/regen/ecocredit/v1/types.pulsar.go @@ -162,64 +162,12 @@ func (x *_Params_3_list) IsValid() bool { return x.list != nil } -var _ protoreflect.List = (*_Params_6_list)(nil) - -type _Params_6_list struct { - list *[]*AskDenom -} - -func (x *_Params_6_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Params_6_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_Params_6_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*AskDenom) - (*x.list)[i] = concreteValue -} - -func (x *_Params_6_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*AskDenom) - *x.list = append(*x.list, concreteValue) -} - -func (x *_Params_6_list) AppendMutable() protoreflect.Value { - v := new(AskDenom) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Params_6_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_Params_6_list) NewElement() protoreflect.Value { - v := new(AskDenom) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Params_6_list) IsValid() bool { - return x.list != nil -} - var ( md_Params protoreflect.MessageDescriptor fd_Params_credit_class_fee protoreflect.FieldDescriptor fd_Params_basket_fee protoreflect.FieldDescriptor fd_Params_allowed_class_creators protoreflect.FieldDescriptor fd_Params_allowlist_enabled protoreflect.FieldDescriptor - fd_Params_allowed_ask_denoms protoreflect.FieldDescriptor ) func init() { @@ -229,7 +177,6 @@ func init() { fd_Params_basket_fee = md_Params.Fields().ByName("basket_fee") fd_Params_allowed_class_creators = md_Params.Fields().ByName("allowed_class_creators") fd_Params_allowlist_enabled = md_Params.Fields().ByName("allowlist_enabled") - fd_Params_allowed_ask_denoms = md_Params.Fields().ByName("allowed_ask_denoms") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -321,12 +268,6 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } - if len(x.AllowedAskDenoms) != 0 { - value := protoreflect.ValueOfList(&_Params_6_list{list: &x.AllowedAskDenoms}) - if !f(fd_Params_allowed_ask_denoms, value) { - return - } - } } // Has reports whether a field is populated. @@ -350,8 +291,6 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { return len(x.AllowedClassCreators) != 0 case "regen.ecocredit.v1.Params.allowlist_enabled": return x.AllowlistEnabled != false - case "regen.ecocredit.v1.Params.allowed_ask_denoms": - return len(x.AllowedAskDenoms) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) @@ -376,8 +315,6 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { x.AllowedClassCreators = nil case "regen.ecocredit.v1.Params.allowlist_enabled": x.AllowlistEnabled = false - case "regen.ecocredit.v1.Params.allowed_ask_denoms": - x.AllowedAskDenoms = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) @@ -415,12 +352,6 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "regen.ecocredit.v1.Params.allowlist_enabled": value := x.AllowlistEnabled return protoreflect.ValueOfBool(value) - case "regen.ecocredit.v1.Params.allowed_ask_denoms": - if len(x.AllowedAskDenoms) == 0 { - return protoreflect.ValueOfList(&_Params_6_list{}) - } - listValue := &_Params_6_list{list: &x.AllowedAskDenoms} - return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) @@ -439,726 +370,27 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "regen.ecocredit.v1.Params.credit_class_fee": - lv := value.List() - clv := lv.(*_Params_1_list) - x.CreditClassFee = *clv.list - case "regen.ecocredit.v1.Params.basket_fee": - lv := value.List() - clv := lv.(*_Params_2_list) - x.BasketFee = *clv.list - case "regen.ecocredit.v1.Params.allowed_class_creators": - lv := value.List() - clv := lv.(*_Params_3_list) - x.AllowedClassCreators = *clv.list - case "regen.ecocredit.v1.Params.allowlist_enabled": - x.AllowlistEnabled = value.Bool() - case "regen.ecocredit.v1.Params.allowed_ask_denoms": - lv := value.List() - clv := lv.(*_Params_6_list) - x.AllowedAskDenoms = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) - } - panic(fmt.Errorf("message regen.ecocredit.v1.Params 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_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "regen.ecocredit.v1.Params.credit_class_fee": - if x.CreditClassFee == nil { - x.CreditClassFee = []*v1beta1.Coin{} - } - value := &_Params_1_list{list: &x.CreditClassFee} - return protoreflect.ValueOfList(value) - case "regen.ecocredit.v1.Params.basket_fee": - if x.BasketFee == nil { - x.BasketFee = []*v1beta1.Coin{} - } - value := &_Params_2_list{list: &x.BasketFee} - return protoreflect.ValueOfList(value) - case "regen.ecocredit.v1.Params.allowed_class_creators": - if x.AllowedClassCreators == nil { - x.AllowedClassCreators = []string{} - } - value := &_Params_3_list{list: &x.AllowedClassCreators} - return protoreflect.ValueOfList(value) - case "regen.ecocredit.v1.Params.allowed_ask_denoms": - if x.AllowedAskDenoms == nil { - x.AllowedAskDenoms = []*AskDenom{} - } - value := &_Params_6_list{list: &x.AllowedAskDenoms} - return protoreflect.ValueOfList(value) - case "regen.ecocredit.v1.Params.allowlist_enabled": - panic(fmt.Errorf("field allowlist_enabled of message regen.ecocredit.v1.Params is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) - } - panic(fmt.Errorf("message regen.ecocredit.v1.Params 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_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "regen.ecocredit.v1.Params.credit_class_fee": - list := []*v1beta1.Coin{} - return protoreflect.ValueOfList(&_Params_1_list{list: &list}) - case "regen.ecocredit.v1.Params.basket_fee": - list := []*v1beta1.Coin{} - return protoreflect.ValueOfList(&_Params_2_list{list: &list}) - case "regen.ecocredit.v1.Params.allowed_class_creators": - list := []string{} - return protoreflect.ValueOfList(&_Params_3_list{list: &list}) - case "regen.ecocredit.v1.Params.allowlist_enabled": - return protoreflect.ValueOfBool(false) - case "regen.ecocredit.v1.Params.allowed_ask_denoms": - list := []*AskDenom{} - return protoreflect.ValueOfList(&_Params_6_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) - } - panic(fmt.Errorf("message regen.ecocredit.v1.Params 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_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.v1.Params", 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_Params) 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_Params) 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_Params) 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_Params) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.CreditClassFee) > 0 { - for _, e := range x.CreditClassFee { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if len(x.BasketFee) > 0 { - for _, e := range x.BasketFee { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if len(x.AllowedClassCreators) > 0 { - for _, s := range x.AllowedClassCreators { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.AllowlistEnabled { - n += 2 - } - if len(x.AllowedAskDenoms) > 0 { - for _, e := range x.AllowedAskDenoms { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(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().(*Params) - 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 len(x.AllowedAskDenoms) > 0 { - for iNdEx := len(x.AllowedAskDenoms) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.AllowedAskDenoms[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x32 - } - } - if x.AllowlistEnabled { - i-- - if x.AllowlistEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if len(x.AllowedClassCreators) > 0 { - for iNdEx := len(x.AllowedClassCreators) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.AllowedClassCreators[iNdEx]) - copy(dAtA[i:], x.AllowedClassCreators[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AllowedClassCreators[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(x.BasketFee) > 0 { - for iNdEx := len(x.BasketFee) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.BasketFee[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } - if len(x.CreditClassFee) > 0 { - for iNdEx := len(x.CreditClassFee) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.CreditClassFee[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - 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().(*Params) - 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: 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 CreditClassFee", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.CreditClassFee = append(x.CreditClassFee, &v1beta1.Coin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CreditClassFee[len(x.CreditClassFee)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BasketFee", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.BasketFee = append(x.BasketFee, &v1beta1.Coin{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BasketFee[len(x.BasketFee)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AllowedClassCreators", 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.AllowedClassCreators = append(x.AllowedClassCreators, 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 AllowlistEnabled", wireType) - } - var v int - 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++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.AllowlistEnabled = bool(v != 0) - case 6: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AllowedAskDenoms", wireType) - } - var msglen int - 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++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + msglen - 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.AllowedAskDenoms = append(x.AllowedAskDenoms, &AskDenom{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.AllowedAskDenoms[len(x.AllowedAskDenoms)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - 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_AskDenom protoreflect.MessageDescriptor - fd_AskDenom_denom protoreflect.FieldDescriptor - fd_AskDenom_display_denom protoreflect.FieldDescriptor - fd_AskDenom_exponent protoreflect.FieldDescriptor -) - -func init() { - file_regen_ecocredit_v1_types_proto_init() - md_AskDenom = File_regen_ecocredit_v1_types_proto.Messages().ByName("AskDenom") - fd_AskDenom_denom = md_AskDenom.Fields().ByName("denom") - fd_AskDenom_display_denom = md_AskDenom.Fields().ByName("display_denom") - fd_AskDenom_exponent = md_AskDenom.Fields().ByName("exponent") -} - -var _ protoreflect.Message = (*fastReflection_AskDenom)(nil) - -type fastReflection_AskDenom AskDenom - -func (x *AskDenom) ProtoReflect() protoreflect.Message { - return (*fastReflection_AskDenom)(x) -} - -func (x *AskDenom) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1_types_proto_msgTypes[1] - 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_AskDenom_messageType fastReflection_AskDenom_messageType -var _ protoreflect.MessageType = fastReflection_AskDenom_messageType{} - -type fastReflection_AskDenom_messageType struct{} - -func (x fastReflection_AskDenom_messageType) Zero() protoreflect.Message { - return (*fastReflection_AskDenom)(nil) -} -func (x fastReflection_AskDenom_messageType) New() protoreflect.Message { - return new(fastReflection_AskDenom) -} -func (x fastReflection_AskDenom_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_AskDenom -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_AskDenom) Descriptor() protoreflect.MessageDescriptor { - return md_AskDenom -} - -// 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_AskDenom) Type() protoreflect.MessageType { - return _fastReflection_AskDenom_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_AskDenom) New() protoreflect.Message { - return new(fastReflection_AskDenom) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_AskDenom) Interface() protoreflect.ProtoMessage { - return (*AskDenom)(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_AskDenom) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Denom != "" { - value := protoreflect.ValueOfString(x.Denom) - if !f(fd_AskDenom_denom, value) { - return - } - } - if x.DisplayDenom != "" { - value := protoreflect.ValueOfString(x.DisplayDenom) - if !f(fd_AskDenom_display_denom, value) { - return - } - } - if x.Exponent != uint32(0) { - value := protoreflect.ValueOfUint32(x.Exponent) - if !f(fd_AskDenom_exponent, value) { - return - } - } -} - -// 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_AskDenom) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "regen.ecocredit.v1.AskDenom.denom": - return x.Denom != "" - case "regen.ecocredit.v1.AskDenom.display_denom": - return x.DisplayDenom != "" - case "regen.ecocredit.v1.AskDenom.exponent": - return x.Exponent != uint32(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.AskDenom")) - } - panic(fmt.Errorf("message regen.ecocredit.v1.AskDenom 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_AskDenom) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "regen.ecocredit.v1.AskDenom.denom": - x.Denom = "" - case "regen.ecocredit.v1.AskDenom.display_denom": - x.DisplayDenom = "" - case "regen.ecocredit.v1.AskDenom.exponent": - x.Exponent = uint32(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.AskDenom")) - } - panic(fmt.Errorf("message regen.ecocredit.v1.AskDenom 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_AskDenom) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "regen.ecocredit.v1.AskDenom.denom": - value := x.Denom - return protoreflect.ValueOfString(value) - case "regen.ecocredit.v1.AskDenom.display_denom": - value := x.DisplayDenom - return protoreflect.ValueOfString(value) - case "regen.ecocredit.v1.AskDenom.exponent": - value := x.Exponent - return protoreflect.ValueOfUint32(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.AskDenom")) - } - panic(fmt.Errorf("message regen.ecocredit.v1.AskDenom 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_AskDenom) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "regen.ecocredit.v1.AskDenom.denom": - x.Denom = value.Interface().(string) - case "regen.ecocredit.v1.AskDenom.display_denom": - x.DisplayDenom = value.Interface().(string) - case "regen.ecocredit.v1.AskDenom.exponent": - x.Exponent = uint32(value.Uint()) + case "regen.ecocredit.v1.Params.credit_class_fee": + lv := value.List() + clv := lv.(*_Params_1_list) + x.CreditClassFee = *clv.list + case "regen.ecocredit.v1.Params.basket_fee": + lv := value.List() + clv := lv.(*_Params_2_list) + x.BasketFee = *clv.list + case "regen.ecocredit.v1.Params.allowed_class_creators": + lv := value.List() + clv := lv.(*_Params_3_list) + x.AllowedClassCreators = *clv.list + case "regen.ecocredit.v1.Params.allowlist_enabled": + x.AllowlistEnabled = value.Bool() default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.AskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) } - panic(fmt.Errorf("message regen.ecocredit.v1.AskDenom does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message regen.ecocredit.v1.Params does not contain field %s", fd.FullName())) } } @@ -1172,48 +404,67 @@ func (x *fastReflection_AskDenom) Set(fd protoreflect.FieldDescriptor, value pro // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AskDenom) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1.AskDenom.denom": - panic(fmt.Errorf("field denom of message regen.ecocredit.v1.AskDenom is not mutable")) - case "regen.ecocredit.v1.AskDenom.display_denom": - panic(fmt.Errorf("field display_denom of message regen.ecocredit.v1.AskDenom is not mutable")) - case "regen.ecocredit.v1.AskDenom.exponent": - panic(fmt.Errorf("field exponent of message regen.ecocredit.v1.AskDenom is not mutable")) + case "regen.ecocredit.v1.Params.credit_class_fee": + if x.CreditClassFee == nil { + x.CreditClassFee = []*v1beta1.Coin{} + } + value := &_Params_1_list{list: &x.CreditClassFee} + return protoreflect.ValueOfList(value) + case "regen.ecocredit.v1.Params.basket_fee": + if x.BasketFee == nil { + x.BasketFee = []*v1beta1.Coin{} + } + value := &_Params_2_list{list: &x.BasketFee} + return protoreflect.ValueOfList(value) + case "regen.ecocredit.v1.Params.allowed_class_creators": + if x.AllowedClassCreators == nil { + x.AllowedClassCreators = []string{} + } + value := &_Params_3_list{list: &x.AllowedClassCreators} + return protoreflect.ValueOfList(value) + case "regen.ecocredit.v1.Params.allowlist_enabled": + panic(fmt.Errorf("field allowlist_enabled of message regen.ecocredit.v1.Params is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.AskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) } - panic(fmt.Errorf("message regen.ecocredit.v1.AskDenom does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message regen.ecocredit.v1.Params 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_AskDenom) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1.AskDenom.denom": - return protoreflect.ValueOfString("") - case "regen.ecocredit.v1.AskDenom.display_denom": - return protoreflect.ValueOfString("") - case "regen.ecocredit.v1.AskDenom.exponent": - return protoreflect.ValueOfUint32(uint32(0)) + case "regen.ecocredit.v1.Params.credit_class_fee": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_Params_1_list{list: &list}) + case "regen.ecocredit.v1.Params.basket_fee": + list := []*v1beta1.Coin{} + return protoreflect.ValueOfList(&_Params_2_list{list: &list}) + case "regen.ecocredit.v1.Params.allowed_class_creators": + list := []string{} + return protoreflect.ValueOfList(&_Params_3_list{list: &list}) + case "regen.ecocredit.v1.Params.allowlist_enabled": + return protoreflect.ValueOfBool(false) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.AskDenom")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1.Params")) } - panic(fmt.Errorf("message regen.ecocredit.v1.AskDenom does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message regen.ecocredit.v1.Params 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_AskDenom) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.v1.AskDenom", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.v1.Params", d.FullName())) } panic("unreachable") } @@ -1221,7 +472,7 @@ func (x *fastReflection_AskDenom) WhichOneof(d protoreflect.OneofDescriptor) pro // 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_AskDenom) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1232,7 +483,7 @@ func (x *fastReflection_AskDenom) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_AskDenom) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1244,7 +495,7 @@ func (x *fastReflection_AskDenom) SetUnknown(fields protoreflect.RawFields) { // 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_AskDenom) IsValid() bool { +func (x *fastReflection_Params) IsValid() bool { return x != nil } @@ -1254,9 +505,9 @@ func (x *fastReflection_AskDenom) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*AskDenom) + x := input.Message.Interface().(*Params) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1268,16 +519,26 @@ func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Denom) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.CreditClassFee) > 0 { + for _, e := range x.CreditClassFee { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } } - l = len(x.DisplayDenom) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.BasketFee) > 0 { + for _, e := range x.BasketFee { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.AllowedClassCreators) > 0 { + for _, s := range x.AllowedClassCreators { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } } - if x.Exponent != 0 { - n += 1 + runtime.Sov(uint64(x.Exponent)) + if x.AllowlistEnabled { + n += 2 } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1289,7 +550,7 @@ func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*AskDenom) + x := input.Message.Interface().(*Params) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1308,24 +569,56 @@ func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Exponent != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Exponent)) + if x.AllowlistEnabled { i-- - dAtA[i] = 0x18 - } - if len(x.DisplayDenom) > 0 { - i -= len(x.DisplayDenom) - copy(dAtA[i:], x.DisplayDenom) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DisplayDenom))) + if x.AllowlistEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x20 } - if len(x.Denom) > 0 { - i -= len(x.Denom) - copy(dAtA[i:], x.Denom) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom))) - i-- - dAtA[i] = 0xa + if len(x.AllowedClassCreators) > 0 { + for iNdEx := len(x.AllowedClassCreators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.AllowedClassCreators[iNdEx]) + copy(dAtA[i:], x.AllowedClassCreators[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AllowedClassCreators[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(x.BasketFee) > 0 { + for iNdEx := len(x.BasketFee) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.BasketFee[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.CreditClassFee) > 0 { + for iNdEx := len(x.CreditClassFee) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.CreditClassFee[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1338,7 +631,7 @@ func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*AskDenom) + x := input.Message.Interface().(*Params) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1370,17 +663,17 @@ func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AskDenom: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: AskDenom: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: 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 Denom", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CreditClassFee", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1390,27 +683,63 @@ func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen 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.Denom = string(dAtA[iNdEx:postIndex]) + x.CreditClassFee = append(x.CreditClassFee, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CreditClassFee[len(x.CreditClassFee)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field DisplayDenom", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BasketFee", wireType) + } + var msglen int + 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++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + 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.BasketFee = append(x.BasketFee, &v1beta1.Coin{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.BasketFee[len(x.BasketFee)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AllowedClassCreators", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1438,13 +767,13 @@ func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.DisplayDenom = string(dAtA[iNdEx:postIndex]) + x.AllowedClassCreators = append(x.AllowedClassCreators, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 3: + case 4: if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AllowlistEnabled", wireType) } - x.Exponent = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1454,11 +783,12 @@ func (x *fastReflection_AskDenom) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.Exponent |= uint32(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + x.AllowlistEnabled = bool(v != 0) default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1516,7 +846,7 @@ func (x *OriginTx) ProtoReflect() protoreflect.Message { } func (x *OriginTx) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1_types_proto_msgTypes[2] + mi := &file_regen_ecocredit_v1_types_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2002,7 +1332,7 @@ func (x *CreditTypeProposal) ProtoReflect() protoreflect.Message { } func (x *CreditTypeProposal) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1_types_proto_msgTypes[3] + mi := &file_regen_ecocredit_v1_types_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2571,9 +1901,6 @@ type Params struct { // allowlist_enabled is a param that enables/disables the allowlist for credit // creation AllowlistEnabled bool `protobuf:"varint,4,opt,name=allowlist_enabled,json=allowlistEnabled,proto3" json:"allowlist_enabled,omitempty"` - // allowed_ask_denoms is a list of denoms (and display information) allowed to - // be used in sell order ask prices. - AllowedAskDenoms []*AskDenom `protobuf:"bytes,6,rep,name=allowed_ask_denoms,json=allowedAskDenoms,proto3" json:"allowed_ask_denoms,omitempty"` } func (x *Params) Reset() { @@ -2624,69 +1951,6 @@ func (x *Params) GetAllowlistEnabled() bool { return false } -func (x *Params) GetAllowedAskDenoms() []*AskDenom { - if x != nil { - return x.AllowedAskDenoms - } - return nil -} - -// AskDenom defines the structure for a coin denom. -type AskDenom struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // denom is the denom to allow (ex. ibc/GLKHDSG423SGS) - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // display_denom is the denom to display to the user and is informational - DisplayDenom string `protobuf:"bytes,2,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,3,opt,name=exponent,proto3" json:"exponent,omitempty"` -} - -func (x *AskDenom) Reset() { - *x = AskDenom{} - if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1_types_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AskDenom) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AskDenom) ProtoMessage() {} - -// Deprecated: Use AskDenom.ProtoReflect.Descriptor instead. -func (*AskDenom) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1_types_proto_rawDescGZIP(), []int{1} -} - -func (x *AskDenom) GetDenom() string { - if x != nil { - return x.Denom - } - return "" -} - -func (x *AskDenom) GetDisplayDenom() string { - if x != nil { - return x.DisplayDenom - } - return "" -} - -func (x *AskDenom) GetExponent() uint32 { - if x != nil { - return x.Exponent - } - return 0 -} - // OriginTx is a reference to an external transaction or an operation // related to an action on Regen Ledger. type OriginTx struct { @@ -2704,7 +1968,7 @@ type OriginTx struct { func (x *OriginTx) Reset() { *x = OriginTx{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1_types_proto_msgTypes[2] + mi := &file_regen_ecocredit_v1_types_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2718,7 +1982,7 @@ func (*OriginTx) ProtoMessage() {} // Deprecated: Use OriginTx.ProtoReflect.Descriptor instead. func (*OriginTx) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1_types_proto_rawDescGZIP(), []int{2} + return file_regen_ecocredit_v1_types_proto_rawDescGZIP(), []int{1} } func (x *OriginTx) GetTyp() string { @@ -2753,7 +2017,7 @@ type CreditTypeProposal struct { func (x *CreditTypeProposal) Reset() { *x = CreditTypeProposal{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1_types_proto_msgTypes[3] + mi := &file_regen_ecocredit_v1_types_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2767,7 +2031,7 @@ func (*CreditTypeProposal) ProtoMessage() {} // Deprecated: Use CreditTypeProposal.ProtoReflect.Descriptor instead. func (*CreditTypeProposal) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1_types_proto_rawDescGZIP(), []int{3} + return file_regen_ecocredit_v1_types_proto_rawDescGZIP(), []int{2} } func (x *CreditTypeProposal) GetTitle() string { @@ -2802,7 +2066,7 @@ var file_regen_ecocredit_v1_types_proto_rawDesc = []byte{ 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x03, 0x0a, 0x06, 0x50, + 0x74, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xce, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x75, 0x0a, 0x10, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, @@ -2823,45 +2087,34 @@ var file_regen_ecocredit_v1_types_proto_rawDesc = []byte{ 0x64, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, - 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x4a, 0x0a, 0x12, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, 0x61, 0x73, 0x6b, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, - 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x6b, - 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x41, 0x73, - 0x6b, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x73, 0x22, 0x61, 0x0a, 0x08, 0x41, 0x73, 0x6b, 0x44, 0x65, - 0x6e, 0x6f, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x69, 0x73, - 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 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, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x22, 0x2c, 0x0a, 0x08, 0x4f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x54, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x79, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x79, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x93, 0x01, 0x0a, 0x12, 0x43, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 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, 0x3f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x72, - 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, - 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, 0xd8, - 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, - 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x73, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x48, 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, 0x76, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, - 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, 0x52, - 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, - 0x31, 0xe2, 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x14, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x2c, 0x0a, 0x08, 0x4f, + 0x72, 0x69, 0x67, 0x69, 0x6e, 0x54, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x79, 0x70, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x79, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x93, 0x01, 0x0a, 0x12, 0x43, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 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, 0x3f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, + 0x69, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x04, 0x98, 0xa0, 0x1f, 0x00, 0x42, + 0xd8, 0x01, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, + 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x54, 0x79, 0x70, 0x65, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x48, 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, 0x76, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x12, 0x52, 0x65, 0x67, 0x65, 0x6e, + 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x12, + 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, + 0x56, 0x31, 0xe2, 0x02, 0x1e, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x14, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, + 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -2876,25 +2129,23 @@ func file_regen_ecocredit_v1_types_proto_rawDescGZIP() []byte { return file_regen_ecocredit_v1_types_proto_rawDescData } -var file_regen_ecocredit_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_regen_ecocredit_v1_types_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_regen_ecocredit_v1_types_proto_goTypes = []interface{}{ (*Params)(nil), // 0: regen.ecocredit.v1.Params - (*AskDenom)(nil), // 1: regen.ecocredit.v1.AskDenom - (*OriginTx)(nil), // 2: regen.ecocredit.v1.OriginTx - (*CreditTypeProposal)(nil), // 3: regen.ecocredit.v1.CreditTypeProposal - (*v1beta1.Coin)(nil), // 4: cosmos.base.v1beta1.Coin - (*CreditType)(nil), // 5: regen.ecocredit.v1.CreditType + (*OriginTx)(nil), // 1: regen.ecocredit.v1.OriginTx + (*CreditTypeProposal)(nil), // 2: regen.ecocredit.v1.CreditTypeProposal + (*v1beta1.Coin)(nil), // 3: cosmos.base.v1beta1.Coin + (*CreditType)(nil), // 4: regen.ecocredit.v1.CreditType } var file_regen_ecocredit_v1_types_proto_depIdxs = []int32{ - 4, // 0: regen.ecocredit.v1.Params.credit_class_fee:type_name -> cosmos.base.v1beta1.Coin - 4, // 1: regen.ecocredit.v1.Params.basket_fee:type_name -> cosmos.base.v1beta1.Coin - 1, // 2: regen.ecocredit.v1.Params.allowed_ask_denoms:type_name -> regen.ecocredit.v1.AskDenom - 5, // 3: regen.ecocredit.v1.CreditTypeProposal.credit_type:type_name -> regen.ecocredit.v1.CreditType - 4, // [4:4] is the sub-list for method output_type - 4, // [4:4] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 3, // 0: regen.ecocredit.v1.Params.credit_class_fee:type_name -> cosmos.base.v1beta1.Coin + 3, // 1: regen.ecocredit.v1.Params.basket_fee:type_name -> cosmos.base.v1beta1.Coin + 4, // 2: regen.ecocredit.v1.CreditTypeProposal.credit_type:type_name -> regen.ecocredit.v1.CreditType + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_regen_ecocredit_v1_types_proto_init() } @@ -2917,18 +2168,6 @@ func file_regen_ecocredit_v1_types_proto_init() { } } file_regen_ecocredit_v1_types_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AskDenom); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_regen_ecocredit_v1_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*OriginTx); i { case 0: return &v.state @@ -2940,7 +2179,7 @@ func file_regen_ecocredit_v1_types_proto_init() { return nil } } - file_regen_ecocredit_v1_types_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_regen_ecocredit_v1_types_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CreditTypeProposal); i { case 0: return &v.state @@ -2959,7 +2198,7 @@ func file_regen_ecocredit_v1_types_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_regen_ecocredit_v1_types_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/app/app.go b/app/app.go index d92343f060..1d7124fd9a 100644 --- a/app/app.go +++ b/app/app.go @@ -97,7 +97,7 @@ 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/core" + ecoServer "github.com/regen-network/regen-ledger/x/ecocredit/server" // unnamed import of statik for swagger UI support _ "github.com/regen-network/regen-ledger/v3/client/docs/statik" @@ -396,7 +396,7 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest } app.smm.RegisterInvariants(&app.CrisisKeeper) - govRouter.AddRoute(ecocredit.RouterKey, ecoServer.NewCreditTypeProposalHandler(ecocreditModule.Keeper)) + govRouter.AddRoute(ecocredit.RouterKey, ecoServer.NewProposalHandler(ecocreditModule.Keeper)) app.GovKeeper = govkeeper.NewKeeper( appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, &stakingKeeper, govRouter, diff --git a/app/experimental_appconfig.go b/app/experimental_appconfig.go index 3914f83bf5..96a88eba6d 100644 --- a/app/experimental_appconfig.go +++ b/app/experimental_appconfig.go @@ -31,6 +31,7 @@ import ( moduletypes "github.com/regen-network/regen-ledger/types/module" "github.com/regen-network/regen-ledger/types/module/server" "github.com/regen-network/regen-ledger/x/ecocredit/client/core" + "github.com/regen-network/regen-ledger/x/ecocredit/client/marketplace" group "github.com/regen-network/regen-ledger/x/group/module" ) @@ -41,7 +42,7 @@ func setCustomModuleBasics() []module.AppModuleBasic { wasmclient.ProposalHandlers, paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, - core.CreditTypeProposalHandler, + core.CreditTypeProposalHandler, marketplace.AllowDenomProposalHandler, )..., ), wasm.AppModuleBasic{}, diff --git a/app/stable_appconfig.go b/app/stable_appconfig.go index 9b1570a449..9bbd8e9952 100644 --- a/app/stable_appconfig.go +++ b/app/stable_appconfig.go @@ -25,6 +25,7 @@ import ( "github.com/regen-network/regen-ledger/types/module/server" ecocreditcore "github.com/regen-network/regen-ledger/x/ecocredit/client/core" + "github.com/regen-network/regen-ledger/x/ecocredit/client/marketplace" ) func setCustomModuleBasics() []module.AppModuleBasic { @@ -32,7 +33,7 @@ func setCustomModuleBasics() []module.AppModuleBasic { gov.NewAppModuleBasic( paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler, - ecocreditcore.CreditTypeProposalHandler, + ecocreditcore.CreditTypeProposalHandler, marketplace.AllowDenomProposalHandler, ), } } diff --git a/proto/regen/ecocredit/marketplace/v1/events.proto b/proto/regen/ecocredit/marketplace/v1/events.proto index de425e7e05..69fc64e8f7 100644 --- a/proto/regen/ecocredit/marketplace/v1/events.proto +++ b/proto/regen/ecocredit/marketplace/v1/events.proto @@ -24,8 +24,9 @@ message EventUpdateSellOrder { uint64 order_id = 2; } -// EventAllowAskDenom is an event emitted when an ask denom is added. -message EventAllowAskDenom { +// EventAllowDenom is an event emitted when a new denom is added for use in the +// marketplace. +message EventAllowDenom { // denom is the denom to allow (ex. ibc/GLKHDSG423SGS) string denom = 1; diff --git a/proto/regen/ecocredit/marketplace/v1/types.proto b/proto/regen/ecocredit/marketplace/v1/types.proto new file mode 100644 index 0000000000..0dee0b6b96 --- /dev/null +++ b/proto/regen/ecocredit/marketplace/v1/types.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package regen.ecocredit.marketplace.v1; + +import "regen/ecocredit/marketplace/v1/state.proto"; +import "gogoproto/gogo.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. +message AllowDenomProposal { + option (gogoproto.goproto_stringer) = false; + + // title is the title of the proposal. + string title = 1; + + // description is the description of the proposal. + string description = 2; + + // 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/events.proto b/proto/regen/ecocredit/v1/events.proto index 1d69d441a7..2f87fddd07 100644 --- a/proto/regen/ecocredit/v1/events.proto +++ b/proto/regen/ecocredit/v1/events.proto @@ -195,3 +195,10 @@ message EventBatchSealed { // batch_denom is the denom of the batch that was sealed. string batch_denom = 1; } + +// EventAddCreditType is emitted when governance approves a new credit type. +message EventAddCreditType { + + // abbreviation is the abbreviation of the credit type. + string abbreviation = 1; +} diff --git a/proto/regen/ecocredit/v1/types.proto b/proto/regen/ecocredit/v1/types.proto index c88754582f..2755f2e469 100644 --- a/proto/regen/ecocredit/v1/types.proto +++ b/proto/regen/ecocredit/v1/types.proto @@ -30,24 +30,6 @@ message Params { // allowlist_enabled is a param that enables/disables the allowlist for credit // creation bool allowlist_enabled = 4; - - // allowed_ask_denoms is a list of denoms (and display information) allowed to - // be used in sell order ask prices. - repeated AskDenom allowed_ask_denoms = 6; -} - -// AskDenom defines the structure for a coin denom. -message AskDenom { - - // denom is the denom to allow (ex. ibc/GLKHDSG423SGS) - string denom = 1; - - // display_denom is the denom to display to the user and is informational - string display_denom = 2; - - // exponent is the exponent that relates the denom to the display_denom and is - // informational - uint32 exponent = 3; } // OriginTx is a reference to an external transaction or an operation diff --git a/x/ecocredit/client/marketplace/proposal.go b/x/ecocredit/client/marketplace/proposal.go new file mode 100644 index 0000000000..75ed329615 --- /dev/null +++ b/x/ecocredit/client/marketplace/proposal.go @@ -0,0 +1,86 @@ +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" + "github.com/cosmos/cosmos-sdk/x/gov/client/rest" + "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" +) + +var AllowDenomProposalHandler = govclient.NewProposalHandler(TxAllowDenomProposal, func(context client.Context) rest.ProposalRESTHandler { + return rest.ProposalRESTHandler{ + SubRoute: "", + Handler: nil, + } +}) + +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 types.Content = &proposal + msg, err := types.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/client/testsuite/grpc.go b/x/ecocredit/client/testsuite/grpc.go index 65cd6e8200..6bc4a0e03f 100644 --- a/x/ecocredit/client/testsuite/grpc.go +++ b/x/ecocredit/client/testsuite/grpc.go @@ -270,7 +270,7 @@ func (s *IntegrationTestSuite) TestQueryParams() { func (s *IntegrationTestSuite) TestQuerySellOrder() { val := s.network.Validators[0] _, _, batchDenom := s.createClassProjectBatch(val.ClientCtx, val.Address.String()) - validAsk := types.NewInt64Coin(core.DefaultParams().AllowedAskDenoms[0].Denom, 10) + validAsk := types.NewInt64Coin(types.DefaultBondDenom, 10) expiration, err := types2.ParseDate("expiration", "2090-10-10") s.Require().NoError(err) orderIds, err := s.createSellOrder(val.ClientCtx, &marketplace.MsgSell{ @@ -311,7 +311,7 @@ func (s *IntegrationTestSuite) TestQuerySellOrder() { func (s *IntegrationTestSuite) TestQuerySellOrders() { val := s.network.Validators[0] _, _, batchDenom := s.createClassProjectBatch(val.ClientCtx, val.Address.String()) - validAsk := types.NewInt64Coin(core.DefaultParams().AllowedAskDenoms[0].Denom, 10) + validAsk := types.NewInt64Coin(types.DefaultBondDenom, 10) expiration, err := types2.ParseDate("expiration", "2090-10-10") s.Require().NoError(err) _, err = s.createSellOrder(val.ClientCtx, &marketplace.MsgSell{ @@ -365,7 +365,7 @@ func (s *IntegrationTestSuite) TestQuerySellOrders() { func (s *IntegrationTestSuite) TestQuerySellOrdersByBatchDenom() { val := s.network.Validators[0] _, _, batchDenom := s.createClassProjectBatch(val.ClientCtx, val.Address.String()) - validAsk := types.NewInt64Coin(core.DefaultParams().AllowedAskDenoms[0].Denom, 10) + validAsk := types.NewInt64Coin(types.DefaultBondDenom, 10) expiration, err := types2.ParseDate("expiration", "2090-10-10") s.Require().NoError(err) _, err = s.createSellOrder(val.ClientCtx, &marketplace.MsgSell{ @@ -418,7 +418,7 @@ func (s *IntegrationTestSuite) TestQuerySellOrdersByBatchDenom() { func (s *IntegrationTestSuite) TestQuerySellOrdersByAddress() { val := s.network.Validators[0] _, _, batchDenom := s.createClassProjectBatch(val.ClientCtx, val.Address.String()) - validAsk := types.NewInt64Coin(core.DefaultParams().AllowedAskDenoms[0].Denom, 10) + validAsk := types.NewInt64Coin(types.DefaultBondDenom, 10) expiration, err := types2.ParseDate("expiration", "2090-10-10") s.Require().NoError(err) _, err = s.createSellOrder(val.ClientCtx, &marketplace.MsgSell{ diff --git a/x/ecocredit/client/testsuite/query.go b/x/ecocredit/client/testsuite/query.go index 5fc216043c..0ec544c274 100644 --- a/x/ecocredit/client/testsuite/query.go +++ b/x/ecocredit/client/testsuite/query.go @@ -429,7 +429,7 @@ func (s *IntegrationTestSuite) TestQuerySellOrderCmd() { clientCtx := val.ClientCtx clientCtx.OutputFormat = "JSON" _, _, batchDenom := s.createClassProjectBatch(clientCtx, val.Address.String()) - validAsk := sdk.NewInt64Coin(core.DefaultParams().AllowedAskDenoms[0].Denom, 10) + validAsk := sdk.NewInt64Coin(sdk.DefaultBondDenom, 10) expiration, err := types.ParseDate("expiration", "2050-03-11") s.Require().NoError(err) orderIds, err := s.createSellOrder(clientCtx, &marketplace.MsgSell{ @@ -490,7 +490,7 @@ func (s *IntegrationTestSuite) TestQuerySellOrdersCmd() { clientCtx := val.ClientCtx clientCtx.OutputFormat = "JSON" _, _, batchDenom := s.createClassProjectBatch(clientCtx, val.Address.String()) - validAsk := sdk.NewInt64Coin(core.DefaultParams().AllowedAskDenoms[0].Denom, 10) + validAsk := sdk.NewInt64Coin(sdk.DefaultBondDenom, 10) expiration, err := types.ParseDate("expiration", "2050-03-11") s.Require().NoError(err) @@ -547,7 +547,7 @@ func (s *IntegrationTestSuite) TestQuerySellOrdersByAddressCmd() { clientCtx := val.ClientCtx clientCtx.OutputFormat = "JSON" _, _, batchDenom := s.createClassProjectBatch(clientCtx, val.Address.String()) - validAsk := sdk.NewInt64Coin(core.DefaultParams().AllowedAskDenoms[0].Denom, 10) + validAsk := sdk.NewInt64Coin(sdk.DefaultBondDenom, 10) expiration, err := types.ParseDate("expiration", "2050-03-11") s.Require().NoError(err) _, err = s.createSellOrder(clientCtx, &marketplace.MsgSell{ @@ -609,7 +609,7 @@ func (s *IntegrationTestSuite) TestQuerySellOrdersByBatchDenomCmd() { clientCtx := val.ClientCtx clientCtx.OutputFormat = "JSON" _, _, batchDenom := s.createClassProjectBatch(clientCtx, val.Address.String()) - validAsk := sdk.NewInt64Coin(core.DefaultParams().AllowedAskDenoms[0].Denom, 10) + validAsk := sdk.NewInt64Coin(sdk.DefaultBondDenom, 10) expiration, err := types.ParseDate("expiration", "2050-03-11") s.Require().NoError(err) diff --git a/x/ecocredit/client/testsuite/tx.go b/x/ecocredit/client/testsuite/tx.go index 38121fccfd..1cb24bcfc4 100644 --- a/x/ecocredit/client/testsuite/tx.go +++ b/x/ecocredit/client/testsuite/tx.go @@ -25,6 +25,7 @@ import ( dbm "github.com/tendermint/tm-db" "google.golang.org/protobuf/types/known/timestamppb" + marketApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/testutil/cli" @@ -83,6 +84,13 @@ func (s *IntegrationTestSuite) setupCustomGenesis() { ormCtx := ormtable.WrapContextDefault(backend) ss, err := api.NewStateStore(modDB) s.Require().NoError(err) + ms, err := marketApi.NewStateStore(modDB) + + err = ms.AllowedDenomTable().Insert(ormCtx, &marketApi.AllowedDenom{ + BankDenom: sdk.DefaultBondDenom, + DisplayDenom: sdk.DefaultBondDenom, + }) + s.Require().NoError(err) err = ss.CreditTypeTable().Insert(ormCtx, &api.CreditType{ Abbreviation: "C", @@ -1113,8 +1121,7 @@ func (s *IntegrationTestSuite) TestTxUpdateSellOrders() { val0 := s.network.Validators[0] valAddrStr := val0.Address.String() clientCtx := val0.ClientCtx - validAskDenom := core.DefaultParams().AllowedAskDenoms[0].Denom - askCoin := sdk.NewInt64Coin(validAskDenom, 10) + askCoin := sdk.NewInt64Coin(sdk.DefaultBondDenom, 10) expiration, err := types.ParseDate("expiration", "3020-04-15") s.Require().NoError(err) _, _, batchDenom := s.createClassProjectBatch(clientCtx, valAddrStr) @@ -1138,7 +1145,7 @@ func (s *IntegrationTestSuite) TestTxUpdateSellOrders() { return append(args, s.commonTxFlags()...) } - newAsk := sdk.NewInt64Coin(validAskDenom, 3) + newAsk := sdk.NewInt64Coin(askCoin.Denom, 3) newExpiration, err := types.ParseDate("newExpiration", "2049-07-15") s.Require().NoError(err) diff --git a/x/ecocredit/client/tx.go b/x/ecocredit/client/tx.go index 8ea94c2004..6f046b915d 100644 --- a/x/ecocredit/client/tx.go +++ b/x/ecocredit/client/tx.go @@ -19,7 +19,6 @@ import ( "github.com/regen-network/regen-ledger/types" basketcli "github.com/regen-network/regen-ledger/x/ecocredit/client/basket" - corecli "github.com/regen-network/regen-ledger/x/ecocredit/client/core" marketplacecli "github.com/regen-network/regen-ledger/x/ecocredit/client/marketplace" "github.com/regen-network/regen-ledger/x/ecocredit/core" ) @@ -47,7 +46,6 @@ func TxCmd(name string) *cobra.Command { TxCreateProject(), TxUpdateProjectAdminCmd(), TxUpdateProjectMetadataCmd(), - corecli.TxCreditTypeProposalCmd(), basketcli.TxCreateBasket(), basketcli.TxPutInBasket(), basketcli.TxTakeFromBasket(), diff --git a/x/ecocredit/core/codec.go b/x/ecocredit/core/codec.go index 2f8c33671e..156572079a 100644 --- a/x/ecocredit/core/codec.go +++ b/x/ecocredit/core/codec.go @@ -4,9 +4,11 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/msgservice" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) func RegisterTypes(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations((*govtypes.Content)(nil), &CreditTypeProposal{}) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } @@ -24,6 +26,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgUpdateClassIssuers{}, "regen.core/MsgUpdateClassIssuers", nil) cdc.RegisterConcrete(&MsgUpdateProjectAdmin{}, "regen.core/MsgUpdateProjectAdmin", nil) cdc.RegisterConcrete(&MsgUpdateProjectMetadata{}, "regen.core/MsgUpdateProjectMetadata", nil) + cdc.RegisterConcrete(&CreditTypeProposal{}, "regen.core/CreditTypeProposal", nil) } var ( diff --git a/x/ecocredit/core/events.pb.go b/x/ecocredit/core/events.pb.go index ab03fbdcca..c9bd894b93 100644 --- a/x/ecocredit/core/events.pb.go +++ b/x/ecocredit/core/events.pb.go @@ -863,6 +863,52 @@ func (m *EventBatchSealed) GetBatchDenom() string { return "" } +// EventAddCreditType is emitted when governance approves a new credit type. +type EventAddCreditType struct { + // abbreviation is the abbreviation of the credit type. + Abbreviation string `protobuf:"bytes,1,opt,name=abbreviation,proto3" json:"abbreviation,omitempty"` +} + +func (m *EventAddCreditType) Reset() { *m = EventAddCreditType{} } +func (m *EventAddCreditType) String() string { return proto.CompactTextString(m) } +func (*EventAddCreditType) ProtoMessage() {} +func (*EventAddCreditType) Descriptor() ([]byte, []int) { + return fileDescriptor_e32415575ff8b4b2, []int{13} +} +func (m *EventAddCreditType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventAddCreditType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventAddCreditType.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 *EventAddCreditType) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventAddCreditType.Merge(m, src) +} +func (m *EventAddCreditType) XXX_Size() int { + return m.Size() +} +func (m *EventAddCreditType) XXX_DiscardUnknown() { + xxx_messageInfo_EventAddCreditType.DiscardUnknown(m) +} + +var xxx_messageInfo_EventAddCreditType proto.InternalMessageInfo + +func (m *EventAddCreditType) GetAbbreviation() string { + if m != nil { + return m.Abbreviation + } + return "" +} + func init() { proto.RegisterType((*EventCreateClass)(nil), "regen.ecocredit.v1.EventCreateClass") proto.RegisterType((*EventCreateProject)(nil), "regen.ecocredit.v1.EventCreateProject") @@ -877,53 +923,56 @@ func init() { proto.RegisterType((*EventProjectAdminUpdated)(nil), "regen.ecocredit.v1.EventProjectAdminUpdated") proto.RegisterType((*EventProjectMetadataUpdated)(nil), "regen.ecocredit.v1.EventProjectMetadataUpdated") proto.RegisterType((*EventBatchSealed)(nil), "regen.ecocredit.v1.EventBatchSealed") + proto.RegisterType((*EventAddCreditType)(nil), "regen.ecocredit.v1.EventAddCreditType") } func init() { proto.RegisterFile("regen/ecocredit/v1/events.proto", fileDescriptor_e32415575ff8b4b2) } var fileDescriptor_e32415575ff8b4b2 = []byte{ - // 651 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xc1, 0x4f, 0x13, 0x4f, - 0x14, 0x66, 0xe1, 0x07, 0xb4, 0xaf, 0x85, 0x9f, 0xd9, 0x28, 0x29, 0x82, 0x0b, 0xac, 0x31, 0x7a, - 0xb1, 0x0d, 0x92, 0x98, 0x78, 0x84, 0xea, 0x81, 0x18, 0x22, 0x41, 0xbd, 0x78, 0x69, 0xa6, 0x3b, - 0x2f, 0x65, 0x60, 0x77, 0xa6, 0x99, 0x99, 0xb6, 0x98, 0x78, 0x52, 0xff, 0x00, 0xff, 0x2c, 0x8f, - 0x1c, 0x39, 0x1a, 0xf8, 0x47, 0xcc, 0xcc, 0xbe, 0xa5, 0xa5, 0xa0, 0x25, 0xc4, 0xdb, 0xbc, 0x6f, - 0xbe, 0xf9, 0xde, 0xf7, 0x5e, 0x5f, 0xdf, 0xc2, 0x9a, 0xc6, 0x0e, 0xca, 0x06, 0x26, 0x2a, 0xd1, - 0xc8, 0x85, 0x6d, 0xf4, 0x37, 0x1b, 0xd8, 0x47, 0x69, 0x4d, 0xbd, 0xab, 0x95, 0x55, 0x61, 0xe8, - 0x09, 0xf5, 0x4b, 0x42, 0xbd, 0xbf, 0xf9, 0x30, 0xba, 0xe1, 0x91, 0xfd, 0xdc, 0x45, 0x7a, 0x13, - 0x37, 0xe1, 0xde, 0x1b, 0xa7, 0xd1, 0xd4, 0xc8, 0x2c, 0x36, 0x53, 0x66, 0x4c, 0xb8, 0x0c, 0xa5, - 0xc4, 0x1d, 0x5a, 0x82, 0xd7, 0x82, 0xf5, 0xe0, 0x59, 0xf9, 0x60, 0xde, 0xc7, 0xbb, 0x3c, 0xbc, - 0x0f, 0xb3, 0x8c, 0x67, 0x42, 0xd6, 0xa6, 0x3d, 0x9e, 0x07, 0xf1, 0x2e, 0x84, 0x23, 0x22, 0xfb, - 0x5a, 0x1d, 0x61, 0x62, 0xc3, 0x47, 0x00, 0xdd, 0xfc, 0x38, 0x14, 0x2a, 0x13, 0xf2, 0x47, 0xa9, - 0xb7, 0x57, 0xfc, 0xec, 0x30, 0x9b, 0x1c, 0x86, 0x6b, 0x50, 0x69, 0xbb, 0x43, 0x8b, 0xa3, 0x54, - 0x19, 0x29, 0x81, 0x87, 0x5e, 0x3b, 0x24, 0x5c, 0x82, 0x39, 0x61, 0x4c, 0x0f, 0x35, 0x69, 0x51, - 0x14, 0x1b, 0x78, 0xe0, 0xc5, 0xf6, 0x84, 0xb4, 0x5e, 0xaa, 0xe9, 0x7b, 0x60, 0x26, 0x2b, 0xbe, - 0x82, 0xb2, 0xd2, 0xa2, 0x23, 0x64, 0xcb, 0x9e, 0x78, 0xd1, 0xca, 0x8b, 0xd5, 0xfa, 0xf5, 0xf6, - 0xd6, 0xdf, 0x79, 0xd2, 0x87, 0x93, 0x83, 0x92, 0xa2, 0x53, 0x7c, 0x16, 0x40, 0xd5, 0x67, 0x3d, - 0xc0, 0x04, 0x45, 0x1f, 0x9d, 0x3b, 0x83, 0x92, 0xa3, 0xa6, 0x3c, 0x14, 0x85, 0xab, 0x50, 0xd6, - 0x98, 0x88, 0xae, 0x40, 0x69, 0xc9, 0xf8, 0x10, 0x18, 0xb7, 0x38, 0x73, 0xcd, 0xe2, 0x53, 0xf8, - 0xdf, 0x6a, 0xc6, 0x59, 0x3b, 0xc5, 0x16, 0xcb, 0x54, 0x4f, 0xda, 0xda, 0x7f, 0x9e, 0xb4, 0x58, - 0xc0, 0xdb, 0x1e, 0x0d, 0x9f, 0xc0, 0xa2, 0x46, 0x2b, 0x34, 0xf2, 0x82, 0x37, 0xeb, 0x79, 0x0b, - 0x84, 0x12, 0x6d, 0x03, 0xaa, 0x6d, 0x66, 0x8e, 0xd1, 0x52, 0xc6, 0x39, 0x4f, 0xaa, 0xe4, 0x98, - 0x4f, 0x19, 0x7f, 0x0f, 0xa0, 0x42, 0xa5, 0xb9, 0x97, 0x61, 0x0d, 0xe6, 0x73, 0x8d, 0xa2, 0xb4, - 0x22, 0x1c, 0x77, 0x3f, 0x7d, 0xd3, 0x4f, 0x46, 0x66, 0xf2, 0xca, 0x28, 0x0a, 0x63, 0xa8, 0x1e, - 0xf5, 0xb4, 0x30, 0x5c, 0x24, 0x56, 0x28, 0x49, 0x25, 0x5d, 0xc1, 0x62, 0x4e, 0x2e, 0x9a, 0x4c, - 0x26, 0x98, 0xba, 0x3e, 0x26, 0xfe, 0x94, 0x5e, 0xfa, 0x18, 0x02, 0x77, 0x76, 0x12, 0x67, 0xb0, - 0x94, 0x67, 0x71, 0xa3, 0xbf, 0xed, 0x86, 0xf3, 0x63, 0x97, 0x33, 0x8b, 0xfc, 0x6f, 0xff, 0x8f, - 0x15, 0x28, 0xab, 0x94, 0xb7, 0x46, 0x07, 0xbb, 0xa4, 0x52, 0xee, 0x9f, 0xbb, 0x4b, 0x89, 0x03, - 0xba, 0xcc, 0x93, 0x95, 0x24, 0x0e, 0xfc, 0x65, 0xfc, 0x2d, 0x80, 0xda, 0x30, 0xdf, 0xae, 0x1f, - 0x60, 0x73, 0x8b, 0x8c, 0x8f, 0x61, 0x81, 0x71, 0x8e, 0xbc, 0x95, 0xcf, 0xbc, 0xa9, 0x4d, 0xaf, - 0xcf, 0xb8, 0x8e, 0x79, 0x90, 0x64, 0xdc, 0xac, 0x68, 0xcc, 0x54, 0x7f, 0x84, 0x36, 0xe3, 0x69, - 0x8b, 0x04, 0x13, 0x31, 0xfe, 0x02, 0xcb, 0x43, 0x13, 0x7b, 0x68, 0x19, 0x67, 0x96, 0xdd, 0xc2, - 0xc5, 0x06, 0x54, 0x5d, 0xdd, 0x19, 0xbd, 0xa0, 0xd2, 0x2b, 0x2a, 0xe5, 0x85, 0x88, 0xa3, 0xb8, - 0xea, 0x2f, 0x29, 0x79, 0x03, 0x2a, 0x12, 0x07, 0x05, 0x25, 0x36, 0xd4, 0x02, 0xda, 0x20, 0x57, - 0x9a, 0x3e, 0x61, 0x9b, 0xdc, 0xbd, 0xf1, 0x5f, 0x03, 0x58, 0x19, 0xcd, 0x3a, 0x5e, 0xf5, 0x84, - 0xc4, 0xff, 0xa6, 0xf2, 0x2d, 0x5a, 0x7b, 0x7e, 0x4b, 0xbd, 0x47, 0x96, 0x22, 0x9f, 0xb8, 0xa4, - 0x76, 0xf6, 0x7f, 0x9e, 0x47, 0xc1, 0xe9, 0x79, 0x14, 0xfc, 0x3a, 0x8f, 0x82, 0x1f, 0x17, 0xd1, - 0xd4, 0xe9, 0x45, 0x34, 0x75, 0x76, 0x11, 0x4d, 0x7d, 0x7a, 0xd9, 0x11, 0xf6, 0xb0, 0xd7, 0xae, - 0x27, 0x2a, 0x6b, 0xf8, 0xad, 0xf5, 0x5c, 0xa2, 0x1d, 0x28, 0x7d, 0x4c, 0x51, 0x8a, 0xbc, 0x83, - 0xba, 0x71, 0x32, 0xf2, 0x5d, 0x48, 0x94, 0xc6, 0xf6, 0x9c, 0xff, 0x28, 0x6c, 0xfd, 0x0e, 0x00, - 0x00, 0xff, 0xff, 0xcc, 0xf3, 0x3a, 0x9c, 0x6b, 0x06, 0x00, 0x00, + // 676 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x4f, 0x13, 0x41, + 0x14, 0x66, 0x41, 0xa0, 0x7d, 0x2d, 0x68, 0x36, 0x4a, 0x8a, 0x60, 0x81, 0x35, 0x46, 0x2f, 0xb6, + 0x41, 0x12, 0xa3, 0x47, 0xa8, 0x1e, 0x88, 0x21, 0x12, 0xc4, 0x8b, 0x97, 0x66, 0x76, 0xe7, 0xa5, + 0x0c, 0xec, 0xce, 0x34, 0x33, 0xd3, 0x16, 0x12, 0x4f, 0xea, 0x0f, 0xf0, 0x67, 0x79, 0xe4, 0xc8, + 0xd1, 0xc0, 0x1f, 0x31, 0x33, 0xfb, 0x4a, 0x5b, 0x40, 0x4b, 0x88, 0xb7, 0x79, 0xdf, 0x7e, 0xf3, + 0xbd, 0xef, 0xbd, 0xbe, 0x79, 0x85, 0x15, 0x8d, 0x2d, 0x94, 0x75, 0x4c, 0x54, 0xa2, 0x91, 0x0b, + 0x5b, 0xef, 0xae, 0xd7, 0xb1, 0x8b, 0xd2, 0x9a, 0x5a, 0x5b, 0x2b, 0xab, 0xc2, 0xd0, 0x13, 0x6a, + 0x97, 0x84, 0x5a, 0x77, 0xfd, 0x71, 0xf5, 0x86, 0x4b, 0xf6, 0xa4, 0x8d, 0x74, 0x27, 0x6a, 0xc0, + 0x83, 0xf7, 0x4e, 0xa3, 0xa1, 0x91, 0x59, 0x6c, 0xa4, 0xcc, 0x98, 0x70, 0x11, 0x0a, 0x89, 0x3b, + 0x34, 0x05, 0xaf, 0x04, 0xab, 0xc1, 0x8b, 0xe2, 0xde, 0xac, 0x8f, 0xb7, 0x79, 0xf8, 0x10, 0xa6, + 0x19, 0xcf, 0x84, 0xac, 0x4c, 0x7a, 0x3c, 0x0f, 0xa2, 0x6d, 0x08, 0x87, 0x44, 0x76, 0xb5, 0x3a, + 0xc4, 0xc4, 0x86, 0x4f, 0x00, 0xda, 0xf9, 0x71, 0x20, 0x54, 0x24, 0xe4, 0xaf, 0x52, 0x1f, 0x46, + 0xfc, 0x6c, 0x31, 0x9b, 0x1c, 0x84, 0x2b, 0x50, 0x8a, 0xdd, 0xa1, 0xc9, 0x51, 0xaa, 0x8c, 0x94, + 0xc0, 0x43, 0xef, 0x1c, 0x12, 0x2e, 0xc0, 0x8c, 0x30, 0xa6, 0x83, 0x9a, 0xb4, 0x28, 0x8a, 0x0c, + 0x3c, 0xf2, 0x62, 0x3b, 0x42, 0x5a, 0x2f, 0xd5, 0xf0, 0x3d, 0x30, 0xe3, 0x15, 0xdf, 0x42, 0x51, + 0x69, 0xd1, 0x12, 0xb2, 0x69, 0x8f, 0xbd, 0x68, 0xe9, 0xd5, 0x72, 0xed, 0x7a, 0x7b, 0x6b, 0x1f, + 0x3d, 0x69, 0xff, 0x78, 0xaf, 0xa0, 0xe8, 0x14, 0x9d, 0x05, 0x50, 0xf6, 0x59, 0xf7, 0x30, 0x41, + 0xd1, 0x45, 0xe7, 0xce, 0xa0, 0xe4, 0xa8, 0x29, 0x0f, 0x45, 0xe1, 0x32, 0x14, 0x35, 0x26, 0xa2, + 0x2d, 0x50, 0x5a, 0x32, 0x3e, 0x00, 0xae, 0x5a, 0x9c, 0xba, 0x66, 0xf1, 0x39, 0xdc, 0xb7, 0x9a, + 0x71, 0x16, 0xa7, 0xd8, 0x64, 0x99, 0xea, 0x48, 0x5b, 0xb9, 0xe7, 0x49, 0xf3, 0x7d, 0x78, 0xd3, + 0xa3, 0xe1, 0x33, 0x98, 0xd7, 0x68, 0x85, 0x46, 0xde, 0xe7, 0x4d, 0x7b, 0xde, 0x1c, 0xa1, 0x44, + 0x5b, 0x83, 0x72, 0xcc, 0xcc, 0x11, 0x5a, 0xca, 0x38, 0xe3, 0x49, 0xa5, 0x1c, 0xf3, 0x29, 0xa3, + 0x1f, 0x01, 0x94, 0xa8, 0x34, 0x77, 0x33, 0xac, 0xc0, 0x6c, 0xae, 0xd1, 0x2f, 0xad, 0x1f, 0x5e, + 0x75, 0x3f, 0x79, 0xd3, 0x4f, 0x46, 0x66, 0xf2, 0xca, 0x28, 0x0a, 0x23, 0x28, 0x1f, 0x76, 0xb4, + 0x30, 0x5c, 0x24, 0x56, 0x28, 0x49, 0x25, 0x8d, 0x60, 0x11, 0x27, 0x17, 0x0d, 0x26, 0x13, 0x4c, + 0x5d, 0x1f, 0x13, 0x7f, 0x4a, 0x2f, 0x7d, 0x0c, 0x80, 0x3b, 0x3b, 0x89, 0x32, 0x58, 0xc8, 0xb3, + 0xb8, 0xd1, 0xdf, 0x74, 0xc3, 0xf9, 0xb9, 0xcd, 0x99, 0x45, 0xfe, 0xaf, 0xf7, 0xb1, 0x04, 0x45, + 0x95, 0xf2, 0xe6, 0xf0, 0x60, 0x17, 0x54, 0xca, 0xfd, 0x75, 0xf7, 0x51, 0x62, 0x8f, 0x3e, 0xe6, + 0xc9, 0x0a, 0x12, 0x7b, 0xfe, 0x63, 0xf4, 0x3d, 0x80, 0xca, 0x20, 0xdf, 0xb6, 0x1f, 0x60, 0x73, + 0x8b, 0x8c, 0x4f, 0x61, 0x8e, 0x71, 0x8e, 0xbc, 0x99, 0xcf, 0xbc, 0xa9, 0x4c, 0xae, 0x4e, 0xb9, + 0x8e, 0x79, 0x90, 0x64, 0xdc, 0xac, 0x68, 0xcc, 0x54, 0x77, 0x88, 0x36, 0xe5, 0x69, 0xf3, 0x04, + 0x13, 0x31, 0xfa, 0x0a, 0x8b, 0x03, 0x13, 0x3b, 0x68, 0x19, 0x67, 0x96, 0xdd, 0xc2, 0xc5, 0x1a, + 0x94, 0x5d, 0xdd, 0x19, 0xdd, 0xa0, 0xd2, 0x4b, 0x2a, 0xe5, 0x7d, 0x11, 0x47, 0x71, 0xd5, 0x5f, + 0x52, 0xf2, 0x06, 0x94, 0x24, 0xf6, 0xfa, 0x94, 0xc8, 0x50, 0x0b, 0x68, 0x83, 0x8c, 0x34, 0x7d, + 0xcc, 0x36, 0xb9, 0x7b, 0xe3, 0xbf, 0x05, 0xb0, 0x34, 0x9c, 0xf5, 0x6a, 0xd5, 0x63, 0x12, 0xff, + 0x9f, 0xca, 0x37, 0x68, 0xed, 0xf9, 0x2d, 0xf5, 0x09, 0x59, 0x8a, 0x7c, 0xec, 0x92, 0x8a, 0xde, + 0xd0, 0xda, 0xdd, 0xe4, 0x3c, 0x5f, 0x6c, 0xfb, 0x27, 0x6d, 0x74, 0x2f, 0x88, 0xc5, 0xb1, 0xc6, + 0xae, 0x60, 0xfe, 0x05, 0xe5, 0xf7, 0x46, 0xb0, 0xad, 0xdd, 0x5f, 0xe7, 0xd5, 0xe0, 0xf4, 0xbc, + 0x1a, 0xfc, 0x3e, 0xaf, 0x06, 0x3f, 0x2f, 0xaa, 0x13, 0xa7, 0x17, 0xd5, 0x89, 0xb3, 0x8b, 0xea, + 0xc4, 0x97, 0xd7, 0x2d, 0x61, 0x0f, 0x3a, 0x71, 0x2d, 0x51, 0x59, 0xdd, 0xef, 0xbb, 0x97, 0x12, + 0x6d, 0x4f, 0xe9, 0x23, 0x8a, 0x52, 0xe4, 0x2d, 0xd4, 0xf5, 0xe3, 0xa1, 0x7f, 0x94, 0x44, 0x69, + 0x8c, 0x67, 0xfc, 0xdf, 0xc9, 0xc6, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x95, 0xe3, 0x8c, + 0xa5, 0x06, 0x00, 0x00, } func (m *EventCreateClass) Marshal() (dAtA []byte, err error) { @@ -1493,6 +1542,36 @@ func (m *EventBatchSealed) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *EventAddCreditType) 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 *EventAddCreditType) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventAddCreditType) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Abbreviation) > 0 { + i -= len(m.Abbreviation) + copy(dAtA[i:], m.Abbreviation) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Abbreviation))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { offset -= sovEvents(v) base := offset @@ -1773,6 +1852,19 @@ func (m *EventBatchSealed) Size() (n int) { return n } +func (m *EventAddCreditType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Abbreviation) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + func sovEvents(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3617,6 +3709,88 @@ func (m *EventBatchSealed) Unmarshal(dAtA []byte) error { } return nil } +func (m *EventAddCreditType) 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 ErrIntOverflowEvents + } + 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: EventAddCreditType: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventAddCreditType: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Abbreviation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Abbreviation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipEvents(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ecocredit/core/msg_credit_type.go b/x/ecocredit/core/msg_credit_type.go index 9424fb5be9..d02f6a5966 100644 --- a/x/ecocredit/core/msg_credit_type.go +++ b/x/ecocredit/core/msg_credit_type.go @@ -1,8 +1,6 @@ package core import ( - "regexp" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -11,7 +9,7 @@ const ( ) func (m CreditType) Validate() error { - if err := validateCreditTypeAbbreviation(m.Abbreviation); err != nil { + if err := ValidateCreditTypeAbbreviation(m.Abbreviation); err != nil { return err } if len(m.Name) == 0 { @@ -28,14 +26,3 @@ func (m CreditType) Validate() error { } return nil } - -// Check that CreditType abbreviation is valid, i.e. it consists of 1-3 -// uppercase letters -func validateCreditTypeAbbreviation(abbr string) error { - reAbbr := regexp.MustCompile(`^[A-Z]{1,3}$`) - matches := reAbbr.FindStringSubmatch(abbr) - if matches == nil { - return sdkerrors.ErrInvalidRequest.Wrapf("credit type abbreviation must be 1-3 uppercase latin letters: got %s", abbr) - } - return nil -} diff --git a/x/ecocredit/core/msg_credit_type_proposal.go b/x/ecocredit/core/msg_credit_type_proposal.go index bab7349db5..637d0cd9a8 100644 --- a/x/ecocredit/core/msg_credit_type_proposal.go +++ b/x/ecocredit/core/msg_credit_type_proposal.go @@ -17,6 +17,7 @@ const ( func init() { govtypes.RegisterProposalType(ProposalType) + govtypes.RegisterProposalTypeCodec(&CreditTypeProposal{}, "regen/CreditTypeProposal") } func (m *CreditTypeProposal) ProposalRoute() string { return ecocredit.RouterKey } diff --git a/x/ecocredit/core/params.go b/x/ecocredit/core/params.go index 9c56b34fba..2351f78244 100644 --- a/x/ecocredit/core/params.go +++ b/x/ecocredit/core/params.go @@ -14,7 +14,6 @@ var ( KeyAllowedClassCreators = []byte("AllowedClassCreators") KeyAllowlistEnabled = []byte("AllowlistEnabled") KeyBasketCreationFee = []byte("BasketCreationFee") - KeyAllowedAskDenoms = []byte("AllowedAskDenoms") ) // TODO: remove after we open governance changes for precision @@ -34,7 +33,6 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyAllowedClassCreators, &p.AllowedClassCreators, validateAllowedClassCreators), paramtypes.NewParamSetPair(KeyAllowlistEnabled, &p.AllowlistEnabled, validateAllowlistEnabled), paramtypes.NewParamSetPair(KeyBasketCreationFee, &p.BasketFee, validateBasketCreationFee), - paramtypes.NewParamSetPair(KeyAllowedAskDenoms, &p.AllowedAskDenoms, validateAllowedAskDenoms), } } @@ -56,7 +54,7 @@ func (p Params) Validate() error { return err } - return validateAllowedAskDenoms(p.AllowedAskDenoms) + return nil } func validateCreditClassFee(i interface{}) error { @@ -108,27 +106,13 @@ func validateBasketCreationFee(i interface{}) error { return nil } -func validateAllowedAskDenoms(i interface{}) error { - v, ok := i.([]*AskDenom) - if !ok { - return sdkerrors.ErrInvalidType.Wrapf("invalid parameter type: %T, expected: %T", i, []*AskDenom{}) - } - for _, askDenom := range v { - if err := sdk.ValidateDenom(askDenom.Denom); err != nil { - return err - } - } - return nil -} - // NewParams creates a new Params object. -func NewParams(creditClassFee, basketCreationFee sdk.Coins, allowlist []string, allowlistEnabled bool, allowedAskDenoms []*AskDenom) Params { +func NewParams(creditClassFee, basketCreationFee sdk.Coins, allowlist []string, allowlistEnabled bool) Params { return Params{ CreditClassFee: creditClassFee, AllowedClassCreators: allowlist, AllowlistEnabled: allowlistEnabled, BasketFee: basketCreationFee, - AllowedAskDenoms: allowedAskDenoms, } } @@ -139,12 +123,5 @@ func DefaultParams() Params { sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultBasketCreationFee)), []string{}, false, - []*AskDenom{ - { - Denom: sdk.DefaultBondDenom, - DisplayDenom: sdk.DefaultBondDenom, - Exponent: 18, - }, - }, ) } diff --git a/x/ecocredit/core/types.pb.go b/x/ecocredit/core/types.pb.go index 0d1b63bf9e..e7f6910907 100644 --- a/x/ecocredit/core/types.pb.go +++ b/x/ecocredit/core/types.pb.go @@ -38,9 +38,6 @@ type Params struct { // allowlist_enabled is a param that enables/disables the allowlist for credit // creation AllowlistEnabled bool `protobuf:"varint,4,opt,name=allowlist_enabled,json=allowlistEnabled,proto3" json:"allowlist_enabled,omitempty"` - // allowed_ask_denoms is a list of denoms (and display information) allowed to - // be used in sell order ask prices. - AllowedAskDenoms []*AskDenom `protobuf:"bytes,6,rep,name=allowed_ask_denoms,json=allowedAskDenoms,proto3" json:"allowed_ask_denoms,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -104,78 +101,6 @@ func (m *Params) GetAllowlistEnabled() bool { return false } -func (m *Params) GetAllowedAskDenoms() []*AskDenom { - if m != nil { - return m.AllowedAskDenoms - } - return nil -} - -// AskDenom defines the structure for a coin denom. -type AskDenom struct { - // denom is the denom to allow (ex. ibc/GLKHDSG423SGS) - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` - // display_denom is the denom to display to the user and is informational - DisplayDenom string `protobuf:"bytes,2,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,3,opt,name=exponent,proto3" json:"exponent,omitempty"` -} - -func (m *AskDenom) Reset() { *m = AskDenom{} } -func (m *AskDenom) String() string { return proto.CompactTextString(m) } -func (*AskDenom) ProtoMessage() {} -func (*AskDenom) Descriptor() ([]byte, []int) { - return fileDescriptor_7b044b6b740b984f, []int{1} -} -func (m *AskDenom) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AskDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AskDenom.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 *AskDenom) XXX_Merge(src proto.Message) { - xxx_messageInfo_AskDenom.Merge(m, src) -} -func (m *AskDenom) XXX_Size() int { - return m.Size() -} -func (m *AskDenom) XXX_DiscardUnknown() { - xxx_messageInfo_AskDenom.DiscardUnknown(m) -} - -var xxx_messageInfo_AskDenom proto.InternalMessageInfo - -func (m *AskDenom) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -func (m *AskDenom) GetDisplayDenom() string { - if m != nil { - return m.DisplayDenom - } - return "" -} - -func (m *AskDenom) GetExponent() uint32 { - if m != nil { - return m.Exponent - } - return 0 -} - // OriginTx is a reference to an external transaction or an operation // related to an action on Regen Ledger. type OriginTx struct { @@ -190,7 +115,7 @@ func (m *OriginTx) Reset() { *m = OriginTx{} } func (m *OriginTx) String() string { return proto.CompactTextString(m) } func (*OriginTx) ProtoMessage() {} func (*OriginTx) Descriptor() ([]byte, []int) { - return fileDescriptor_7b044b6b740b984f, []int{2} + return fileDescriptor_7b044b6b740b984f, []int{1} } func (m *OriginTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -247,7 +172,7 @@ type CreditTypeProposal struct { func (m *CreditTypeProposal) Reset() { *m = CreditTypeProposal{} } func (*CreditTypeProposal) ProtoMessage() {} func (*CreditTypeProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_7b044b6b740b984f, []int{3} + return fileDescriptor_7b044b6b740b984f, []int{2} } func (m *CreditTypeProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -299,7 +224,6 @@ func (m *CreditTypeProposal) GetCreditType() *CreditType { func init() { proto.RegisterType((*Params)(nil), "regen.ecocredit.v1.Params") - proto.RegisterType((*AskDenom)(nil), "regen.ecocredit.v1.AskDenom") proto.RegisterType((*OriginTx)(nil), "regen.ecocredit.v1.OriginTx") proto.RegisterType((*CreditTypeProposal)(nil), "regen.ecocredit.v1.CreditTypeProposal") } @@ -307,41 +231,36 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1/types.proto", fileDescriptor_7b044b6b740b984f) } var fileDescriptor_7b044b6b740b984f = []byte{ - // 532 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0x31, 0x8f, 0xd3, 0x3e, - 0x18, 0xc6, 0x9b, 0xe6, 0xfe, 0xa7, 0xd6, 0xfd, 0xdf, 0xa9, 0x58, 0x15, 0x0a, 0x15, 0x4a, 0xa3, - 0xb2, 0x44, 0x82, 0x4b, 0xe8, 0x81, 0x18, 0x58, 0x10, 0x57, 0x60, 0x60, 0xa1, 0x8a, 0x6e, 0x62, - 0xa9, 0x9c, 0xf8, 0x25, 0x98, 0xa6, 0x71, 0x64, 0xfb, 0x7a, 0xed, 0xb7, 0x40, 0x62, 0x41, 0x4c, - 0xcc, 0x7c, 0x92, 0x1b, 0x6f, 0x64, 0x02, 0xd4, 0x7e, 0x11, 0x14, 0xdb, 0x2d, 0x95, 0xb8, 0x91, - 0x29, 0x7e, 0xdf, 0xc7, 0x7e, 0x7e, 0x8f, 0x63, 0x1b, 0xf9, 0x02, 0x72, 0x28, 0x63, 0xc8, 0x78, - 0x26, 0x80, 0x32, 0x15, 0x2f, 0x46, 0xb1, 0x5a, 0x55, 0x20, 0xa3, 0x4a, 0x70, 0xc5, 0x31, 0xd6, - 0x7a, 0xb4, 0xd3, 0xa3, 0xc5, 0xa8, 0xdf, 0xcb, 0x79, 0xce, 0xb5, 0x1c, 0xd7, 0x23, 0x33, 0xb3, - 0xef, 0x67, 0x5c, 0xce, 0xb9, 0x8c, 0x53, 0x22, 0x21, 0x5e, 0x8c, 0x52, 0x50, 0x64, 0x14, 0x67, - 0x9c, 0x95, 0x5b, 0xfd, 0x06, 0x92, 0x54, 0x44, 0x81, 0xd1, 0x87, 0x5f, 0x5c, 0x74, 0x38, 0x21, - 0x82, 0xcc, 0x25, 0xbe, 0x40, 0x5d, 0x33, 0x67, 0x9a, 0x15, 0x44, 0xca, 0xe9, 0x3b, 0x00, 0xcf, - 0x09, 0xdc, 0xb0, 0x73, 0x7a, 0x27, 0x32, 0x94, 0xa8, 0xa6, 0x44, 0x96, 0x12, 0x8d, 0x39, 0x2b, - 0xcf, 0x1e, 0x5e, 0xfd, 0x18, 0x34, 0xbe, 0xfd, 0x1c, 0x84, 0x39, 0x53, 0xef, 0x2f, 0xd2, 0x28, - 0xe3, 0xf3, 0xd8, 0x46, 0x32, 0x9f, 0x13, 0x49, 0x67, 0x76, 0x6f, 0xf5, 0x02, 0x99, 0x1c, 0x1b, - 0xc8, 0xb8, 0x66, 0xbc, 0x02, 0xc0, 0x1f, 0x10, 0x4a, 0x89, 0x9c, 0x81, 0xd2, 0xc0, 0xe6, 0xbf, - 0x07, 0xb6, 0x8d, 0x7d, 0xcd, 0x7a, 0x8c, 0x6e, 0x93, 0xa2, 0xe0, 0x97, 0x40, 0xed, 0x1e, 0x33, - 0x01, 0x44, 0x71, 0x21, 0x3d, 0x37, 0x70, 0xc3, 0x76, 0xd2, 0xb3, 0xaa, 0x0e, 0x37, 0xb6, 0x1a, - 0xbe, 0x8f, 0x6e, 0xe9, 0x7e, 0xc1, 0xa4, 0x9a, 0x42, 0x49, 0xd2, 0x02, 0xa8, 0x77, 0x10, 0x38, - 0x61, 0x2b, 0xe9, 0xee, 0x84, 0x97, 0xa6, 0x8f, 0x5f, 0x23, 0xbc, 0x45, 0x10, 0x39, 0x9b, 0x52, - 0x28, 0xf9, 0x5c, 0x7a, 0x87, 0x7a, 0x5b, 0x77, 0xa3, 0xbf, 0xcf, 0x35, 0x7a, 0x2e, 0x67, 0x2f, - 0xea, 0x49, 0xd6, 0x0b, 0xe8, 0xb6, 0x21, 0x87, 0x04, 0xb5, 0xb6, 0x05, 0xee, 0xa1, 0xff, 0xb4, - 0x97, 0xe7, 0x04, 0x4e, 0xd8, 0x4e, 0x4c, 0x81, 0xef, 0xa1, 0x23, 0xca, 0x64, 0x55, 0x90, 0x95, - 0x21, 0x79, 0x4d, 0xad, 0xfe, 0x6f, 0x9b, 0x66, 0x69, 0x1f, 0xb5, 0x60, 0x59, 0xf1, 0x12, 0x4a, - 0xe5, 0xb9, 0x81, 0x13, 0x1e, 0x25, 0xbb, 0x7a, 0xf8, 0x00, 0xb5, 0xde, 0x08, 0x96, 0xb3, 0xf2, - 0x7c, 0x89, 0xbb, 0xc8, 0x55, 0xab, 0xca, 0x02, 0xea, 0x21, 0x3e, 0x46, 0x4d, 0x46, 0xad, 0x67, - 0x93, 0xd1, 0xe1, 0x27, 0x07, 0xe1, 0xb1, 0x4e, 0x7e, 0xbe, 0xaa, 0x60, 0x22, 0x78, 0xc5, 0x25, - 0x29, 0xea, 0x6c, 0x8a, 0xa9, 0x02, 0xb6, 0xd9, 0x74, 0x81, 0x03, 0xd4, 0xa1, 0x20, 0x33, 0xc1, - 0x2a, 0xc5, 0x78, 0x69, 0x5d, 0xf6, 0x5b, 0xf8, 0x19, 0xea, 0xd8, 0x1b, 0x57, 0x9f, 0x97, 0xce, - 0xd6, 0x39, 0xf5, 0x6f, 0xfa, 0x49, 0x7f, 0xa0, 0x09, 0xca, 0x76, 0xe3, 0xa7, 0x07, 0x9f, 0xbf, - 0x0e, 0x1a, 0x67, 0x93, 0xab, 0xb5, 0xef, 0x5c, 0xaf, 0x7d, 0xe7, 0xd7, 0xda, 0x77, 0x3e, 0x6e, - 0xfc, 0xc6, 0xf5, 0xc6, 0x6f, 0x7c, 0xdf, 0xf8, 0x8d, 0xb7, 0x4f, 0xf6, 0x2e, 0x89, 0x76, 0x3d, - 0x29, 0x41, 0x5d, 0x72, 0x31, 0xb3, 0x55, 0x01, 0x34, 0x07, 0x11, 0x2f, 0xf7, 0xde, 0x47, 0xc6, - 0x05, 0xa4, 0x87, 0xfa, 0x71, 0x3c, 0xfa, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x31, 0x18, 0xcd, 0xd0, - 0xa8, 0x03, 0x00, 0x00, + // 457 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x92, 0x3f, 0x8f, 0xd3, 0x30, + 0x14, 0xc0, 0xf3, 0xe7, 0x38, 0x5d, 0x5d, 0xe9, 0x54, 0xac, 0x0a, 0x85, 0x1b, 0xd2, 0xa8, 0x53, + 0x24, 0x38, 0x87, 0x1e, 0x88, 0x81, 0x05, 0xe9, 0x2a, 0x58, 0xa9, 0xa2, 0x9b, 0x58, 0x2a, 0xc7, + 0x79, 0x04, 0xd3, 0x34, 0x8e, 0x6c, 0x5f, 0xef, 0xfa, 0x2d, 0x90, 0x58, 0x18, 0x99, 0xf9, 0x24, + 0x37, 0xa1, 0x1b, 0x99, 0x00, 0xb5, 0x5f, 0x04, 0xc5, 0x36, 0xa5, 0x12, 0x8c, 0x37, 0xe5, 0xf9, + 0xfd, 0xec, 0xf7, 0xb3, 0x5f, 0x1e, 0x8a, 0x25, 0x54, 0xd0, 0x64, 0xc0, 0x04, 0x93, 0x50, 0x72, + 0x9d, 0xad, 0x26, 0x99, 0x5e, 0xb7, 0xa0, 0x48, 0x2b, 0x85, 0x16, 0x18, 0x1b, 0x4e, 0x76, 0x9c, + 0xac, 0x26, 0x27, 0xc3, 0x4a, 0x54, 0xc2, 0xe0, 0xac, 0x8b, 0xec, 0xce, 0x93, 0x98, 0x09, 0xb5, + 0x14, 0x2a, 0x2b, 0xa8, 0x82, 0x6c, 0x35, 0x29, 0x40, 0xd3, 0x49, 0xc6, 0x04, 0x6f, 0xfe, 0xf0, + 0xff, 0x98, 0x94, 0xa6, 0x1a, 0x2c, 0x1f, 0x7f, 0x0b, 0xd0, 0xe1, 0x8c, 0x4a, 0xba, 0x54, 0xf8, + 0x12, 0x0d, 0xec, 0x9e, 0x39, 0xab, 0xa9, 0x52, 0xf3, 0x77, 0x00, 0x91, 0x9f, 0x84, 0x69, 0xff, + 0xec, 0x21, 0xb1, 0x16, 0xd2, 0x59, 0x88, 0xb3, 0x90, 0xa9, 0xe0, 0xcd, 0xf9, 0x93, 0x9b, 0x1f, + 0x23, 0xef, 0xeb, 0xcf, 0x51, 0x5a, 0x71, 0xfd, 0xfe, 0xb2, 0x20, 0x4c, 0x2c, 0x33, 0x77, 0x25, + 0xfb, 0x39, 0x55, 0xe5, 0xc2, 0xbd, 0xad, 0x3b, 0xa0, 0xf2, 0x63, 0x2b, 0x99, 0x76, 0x8e, 0xd7, + 0x00, 0xf8, 0x03, 0x42, 0x05, 0x55, 0x0b, 0xd0, 0x46, 0x18, 0xdc, 0xbd, 0xb0, 0x67, 0xcb, 0x77, + 0xae, 0x67, 0xe8, 0x01, 0xad, 0x6b, 0x71, 0x05, 0xa5, 0x7b, 0x23, 0x93, 0x40, 0xb5, 0x90, 0x2a, + 0x0a, 0x93, 0x30, 0xed, 0xe5, 0x43, 0x47, 0xcd, 0xe5, 0xa6, 0x8e, 0xe1, 0x47, 0xe8, 0xbe, 0xc9, + 0xd7, 0x5c, 0xe9, 0x39, 0x34, 0xb4, 0xa8, 0xa1, 0x8c, 0x0e, 0x12, 0x3f, 0x3d, 0xca, 0x07, 0x3b, + 0xf0, 0xca, 0xe6, 0xc7, 0x8f, 0xd1, 0xd1, 0x1b, 0xc9, 0x2b, 0xde, 0x5c, 0x5c, 0xe3, 0x01, 0x0a, + 0xf5, 0xba, 0x8d, 0xfc, 0xc4, 0x4f, 0x7b, 0x79, 0x17, 0xe2, 0x63, 0x14, 0xf0, 0x32, 0x0a, 0x4c, + 0x22, 0xe0, 0xe5, 0xf8, 0x93, 0x8f, 0xf0, 0xd4, 0xf4, 0xe3, 0x62, 0xdd, 0xc2, 0x4c, 0x8a, 0x56, + 0x28, 0x5a, 0xe3, 0x21, 0xba, 0xa7, 0xb9, 0xae, 0xc1, 0x1d, 0xb5, 0x0b, 0x9c, 0xa0, 0x7e, 0x09, + 0x8a, 0x49, 0xde, 0x6a, 0x2e, 0x1a, 0x57, 0x65, 0x3f, 0x85, 0x5f, 0xa2, 0xbe, 0xfb, 0x85, 0x5d, + 0x03, 0xa2, 0x30, 0xf1, 0xd3, 0xfe, 0x59, 0x4c, 0xfe, 0x9d, 0x26, 0xf2, 0x57, 0x9a, 0x23, 0xb6, + 0x8b, 0x5f, 0x1c, 0x7c, 0xfe, 0x32, 0xf2, 0xce, 0x67, 0x37, 0x9b, 0xd8, 0xbf, 0xdd, 0xc4, 0xfe, + 0xaf, 0x4d, 0xec, 0x7f, 0xdc, 0xc6, 0xde, 0xed, 0x36, 0xf6, 0xbe, 0x6f, 0x63, 0xef, 0xed, 0xf3, + 0xbd, 0xae, 0x9b, 0xaa, 0xa7, 0x0d, 0xe8, 0x2b, 0x21, 0x17, 0x6e, 0x55, 0x43, 0x59, 0x81, 0xcc, + 0xae, 0xf7, 0x06, 0x8e, 0x09, 0x09, 0xc5, 0xa1, 0x99, 0xb6, 0xa7, 0xbf, 0x03, 0x00, 0x00, 0xff, + 0xff, 0xd1, 0xf9, 0x00, 0x09, 0xf9, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -364,20 +283,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AllowedAskDenoms) > 0 { - for iNdEx := len(m.AllowedAskDenoms) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AllowedAskDenoms[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } if m.AllowlistEnabled { i-- if m.AllowlistEnabled { @@ -428,48 +333,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AskDenom) 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 *AskDenom) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *AskDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Exponent != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.Exponent)) - i-- - dAtA[i] = 0x18 - } - if len(m.DisplayDenom) > 0 { - i -= len(m.DisplayDenom) - copy(dAtA[i:], m.DisplayDenom) - i = encodeVarintTypes(dAtA, i, uint64(len(m.DisplayDenom))) - i-- - dAtA[i] = 0x12 - } - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Denom))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *OriginTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -594,32 +457,6 @@ func (m *Params) Size() (n int) { if m.AllowlistEnabled { n += 2 } - if len(m.AllowedAskDenoms) > 0 { - for _, e := range m.AllowedAskDenoms { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - return n -} - -func (m *AskDenom) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - l = len(m.DisplayDenom) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.Exponent != 0 { - n += 1 + sovTypes(uint64(m.Exponent)) - } return n } @@ -816,173 +653,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } } m.AllowlistEnabled = bool(v != 0) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AllowedAskDenoms", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AllowedAskDenoms = append(m.AllowedAskDenoms, &AskDenom{}) - if err := m.AllowedAskDenoms[len(m.AllowedAskDenoms)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AskDenom) 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 ErrIntOverflowTypes - } - 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: AskDenom: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AskDenom: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - 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 ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - 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 ErrIntOverflowTypes - } - 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 ErrInvalidLengthTypes - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DisplayDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 ErrIntOverflowTypes - } - 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 := skipTypes(dAtA[iNdEx:]) diff --git a/x/ecocredit/core/utils.go b/x/ecocredit/core/utils.go index dfce67c590..4cf204ccb4 100644 --- a/x/ecocredit/core/utils.go +++ b/x/ecocredit/core/utils.go @@ -98,8 +98,7 @@ func FormatBatchDenom(projectId string, batchSeqNo uint64, startDate, endDate *t // is only 1-3 uppercase letters. The return is nil if the abbreviation is valid. func ValidateCreditTypeAbbreviation(abbr string) error { reAbbr := regexp.MustCompile(`^[A-Z]{1,3}$`) - matches := reAbbr.FindStringSubmatch(abbr) - if matches == nil { + if !reAbbr.Match([]byte(abbr)) { return sdkerrors.ErrInvalidRequest.Wrapf("credit type abbreviation must be 1-3 uppercase latin letters: got %s", abbr) } return nil diff --git a/x/ecocredit/marketplace/codec.go b/x/ecocredit/marketplace/codec.go index 903efecede..7ba3f877c3 100644 --- a/x/ecocredit/marketplace/codec.go +++ b/x/ecocredit/marketplace/codec.go @@ -4,9 +4,11 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/msgservice" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) func RegisterTypes(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations((*govtypes.Content)(nil), &AllowDenomProposal{}) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/ecocredit/marketplace/events.pb.go b/x/ecocredit/marketplace/events.pb.go index b50dc953a8..bdddb7a834 100644 --- a/x/ecocredit/marketplace/events.pb.go +++ b/x/ecocredit/marketplace/events.pb.go @@ -132,24 +132,25 @@ func (m *EventUpdateSellOrder) GetOrderId() uint64 { return 0 } -// EventAllowAskDenom is an event emitted when an ask denom is added. -type EventAllowAskDenom struct { +// EventAllowDenom is an event emitted when a new denom is added for use in the +// marketplace. +type EventAllowDenom struct { // denom is the denom to allow (ex. ibc/GLKHDSG423SGS) Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` } -func (m *EventAllowAskDenom) Reset() { *m = EventAllowAskDenom{} } -func (m *EventAllowAskDenom) String() string { return proto.CompactTextString(m) } -func (*EventAllowAskDenom) ProtoMessage() {} -func (*EventAllowAskDenom) Descriptor() ([]byte, []int) { +func (m *EventAllowDenom) Reset() { *m = EventAllowDenom{} } +func (m *EventAllowDenom) String() string { return proto.CompactTextString(m) } +func (*EventAllowDenom) ProtoMessage() {} +func (*EventAllowDenom) Descriptor() ([]byte, []int) { return fileDescriptor_68b71b54d42cf1d9, []int{2} } -func (m *EventAllowAskDenom) XXX_Unmarshal(b []byte) error { +func (m *EventAllowDenom) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *EventAllowAskDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *EventAllowDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_EventAllowAskDenom.Marshal(b, m, deterministic) + return xxx_messageInfo_EventAllowDenom.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -159,19 +160,19 @@ func (m *EventAllowAskDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *EventAllowAskDenom) XXX_Merge(src proto.Message) { - xxx_messageInfo_EventAllowAskDenom.Merge(m, src) +func (m *EventAllowDenom) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventAllowDenom.Merge(m, src) } -func (m *EventAllowAskDenom) XXX_Size() int { +func (m *EventAllowDenom) XXX_Size() int { return m.Size() } -func (m *EventAllowAskDenom) XXX_DiscardUnknown() { - xxx_messageInfo_EventAllowAskDenom.DiscardUnknown(m) +func (m *EventAllowDenom) XXX_DiscardUnknown() { + xxx_messageInfo_EventAllowDenom.DiscardUnknown(m) } -var xxx_messageInfo_EventAllowAskDenom proto.InternalMessageInfo +var xxx_messageInfo_EventAllowDenom proto.InternalMessageInfo -func (m *EventAllowAskDenom) GetDenom() string { +func (m *EventAllowDenom) GetDenom() string { if m != nil { return m.Denom } @@ -181,7 +182,7 @@ func (m *EventAllowAskDenom) GetDenom() string { func init() { proto.RegisterType((*EventSell)(nil), "regen.ecocredit.marketplace.v1.EventSell") proto.RegisterType((*EventUpdateSellOrder)(nil), "regen.ecocredit.marketplace.v1.EventUpdateSellOrder") - proto.RegisterType((*EventAllowAskDenom)(nil), "regen.ecocredit.marketplace.v1.EventAllowAskDenom") + proto.RegisterType((*EventAllowDenom)(nil), "regen.ecocredit.marketplace.v1.EventAllowDenom") } func init() { @@ -189,7 +190,7 @@ func init() { } var fileDescriptor_68b71b54d42cf1d9 = []byte{ - // 250 bytes of a gzipped FileDescriptorProto + // 247 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0x4a, 0x4d, 0x4f, 0xcd, 0xd3, 0x4f, 0x4d, 0xce, 0x4f, 0x2e, 0x4a, 0x4d, 0xc9, 0x2c, 0xd1, 0xcf, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0x29, 0xc8, 0x49, 0x4c, 0x4e, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, @@ -198,14 +199,14 @@ var fileDescriptor_68b71b54d42cf1d9 = []byte{ 0x24, 0xc2, 0xc5, 0x9a, 0x5f, 0x9e, 0x97, 0x5a, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe1, 0x08, 0x49, 0x72, 0x71, 0xe4, 0x17, 0xa5, 0xa4, 0x16, 0xc5, 0x67, 0xa6, 0x48, 0x30, 0x29, 0x30, 0x6a, 0xb0, 0x04, 0xb1, 0x83, 0xf9, 0x9e, 0x29, 0x4a, 0xee, 0x5c, 0x22, 0x60, 0xdd, 0xa1, - 0x05, 0x29, 0x89, 0x25, 0xa9, 0x20, 0x33, 0xfc, 0x41, 0x32, 0xa4, 0x1b, 0xa4, 0xc5, 0x25, 0x04, - 0x36, 0xc8, 0x31, 0x27, 0x27, 0xbf, 0xdc, 0xb1, 0x38, 0xdb, 0x25, 0x35, 0x2f, 0x3f, 0x17, 0x64, - 0x4c, 0x0a, 0x88, 0x01, 0x33, 0x06, 0xcc, 0x71, 0x0a, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, - 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, - 0x63, 0x39, 0x86, 0x28, 0xdb, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, - 0xb0, 0xbf, 0x75, 0xf3, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xa1, 0xbc, 0x9c, 0xd4, 0x94, 0xf4, - 0xd4, 0x22, 0xfd, 0x0a, 0xec, 0x61, 0x97, 0xc4, 0x06, 0x0e, 0x32, 0x63, 0x40, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xe3, 0xb8, 0x87, 0xcf, 0x61, 0x01, 0x00, 0x00, + 0x05, 0x29, 0x89, 0x25, 0xa9, 0x20, 0x33, 0xfc, 0x41, 0x32, 0xa4, 0x1b, 0xa4, 0xce, 0xc5, 0x0f, + 0x36, 0xc8, 0x31, 0x27, 0x27, 0xbf, 0xdc, 0x25, 0x35, 0x2f, 0x3f, 0x17, 0x64, 0x46, 0x0a, 0x88, + 0x01, 0x33, 0x03, 0xcc, 0x71, 0x0a, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, + 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, + 0x28, 0xdb, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xb0, 0xa7, 0x75, + 0xf3, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xa1, 0xbc, 0x9c, 0xd4, 0x94, 0xf4, 0xd4, 0x22, 0xfd, + 0x0a, 0xec, 0x01, 0x97, 0xc4, 0x06, 0x0e, 0x2f, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8d, + 0xf1, 0x34, 0xfe, 0x5e, 0x01, 0x00, 0x00, } func (m *EventSell) Marshal() (dAtA []byte, err error) { @@ -278,7 +279,7 @@ func (m *EventUpdateSellOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *EventAllowAskDenom) Marshal() (dAtA []byte, err error) { +func (m *EventAllowDenom) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -288,12 +289,12 @@ func (m *EventAllowAskDenom) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *EventAllowAskDenom) MarshalTo(dAtA []byte) (int, error) { +func (m *EventAllowDenom) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *EventAllowAskDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *EventAllowDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -351,7 +352,7 @@ func (m *EventUpdateSellOrder) Size() (n int) { return n } -func (m *EventAllowAskDenom) Size() (n int) { +func (m *EventAllowDenom) Size() (n int) { if m == nil { return 0 } @@ -572,7 +573,7 @@ func (m *EventUpdateSellOrder) Unmarshal(dAtA []byte) error { } return nil } -func (m *EventAllowAskDenom) Unmarshal(dAtA []byte) error { +func (m *EventAllowDenom) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -595,10 +596,10 @@ func (m *EventAllowAskDenom) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: EventAllowAskDenom: wiretype end group for non-group") + return fmt.Errorf("proto: EventAllowDenom: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: EventAllowAskDenom: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: EventAllowDenom: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/ecocredit/marketplace/msg_allowed_denom.go b/x/ecocredit/marketplace/msg_allowed_denom.go new file mode 100644 index 0000000000..987f7495a3 --- /dev/null +++ b/x/ecocredit/marketplace/msg_allowed_denom.go @@ -0,0 +1,21 @@ +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/core" +) + +func (m AllowedDenom) Validate() error { + if err := sdk.ValidateDenom(m.BankDenom); err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("invalid bank denom: %s", err.Error()) + } + if err := sdk.ValidateDenom(m.DisplayDenom); err != nil { + return sdkerrors.ErrInvalidRequest.Wrapf("invalid display_denom: %s", err.Error()) + } + if _, err := core.ExponentToPrefix(m.Exponent); err != nil { + return err + } + return nil +} diff --git a/x/ecocredit/marketplace/msg_allowed_denom_proposal.go b/x/ecocredit/marketplace/msg_allowed_denom_proposal.go new file mode 100644 index 0000000000..5cc60665fe --- /dev/null +++ b/x/ecocredit/marketplace/msg_allowed_denom_proposal.go @@ -0,0 +1,43 @@ +package marketplace + +import ( + "fmt" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/regen-network/regen-ledger/x/ecocredit" +) + +var _ govtypes.Content = &AllowDenomProposal{} + +const ( + AllowDenomProposalType = "AllowDenomProposal" +) + +func init() { + govtypes.RegisterProposalType(AllowDenomProposalType) + govtypes.RegisterProposalTypeCodec(&AllowDenomProposal{}, "regen/AllowDenomProposal") +} + +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 govtypes.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 new file mode 100644 index 0000000000..a67a4b9b6a --- /dev/null +++ b/x/ecocredit/marketplace/msg_allowed_denom_proposal_test.go @@ -0,0 +1,69 @@ +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/msg_allowed_denom_test.go b/x/ecocredit/marketplace/msg_allowed_denom_test.go new file mode 100644 index 0000000000..0a137f4123 --- /dev/null +++ b/x/ecocredit/marketplace/msg_allowed_denom_test.go @@ -0,0 +1,82 @@ +package marketplace + +import ( + "testing" +) + +func TestAllowDenom_Validate(t *testing.T) { + type fields struct { + Denom string + DisplayDenom string + Exponent uint32 + } + tests := []struct { + name string + fields fields + wantErr bool + }{ + { + name: "valid", + fields: fields{ + Denom: "uregen", + DisplayDenom: "regen", + Exponent: 18, + }, + }, + { + name: "invalid denom", + fields: fields{ + Denom: "u!f0", + DisplayDenom: "regen", + Exponent: 18, + }, + wantErr: true, + }, + { + name: "no denom", + fields: fields{ + DisplayDenom: "regen", + Exponent: 18, + }, + wantErr: true, + }, + { + name: "invalid display denom", + fields: fields{ + Denom: "uregen", + DisplayDenom: "r!egen", + Exponent: 18, + }, + wantErr: true, + }, + { + name: "no display denom", + fields: fields{ + Denom: "uregen", + Exponent: 18, + }, + wantErr: true, + }, + { + name: "invalid exponent", + fields: fields{ + Denom: "uregen", + DisplayDenom: "regen", + Exponent: 20, + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + m := AllowedDenom{ + BankDenom: tt.fields.Denom, + DisplayDenom: tt.fields.DisplayDenom, + Exponent: tt.fields.Exponent, + } + if err := m.Validate(); (err != nil) != tt.wantErr { + t.Errorf("Validate() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/x/ecocredit/marketplace/types.pb.go b/x/ecocredit/marketplace/types.pb.go index 300fdbdd08..09f97c10d8 100644 --- a/x/ecocredit/marketplace/types.pb.go +++ b/x/ecocredit/marketplace/types.pb.go @@ -5,8 +5,8 @@ package marketplace import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" - types "github.com/gogo/protobuf/types" io "io" math "math" math_bits "math/bits" @@ -23,193 +23,29 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Filter is used to create filtered buy orders which match credit batch -// sell orders based on selection criteria rather than matching individual -// sell orders -type Filter struct { - // or is a list of criteria for matching credit batches. A credit which - // matches this filter must match at least one of these criteria. - Or []*Filter_Criteria `protobuf:"bytes,1,rep,name=or,proto3" json:"or,omitempty"` -} - -func (m *Filter) Reset() { *m = Filter{} } -func (m *Filter) String() string { return proto.CompactTextString(m) } -func (*Filter) ProtoMessage() {} -func (*Filter) Descriptor() ([]byte, []int) { +// AllowDenomProposal is a gov Content type for approving a denom for use in the +// marketplace. +type AllowDenomProposal struct { + // title is the title of the proposal. + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + // description is the description of the proposal. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // denom contains coin denom information that will be added to the + // list of allowed denoms for use in the marketplace. + Denom *AllowedDenom `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` +} + +func (m *AllowDenomProposal) Reset() { *m = AllowDenomProposal{} } +func (*AllowDenomProposal) ProtoMessage() {} +func (*AllowDenomProposal) Descriptor() ([]byte, []int) { return fileDescriptor_eff2ca0c007ee426, []int{0} } -func (m *Filter) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Filter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Filter.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 *Filter) XXX_Merge(src proto.Message) { - xxx_messageInfo_Filter.Merge(m, src) -} -func (m *Filter) XXX_Size() int { - return m.Size() -} -func (m *Filter) XXX_DiscardUnknown() { - xxx_messageInfo_Filter.DiscardUnknown(m) -} - -var xxx_messageInfo_Filter proto.InternalMessageInfo - -func (m *Filter) GetOr() []*Filter_Criteria { - if m != nil { - return m.Or - } - return nil -} - -// Criteria is a simple filter criteria for matching a credit batch. -type Filter_Criteria struct { - // Valid selector types are all - // attributes which are assigned to credit batches by some authority such - // as the credit issuer or a curator. Requiring some authority-based - // selector ensures that buy orders cannot just match some randomly issued - // credit based on jurisdiction and dates. - // - // Types that are valid to be assigned to Selector: - // *Filter_Criteria_ClassSelector - // *Filter_Criteria_ProjectSelector - // *Filter_Criteria_BatchSelector - Selector isFilter_Criteria_Selector `protobuf_oneof:"selector"` -} - -func (m *Filter_Criteria) Reset() { *m = Filter_Criteria{} } -func (m *Filter_Criteria) String() string { return proto.CompactTextString(m) } -func (*Filter_Criteria) ProtoMessage() {} -func (*Filter_Criteria) Descriptor() ([]byte, []int) { - return fileDescriptor_eff2ca0c007ee426, []int{0, 0} -} -func (m *Filter_Criteria) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Filter_Criteria) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Filter_Criteria.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 *Filter_Criteria) XXX_Merge(src proto.Message) { - xxx_messageInfo_Filter_Criteria.Merge(m, src) -} -func (m *Filter_Criteria) XXX_Size() int { - return m.Size() -} -func (m *Filter_Criteria) XXX_DiscardUnknown() { - xxx_messageInfo_Filter_Criteria.DiscardUnknown(m) -} - -var xxx_messageInfo_Filter_Criteria proto.InternalMessageInfo - -type isFilter_Criteria_Selector interface { - isFilter_Criteria_Selector() - MarshalTo([]byte) (int, error) - Size() int -} - -type Filter_Criteria_ClassSelector struct { - ClassSelector *ClassSelector `protobuf:"bytes,1,opt,name=class_selector,json=classSelector,proto3,oneof" json:"class_selector,omitempty"` -} -type Filter_Criteria_ProjectSelector struct { - ProjectSelector *ProjectSelector `protobuf:"bytes,2,opt,name=project_selector,json=projectSelector,proto3,oneof" json:"project_selector,omitempty"` -} -type Filter_Criteria_BatchSelector struct { - BatchSelector *BatchSelector `protobuf:"bytes,3,opt,name=batch_selector,json=batchSelector,proto3,oneof" json:"batch_selector,omitempty"` -} - -func (*Filter_Criteria_ClassSelector) isFilter_Criteria_Selector() {} -func (*Filter_Criteria_ProjectSelector) isFilter_Criteria_Selector() {} -func (*Filter_Criteria_BatchSelector) isFilter_Criteria_Selector() {} - -func (m *Filter_Criteria) GetSelector() isFilter_Criteria_Selector { - if m != nil { - return m.Selector - } - return nil -} - -func (m *Filter_Criteria) GetClassSelector() *ClassSelector { - if x, ok := m.GetSelector().(*Filter_Criteria_ClassSelector); ok { - return x.ClassSelector - } - return nil -} - -func (m *Filter_Criteria) GetProjectSelector() *ProjectSelector { - if x, ok := m.GetSelector().(*Filter_Criteria_ProjectSelector); ok { - return x.ProjectSelector - } - return nil -} - -func (m *Filter_Criteria) GetBatchSelector() *BatchSelector { - if x, ok := m.GetSelector().(*Filter_Criteria_BatchSelector); ok { - return x.BatchSelector - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*Filter_Criteria) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*Filter_Criteria_ClassSelector)(nil), - (*Filter_Criteria_ProjectSelector)(nil), - (*Filter_Criteria_BatchSelector)(nil), - } -} - -// ClassSelector is a selector for a credit class. -type ClassSelector struct { - // class_id is the credit class ID. - ClassId uint64 `protobuf:"varint,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - // project_location can be specified in three levels of granularity: - // country, sub-national-code, or postal code. If just country is given, - // for instance "US" then any credits in the "US" will be matched even - // their project location is more specific, ex. "US-NY 12345". If - // a country, sub-national-code and postal code are all provided then - // only projects in that postal code will match. - ProjectLocation string `protobuf:"bytes,2,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` - // start_date is the beginning of the period during which a credit batch - // was quantified and verified. If it is empty then there is no start date - // limit. - MinStartDate *types.Timestamp `protobuf:"bytes,3,opt,name=min_start_date,json=minStartDate,proto3" json:"min_start_date,omitempty"` - // max_end_date is the end of the period during which a credit batch was - // quantified and verified. If it is empty then there is no end date - // limit. - MaxEndDate *types.Timestamp `protobuf:"bytes,4,opt,name=max_end_date,json=maxEndDate,proto3" json:"max_end_date,omitempty"` -} - -func (m *ClassSelector) Reset() { *m = ClassSelector{} } -func (m *ClassSelector) String() string { return proto.CompactTextString(m) } -func (*ClassSelector) ProtoMessage() {} -func (*ClassSelector) Descriptor() ([]byte, []int) { - return fileDescriptor_eff2ca0c007ee426, []int{1} -} -func (m *ClassSelector) XXX_Unmarshal(b []byte) error { +func (m *AllowDenomProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ClassSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *AllowDenomProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ClassSelector.Marshal(b, m, deterministic) + return xxx_messageInfo_AllowDenomProposal.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -219,166 +55,41 @@ func (m *ClassSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *ClassSelector) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClassSelector.Merge(m, src) +func (m *AllowDenomProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllowDenomProposal.Merge(m, src) } -func (m *ClassSelector) XXX_Size() int { +func (m *AllowDenomProposal) XXX_Size() int { return m.Size() } -func (m *ClassSelector) XXX_DiscardUnknown() { - xxx_messageInfo_ClassSelector.DiscardUnknown(m) +func (m *AllowDenomProposal) XXX_DiscardUnknown() { + xxx_messageInfo_AllowDenomProposal.DiscardUnknown(m) } -var xxx_messageInfo_ClassSelector proto.InternalMessageInfo - -func (m *ClassSelector) GetClassId() uint64 { - if m != nil { - return m.ClassId - } - return 0 -} +var xxx_messageInfo_AllowDenomProposal proto.InternalMessageInfo -func (m *ClassSelector) GetProjectLocation() string { +func (m *AllowDenomProposal) GetTitle() string { if m != nil { - return m.ProjectLocation + return m.Title } return "" } -func (m *ClassSelector) GetMinStartDate() *types.Timestamp { - if m != nil { - return m.MinStartDate - } - return nil -} - -func (m *ClassSelector) GetMaxEndDate() *types.Timestamp { - if m != nil { - return m.MaxEndDate - } - return nil -} - -// ProjectSelector is a selector for a project. -type ProjectSelector struct { - // project_id is the project ID. - ProjectId uint64 `protobuf:"varint,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` - // start_date is the beginning of the period during which a credit batch - // was quantified and verified. If it is empty then there is no start date - // limit. - MinStartDate *types.Timestamp `protobuf:"bytes,2,opt,name=min_start_date,json=minStartDate,proto3" json:"min_start_date,omitempty"` - // max_end_date is the end of the period during which a credit batch was - // quantified and verified. If it is empty then there is no end date - // limit. - MaxEndDate *types.Timestamp `protobuf:"bytes,3,opt,name=max_end_date,json=maxEndDate,proto3" json:"max_end_date,omitempty"` -} - -func (m *ProjectSelector) Reset() { *m = ProjectSelector{} } -func (m *ProjectSelector) String() string { return proto.CompactTextString(m) } -func (*ProjectSelector) ProtoMessage() {} -func (*ProjectSelector) Descriptor() ([]byte, []int) { - return fileDescriptor_eff2ca0c007ee426, []int{2} -} -func (m *ProjectSelector) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProjectSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProjectSelector.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 *ProjectSelector) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProjectSelector.Merge(m, src) -} -func (m *ProjectSelector) XXX_Size() int { - return m.Size() -} -func (m *ProjectSelector) XXX_DiscardUnknown() { - xxx_messageInfo_ProjectSelector.DiscardUnknown(m) -} - -var xxx_messageInfo_ProjectSelector proto.InternalMessageInfo - -func (m *ProjectSelector) GetProjectId() uint64 { - if m != nil { - return m.ProjectId - } - return 0 -} - -func (m *ProjectSelector) GetMinStartDate() *types.Timestamp { +func (m *AllowDenomProposal) GetDescription() string { if m != nil { - return m.MinStartDate + return m.Description } - return nil + return "" } -func (m *ProjectSelector) GetMaxEndDate() *types.Timestamp { +func (m *AllowDenomProposal) GetDenom() *AllowedDenom { if m != nil { - return m.MaxEndDate + return m.Denom } return nil } -// BatchSelector is a selector for a credit batch. -type BatchSelector struct { - // batch_id is the credit batch ID. - BatchId uint64 `protobuf:"varint,1,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` -} - -func (m *BatchSelector) Reset() { *m = BatchSelector{} } -func (m *BatchSelector) String() string { return proto.CompactTextString(m) } -func (*BatchSelector) ProtoMessage() {} -func (*BatchSelector) Descriptor() ([]byte, []int) { - return fileDescriptor_eff2ca0c007ee426, []int{3} -} -func (m *BatchSelector) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *BatchSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BatchSelector.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 *BatchSelector) XXX_Merge(src proto.Message) { - xxx_messageInfo_BatchSelector.Merge(m, src) -} -func (m *BatchSelector) XXX_Size() int { - return m.Size() -} -func (m *BatchSelector) XXX_DiscardUnknown() { - xxx_messageInfo_BatchSelector.DiscardUnknown(m) -} - -var xxx_messageInfo_BatchSelector proto.InternalMessageInfo - -func (m *BatchSelector) GetBatchId() uint64 { - if m != nil { - return m.BatchId - } - return 0 -} - func init() { - proto.RegisterType((*Filter)(nil), "regen.ecocredit.marketplace.v1.Filter") - proto.RegisterType((*Filter_Criteria)(nil), "regen.ecocredit.marketplace.v1.Filter.Criteria") - proto.RegisterType((*ClassSelector)(nil), "regen.ecocredit.marketplace.v1.ClassSelector") - proto.RegisterType((*ProjectSelector)(nil), "regen.ecocredit.marketplace.v1.ProjectSelector") - proto.RegisterType((*BatchSelector)(nil), "regen.ecocredit.marketplace.v1.BatchSelector") + proto.RegisterType((*AllowDenomProposal)(nil), "regen.ecocredit.marketplace.v1.AllowDenomProposal") } func init() { @@ -386,172 +97,27 @@ func init() { } var fileDescriptor_eff2ca0c007ee426 = []byte{ - // 465 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xdf, 0x6a, 0x13, 0x41, - 0x14, 0xc6, 0xb3, 0x9b, 0x52, 0xd3, 0x69, 0xd3, 0xca, 0x5c, 0x69, 0xc0, 0x55, 0x72, 0x55, 0x0b, - 0x9d, 0xa1, 0xf5, 0x56, 0x51, 0x52, 0x15, 0x03, 0x5e, 0x48, 0x2a, 0x0a, 0x22, 0x84, 0xd9, 0x99, - 0xe3, 0x76, 0xec, 0xee, 0xce, 0x32, 0x7b, 0x5a, 0xe3, 0x5b, 0xf8, 0x10, 0x3e, 0x80, 0x8f, 0xe1, - 0x65, 0x6f, 0x04, 0x2f, 0x25, 0x79, 0x01, 0x1f, 0x41, 0x76, 0x76, 0x37, 0xd9, 0x48, 0x30, 0x8a, - 0x97, 0xf3, 0x71, 0xbe, 0x8f, 0xdf, 0xf9, 0x33, 0xe4, 0xc0, 0x42, 0x04, 0x29, 0x07, 0x69, 0xa4, - 0x05, 0xa5, 0x91, 0x27, 0xc2, 0x9e, 0x03, 0x66, 0xb1, 0x90, 0xc0, 0x2f, 0x8f, 0x38, 0x7e, 0xcc, - 0x20, 0x67, 0x99, 0x35, 0x68, 0x68, 0xe0, 0x6a, 0xd9, 0xbc, 0x96, 0x35, 0x6a, 0xd9, 0xe5, 0x51, - 0xef, 0x76, 0x64, 0x4c, 0x14, 0x03, 0x77, 0xd5, 0xe1, 0xc5, 0x3b, 0x8e, 0x3a, 0x81, 0x1c, 0x45, - 0x92, 0x95, 0x01, 0xfd, 0x9f, 0x3e, 0xd9, 0x7c, 0xaa, 0x63, 0x04, 0x4b, 0x1f, 0x12, 0xdf, 0xd8, - 0x1b, 0xde, 0x9d, 0xf6, 0xfe, 0xf6, 0x31, 0x67, 0x7f, 0x0e, 0x66, 0xa5, 0x87, 0x9d, 0x58, 0x8d, - 0x60, 0xb5, 0x18, 0xf9, 0xc6, 0xf6, 0x3e, 0xfb, 0xa4, 0x53, 0x0b, 0xf4, 0x15, 0xd9, 0x95, 0xb1, - 0xc8, 0xf3, 0x71, 0x0e, 0x31, 0x48, 0x74, 0xc9, 0xde, 0xfe, 0xf6, 0xf1, 0xe1, 0xba, 0xe4, 0x93, - 0xc2, 0x75, 0x5a, 0x99, 0x9e, 0xb5, 0x46, 0x5d, 0xd9, 0x14, 0xe8, 0x5b, 0x72, 0x3d, 0xb3, 0xe6, - 0x3d, 0x48, 0x5c, 0x24, 0xfb, 0x2e, 0x79, 0x2d, 0xf3, 0x8b, 0xd2, 0xd7, 0xc8, 0xde, 0xcb, 0x96, - 0xa5, 0x82, 0x3a, 0x14, 0x28, 0xcf, 0x16, 0xd9, 0xed, 0xbf, 0xa3, 0x1e, 0x14, 0xae, 0x26, 0x75, - 0xd8, 0x14, 0x06, 0x84, 0x74, 0xea, 0xc4, 0xfe, 0x37, 0x8f, 0x74, 0x97, 0x9a, 0xa4, 0x37, 0x49, - 0xa7, 0x9c, 0x95, 0x56, 0x6e, 0x4a, 0x1b, 0xa3, 0x6b, 0xee, 0x3d, 0x54, 0xf4, 0xee, 0xa2, 0xdd, - 0xd8, 0x48, 0x81, 0xda, 0xa4, 0xae, 0xdd, 0xad, 0x39, 0xfb, 0xf3, 0x4a, 0xa6, 0x8f, 0xc8, 0x6e, - 0xa2, 0xd3, 0x71, 0x8e, 0xc2, 0xe2, 0x58, 0x09, 0x84, 0x8a, 0xbd, 0xc7, 0xca, 0x23, 0x60, 0xf5, - 0x11, 0xb0, 0x97, 0xf5, 0x11, 0x8c, 0x76, 0x12, 0x9d, 0x9e, 0x16, 0x86, 0xc7, 0x02, 0x81, 0xde, - 0x27, 0x3b, 0x89, 0x98, 0x8c, 0x21, 0x55, 0xa5, 0x7f, 0x63, 0xad, 0x9f, 0x24, 0x62, 0xf2, 0x24, - 0x55, 0x85, 0xbb, 0xff, 0xc5, 0x23, 0x7b, 0xbf, 0x8d, 0x98, 0xde, 0x22, 0xa4, 0xc6, 0x9f, 0xf7, - 0xb6, 0x55, 0x29, 0x43, 0xb5, 0x02, 0xd9, 0xff, 0x4f, 0xe4, 0xf6, 0x3f, 0x21, 0x1f, 0x90, 0xee, - 0xd2, 0xe2, 0x8a, 0x4d, 0x94, 0xfb, 0x5f, 0x6c, 0xc2, 0xbd, 0x87, 0x6a, 0xf0, 0xfa, 0xeb, 0x34, - 0xf0, 0xae, 0xa6, 0x81, 0xf7, 0x63, 0x1a, 0x78, 0x9f, 0x66, 0x41, 0xeb, 0x6a, 0x16, 0xb4, 0xbe, - 0xcf, 0x82, 0xd6, 0x9b, 0x07, 0x91, 0xc6, 0xb3, 0x8b, 0x90, 0x49, 0x93, 0x70, 0x77, 0x26, 0x87, - 0x29, 0xe0, 0x07, 0x63, 0xcf, 0xab, 0x57, 0x0c, 0x2a, 0x02, 0xcb, 0x27, 0xab, 0xbf, 0x74, 0xb8, - 0xe9, 0x20, 0xef, 0xfd, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x3d, 0x56, 0xea, 0xf8, 0x03, 0x00, - 0x00, -} - -func (m *Filter) 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 *Filter) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Or) > 0 { - for iNdEx := len(m.Or) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Or[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Filter_Criteria) 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 *Filter_Criteria) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Filter_Criteria) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Selector != nil { - { - size := m.Selector.Size() - i -= size - if _, err := m.Selector.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *Filter_Criteria_ClassSelector) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Filter_Criteria_ClassSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ClassSelector != nil { - { - size, err := m.ClassSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} -func (m *Filter_Criteria_ProjectSelector) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Filter_Criteria_ProjectSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.ProjectSelector != nil { - { - size, err := m.ProjectSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *Filter_Criteria_BatchSelector) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Filter_Criteria_BatchSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.BatchSelector != nil { - { - size, err := m.BatchSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *ClassSelector) Marshal() (dAtA []byte, err error) { + // 269 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x2a, 0x4a, 0x4d, 0x4f, + 0xcd, 0xd3, 0x4f, 0x4d, 0xce, 0x4f, 0x2e, 0x4a, 0x4d, 0xc9, 0x2c, 0xd1, 0xcf, 0x4d, 0x2c, 0xca, + 0x4e, 0x2d, 0x29, 0xc8, 0x49, 0x4c, 0x4e, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, + 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x03, 0xab, 0xd5, 0x83, 0xab, 0xd5, 0x43, 0x52, + 0xab, 0x57, 0x66, 0x28, 0x45, 0xc8, 0xac, 0xe2, 0x92, 0xc4, 0x92, 0x54, 0x88, 0x59, 0x52, 0x22, + 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xa6, 0x3e, 0x88, 0x05, 0x11, 0x55, 0x9a, 0xc6, 0xc8, 0x25, 0xe4, + 0x98, 0x93, 0x93, 0x5f, 0xee, 0x92, 0x9a, 0x97, 0x9f, 0x1b, 0x50, 0x94, 0x5f, 0x90, 0x5f, 0x9c, + 0x98, 0x23, 0x24, 0xc2, 0xc5, 0x5a, 0x92, 0x59, 0x92, 0x93, 0x2a, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, + 0x19, 0x04, 0xe1, 0x08, 0x29, 0x70, 0x71, 0xa7, 0xa4, 0x16, 0x27, 0x17, 0x65, 0x16, 0x94, 0x64, + 0xe6, 0xe7, 0x49, 0x30, 0x81, 0xe5, 0x90, 0x85, 0x84, 0x9c, 0xb8, 0x58, 0x53, 0x40, 0x06, 0x49, + 0x30, 0x2b, 0x30, 0x6a, 0x70, 0x1b, 0xe9, 0xe8, 0xe1, 0xf7, 0x80, 0x1e, 0xd8, 0xea, 0xd4, 0x14, + 0xb0, 0xe5, 0x41, 0x10, 0xad, 0x56, 0x2c, 0x33, 0x16, 0xc8, 0x33, 0x38, 0x85, 0x9f, 0x78, 0x24, + 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x6d, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x3e, 0xd8, 0x78, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x28, 0x2f, + 0x27, 0x35, 0x25, 0x3d, 0xb5, 0x48, 0xbf, 0x02, 0x7b, 0xb0, 0x24, 0xb1, 0x81, 0x3d, 0x6e, 0x0c, + 0x08, 0x00, 0x00, 0xff, 0xff, 0xe3, 0xc7, 0xdb, 0x07, 0x88, 0x01, 0x00, 0x00, +} + +func (m *AllowDenomProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -561,31 +127,19 @@ func (m *ClassSelector) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ClassSelector) MarshalTo(dAtA []byte) (int, error) { +func (m *AllowDenomProposal) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ClassSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *AllowDenomProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.MaxEndDate != nil { - { - size, err := m.MaxEndDate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.MinStartDate != nil { + if m.Denom != nil { { - size, err := m.MinStartDate.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Denom.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -595,477 +149,62 @@ func (m *ClassSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.ProjectLocation) > 0 { - i -= len(m.ProjectLocation) - copy(dAtA[i:], m.ProjectLocation) - i = encodeVarintTypes(dAtA, i, uint64(len(m.ProjectLocation))) - i-- - dAtA[i] = 0x12 - } - if m.ClassId != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ClassId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ProjectSelector) 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 *ProjectSelector) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProjectSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MaxEndDate != nil { - { - size, err := m.MaxEndDate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MinStartDate != nil { - { - size, err := m.MinStartDate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTypes(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ProjectId != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.ProjectId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *BatchSelector) 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 *BatchSelector) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BatchSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BatchId != 0 { - i = encodeVarintTypes(dAtA, i, uint64(m.BatchId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { - offset -= sovTypes(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Filter) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Or) > 0 { - for _, e := range m.Or { - l = e.Size() - n += 1 + l + sovTypes(uint64(l)) - } - } - return n -} - -func (m *Filter_Criteria) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Selector != nil { - n += m.Selector.Size() - } - return n -} - -func (m *Filter_Criteria_ClassSelector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClassSelector != nil { - l = m.ClassSelector.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Filter_Criteria_ProjectSelector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProjectSelector != nil { - l = m.ProjectSelector.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *Filter_Criteria_BatchSelector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BatchSelector != nil { - l = m.BatchSelector.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} -func (m *ClassSelector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ClassId != 0 { - n += 1 + sovTypes(uint64(m.ClassId)) - } - l = len(m.ProjectLocation) - if l > 0 { - n += 1 + l + sovTypes(uint64(l)) - } - if m.MinStartDate != nil { - l = m.MinStartDate.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.MaxEndDate != nil { - l = m.MaxEndDate.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - -func (m *ProjectSelector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProjectId != 0 { - n += 1 + sovTypes(uint64(m.ProjectId)) - } - if m.MinStartDate != nil { - l = m.MinStartDate.Size() - n += 1 + l + sovTypes(uint64(l)) - } - if m.MaxEndDate != nil { - l = m.MaxEndDate.Size() - n += 1 + l + sovTypes(uint64(l)) - } - return n -} - -func (m *BatchSelector) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BatchId != 0 { - n += 1 + sovTypes(uint64(m.BatchId)) - } - return n -} - -func sovTypes(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTypes(x uint64) (n int) { - return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Filter) 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 ErrIntOverflowTypes - } - 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: Filter: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Filter: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Or", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Or = append(m.Or, &Filter_Criteria{}) - if err := m.Or[len(m.Or)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Filter_Criteria) 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 ErrIntOverflowTypes - } - 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: Criteria: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Criteria: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassSelector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ClassSelector{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Selector = &Filter_Criteria_ClassSelector{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProjectSelector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &ProjectSelector{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Selector = &Filter_Criteria_ProjectSelector{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchSelector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &BatchSelector{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Selector = &Filter_Criteria_BatchSelector{v} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa } + return len(dAtA) - i, nil +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return nil + dAtA[offset] = uint8(v) + return base +} +func (m *AllowDenomProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if m.Denom != nil { + l = m.Denom.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *ClassSelector) Unmarshal(dAtA []byte) error { +func (m *AllowDenomProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1088,34 +227,15 @@ func (m *ClassSelector) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ClassSelector: wiretype end group for non-group") + return fmt.Errorf("proto: AllowDenomProposal: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ClassSelector: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AllowDenomProposal: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - m.ClassId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ClassId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1143,154 +263,13 @@ func (m *ClassSelector) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProjectLocation = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinStartDate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MinStartDate == nil { - m.MinStartDate = &types.Timestamp{} - } - if err := m.MinStartDate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxEndDate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTypes - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTypes - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MaxEndDate == nil { - m.MaxEndDate = &types.Timestamp{} - } - if err := m.MaxEndDate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Title = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProjectSelector) 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 ErrIntOverflowTypes - } - 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: ProjectSelector: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProjectSelector: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) - } - m.ProjectId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProjectId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinStartDate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1300,31 +279,27 @@ func (m *ProjectSelector) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - if m.MinStartDate == nil { - m.MinStartDate = &types.Timestamp{} - } - if err := m.MinStartDate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxEndDate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1351,10 +326,10 @@ func (m *ProjectSelector) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.MaxEndDate == nil { - m.MaxEndDate = &types.Timestamp{} + if m.Denom == nil { + m.Denom = &AllowedDenom{} } - if err := m.MaxEndDate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Denom.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1379,75 +354,6 @@ func (m *ProjectSelector) Unmarshal(dAtA []byte) error { } return nil } -func (m *BatchSelector) 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 ErrIntOverflowTypes - } - 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: BatchSelector: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BatchSelector: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchId", wireType) - } - m.BatchId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTypes - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ecocredit/server/core/add_credit_type.go b/x/ecocredit/server/core/add_credit_type.go index 1cc451bd4b..ba53f8cf19 100644 --- a/x/ecocredit/server/core/add_credit_type.go +++ b/x/ecocredit/server/core/add_credit_type.go @@ -8,7 +8,7 @@ import ( "github.com/regen-network/regen-ledger/x/ecocredit/core" ) -// AddCreditType adds a new credit type to the network +// AddCreditType is a gov handler method that adds a new credit type to the network func (k Keeper) AddCreditType(ctx sdk.Context, ctp *core.CreditTypeProposal) error { if ctp == nil { return sdkerrors.ErrInvalidRequest.Wrap("nil proposal") @@ -25,5 +25,5 @@ func (k Keeper) AddCreditType(ctx sdk.Context, ctp *core.CreditTypeProposal) err }); err != nil { return sdkerrors.ErrInvalidRequest.Wrapf("could not insert credit type with abbreviation %s: %s", ct.Abbreviation, err.Error()) } - return nil + return ctx.EventManager().EmitTypedEvent(&core.EventAddCreditType{Abbreviation: ct.Abbreviation}) } diff --git a/x/ecocredit/server/core/proposal_handler.go b/x/ecocredit/server/core/proposal_handler.go deleted file mode 100644 index 1170708952..0000000000 --- a/x/ecocredit/server/core/proposal_handler.go +++ /dev/null @@ -1,29 +0,0 @@ -package core - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - coretypes "github.com/regen-network/regen-ledger/x/ecocredit/core" -) - -// ProposalKeeper defines the expected interface for ecocredit module proposals. -type ProposalKeeper interface { - AddCreditType(ctx sdk.Context, ctp *coretypes.CreditTypeProposal) error -} - -func NewCreditTypeProposalHandler(k ProposalKeeper) govtypes.Handler { - return func(ctx sdk.Context, content govtypes.Content) error { - switch c := content.(type) { - case *coretypes.CreditTypeProposal: - return handleCreditTypeProposal(ctx, k, c) - default: - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized credit type proposal content type: %T", c) - } - } -} - -func handleCreditTypeProposal(ctx sdk.Context, k ProposalKeeper, proposal *coretypes.CreditTypeProposal) error { - return k.AddCreditType(ctx, proposal) -} diff --git a/x/ecocredit/server/core/proposal_handler_test.go b/x/ecocredit/server/core/proposal_handler_test.go deleted file mode 100644 index 6fae867687..0000000000 --- a/x/ecocredit/server/core/proposal_handler_test.go +++ /dev/null @@ -1,133 +0,0 @@ -package core - -import ( - "testing" - - "gotest.tools/v3/assert" - - api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/types/ormutil" - coretypes "github.com/regen-network/regen-ledger/x/ecocredit/core" -) - -func TestCreditTypeProposal_BasicValid(t *testing.T) { - t.Parallel() - s := setupBase(t) - handler := NewCreditTypeProposalHandler(s.k) - ct := &coretypes.CreditType{ - Abbreviation: "BIO", - Name: "biodiversity", - Unit: "meters squared", - Precision: 6, - } - err := handler(s.sdkCtx, &coretypes.CreditTypeProposal{ - Title: "my credit type", - Description: "yay", - CreditType: ct, - }) - assert.NilError(t, err) - ct2, err := s.stateStore.CreditTypeTable().Get(s.ctx, "BIO") - assert.NilError(t, err) - assertCreditTypesEqual(t, ct, ct2) -} - -func TestCreditTypeProposal_InvalidPrecision(t *testing.T) { - t.Parallel() - s := setupBase(t) - handler := NewCreditTypeProposalHandler(s.k) - ct := &coretypes.CreditType{ - Abbreviation: "BIO", - Name: "biodiversity", - Unit: "meters squared", - Precision: 3, - } - err := handler(s.sdkCtx, &coretypes.CreditTypeProposal{ - Title: "My New Credit Type", - Description: "its very cool and awesome", - CreditType: ct, - }) - assert.ErrorContains(t, err, "credit type precision is currently locked to 6") -} - -func TestCreditTypeProposal_InvalidAbbreviation(t *testing.T) { - t.Parallel() - s := setupBase(t) - handler := NewCreditTypeProposalHandler(s.k) - ct := &coretypes.CreditType{ - Abbreviation: "biO", - Name: "biodiversity", - Unit: "meters squared", - Precision: 6, - } - err := handler(s.sdkCtx, &coretypes.CreditTypeProposal{ - Title: "My New Credit Type", - Description: "its very cool and awesome", - CreditType: ct, - }) - assert.ErrorContains(t, err, "credit type abbreviation must be 1-3 uppercase latin letters") -} - -func TestCreditTypeProposal_NoName(t *testing.T) { - t.Parallel() - s := setupBase(t) - handler := NewCreditTypeProposalHandler(s.k) - ct := &coretypes.CreditType{ - Abbreviation: "BIO", - Unit: "meters squared", - Precision: 6, - } - err := handler(s.sdkCtx, &coretypes.CreditTypeProposal{ - Title: "My New Credit Type", - Description: "its very cool and awesome", - CreditType: ct, - }) - assert.ErrorContains(t, err, "name cannot be empty") -} - -func TestCreditTypeProposal_NoUnit(t *testing.T) { - t.Parallel() - s := setupBase(t) - handler := NewCreditTypeProposalHandler(s.k) - ct := &coretypes.CreditType{ - Abbreviation: "BIO", - Name: "FooBar", - Precision: 6, - } - err := handler(s.sdkCtx, &coretypes.CreditTypeProposal{ - Title: "My New Credit Type", - Description: "its very cool and awesome", - CreditType: ct, - }) - assert.ErrorContains(t, err, "unit cannot be empty") -} - -func TestCreditTypeProposal_Duplicate(t *testing.T) { - t.Parallel() - s := setupBase(t) - handler := NewCreditTypeProposalHandler(s.k) - ct := &coretypes.CreditType{ - Abbreviation: "BIO", - Name: "FooBar", - Unit: "many", - Precision: 6, - } - var pulsarCreditType api.CreditType - assert.NilError(t, ormutil.GogoToPulsarSlow(ct, &pulsarCreditType)) - assert.NilError(t, s.stateStore.CreditTypeTable().Insert(s.ctx, &pulsarCreditType)) - err := handler(s.sdkCtx, &coretypes.CreditTypeProposal{ - Title: "My New Credit Type", - Description: "its very cool and awesome", - CreditType: ct, - }) - assert.ErrorContains(t, err, "could not insert credit type with abbreviation BIO") -} - -func assertCreditTypesEqual(t *testing.T, ct *coretypes.CreditType, ct2 *api.CreditType) { - assert.Check(t, ct != nil) - assert.Check(t, ct2 != nil) - - assert.Equal(t, ct.Abbreviation, ct2.Abbreviation) - assert.Equal(t, ct.Name, ct2.Name) - assert.Equal(t, ct.Unit, ct2.Unit) - assert.Equal(t, ct.Precision, ct2.Precision) -} diff --git a/x/ecocredit/server/expected_keepers.go b/x/ecocredit/server/expected_keepers.go index 0be67f45a0..8206097aa3 100644 --- a/x/ecocredit/server/expected_keepers.go +++ b/x/ecocredit/server/expected_keepers.go @@ -2,12 +2,10 @@ package server import ( sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/regen-network/regen-ledger/x/ecocredit/server/core" ) -// Keeper defines the expected interface needed to prune expired buy and sell orders. +// Keeper defines a set of methods the ecocredit module exposes. type Keeper interface { - core.ProposalKeeper + ProposalKeeper PruneOrders(ctx sdk.Context) error } diff --git a/x/ecocredit/server/marketplace/allow_denom.go b/x/ecocredit/server/marketplace/allow_denom.go new file mode 100644 index 0000000000..23e73c50bc --- /dev/null +++ b/x/ecocredit/server/marketplace/allow_denom.go @@ -0,0 +1,29 @@ +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/cancel_sell_order_test.go b/x/ecocredit/server/marketplace/cancel_sell_order_test.go index 2c17316fe2..c2276a7a77 100644 --- a/x/ecocredit/server/marketplace/cancel_sell_order_test.go +++ b/x/ecocredit/server/marketplace/cancel_sell_order_test.go @@ -11,7 +11,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" - "github.com/regen-network/regen-ledger/x/ecocredit/core" "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" ) @@ -20,9 +19,6 @@ func TestSell_CancelOrder(t *testing.T) { s := setupBase(t) expir := time.Now() s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], "C01", start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(1) balBefore, err := s.coreStore.BatchBalanceTable().Get(s.ctx, s.addr, 1) assert.NilError(t, err) @@ -55,10 +51,6 @@ func TestSell_CancelOrderInvalid(t *testing.T) { expir := time.Now() s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], "C01", start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(1) - _, _, otherAddr := testdata.KeyTestPubAddr() res, err := s.k.Sell(s.ctx, &marketplace.MsgSell{ diff --git a/x/ecocredit/server/marketplace/keeper_test.go b/x/ecocredit/server/marketplace/keeper_test.go index 1efc450f20..b405f12d72 100644 --- a/x/ecocredit/server/marketplace/keeper_test.go +++ b/x/ecocredit/server/marketplace/keeper_test.go @@ -29,6 +29,10 @@ import ( "github.com/regen-network/regen-ledger/x/ecocredit/server/utils" ) +var ( + gmAny = gomock.Any() +) + type baseSuite struct { t *testing.T db ormdb.ModuleDB @@ -82,9 +86,6 @@ func setupBase(t *testing.T) *baseSuite { } func (s *baseSuite) createSellOrder(msg *marketplace.MsgSell) []uint64 { - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(len(msg.Orders)) res, err := s.k.Sell(s.ctx, msg) assert.NilError(s.t, err) return res.SellOrderIds @@ -197,12 +198,11 @@ func (s *baseSuite) testSellSetup(batchDenom, bankDenom, displayDenom, classId s BankDenom: bankDenom, PrecisionModifier: 0, })) - // TODO: awaiting param refactor https://github.com/regen-network/regen-ledger/issues/624 - //assert.NilError(s.t, s.marketStore.AllowedDenomTable().Insert(s.ctx, &marketApi.AllowedDenom{ - // BankDenom: bankDenom, - // DisplayDenom: displayDenom, - // Exponent: 1, - //})) + assert.NilError(s.t, s.marketStore.AllowedDenomTable().Insert(s.ctx, &api.AllowedDenom{ + BankDenom: bankDenom, + DisplayDenom: displayDenom, + Exponent: 1, + })) assert.NilError(s.t, s.k.coreStore.BatchBalanceTable().Insert(s.ctx, &ecoApi.BatchBalance{ BatchKey: 1, Address: s.addr, diff --git a/x/ecocredit/server/marketplace/prune_test.go b/x/ecocredit/server/marketplace/prune_test.go index c926e99fc6..1fa320aca9 100644 --- a/x/ecocredit/server/marketplace/prune_test.go +++ b/x/ecocredit/server/marketplace/prune_test.go @@ -10,7 +10,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit/core" "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" ) @@ -18,9 +17,6 @@ func TestSell_Prune(t *testing.T) { t.Parallel() s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], "C01", start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(2) blockTime, err := time.Parse("2006-01-02", "2020-01-01") assert.NilError(t, err) diff --git a/x/ecocredit/server/marketplace/query_allowed_denoms.go b/x/ecocredit/server/marketplace/query_allowed_denoms.go index ffaa2e529d..b5f89e3174 100644 --- a/x/ecocredit/server/marketplace/query_allowed_denoms.go +++ b/x/ecocredit/server/marketplace/query_allowed_denoms.go @@ -3,9 +3,37 @@ package marketplace import ( "context" + "github.com/cosmos/cosmos-sdk/orm/model/ormlist" + + marketplacev1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" + "github.com/regen-network/regen-ledger/types/ormutil" "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" ) func (k Keeper) AllowedDenoms(ctx context.Context, req *marketplace.QueryAllowedDenomsRequest) (*marketplace.QueryAllowedDenomsResponse, error) { - panic("not implemented") + pg, err := ormutil.GogoPageReqToPulsarPageReq(req.Pagination) + if err != nil { + return nil, err + } + + it, err := k.stateStore.AllowedDenomTable().List(ctx, &marketplacev1.AllowedDenomPrimaryKey{}, ormlist.Paginate(pg)) + defer it.Close() + + allowedDenoms := make([]*marketplace.AllowedDenom, 0) + for it.Next() { + allowedDenom, err := it.Value() + if err != nil { + return nil, err + } + var ad marketplace.AllowedDenom + if err = ormutil.PulsarToGogoSlow(allowedDenom, &ad); err != nil { + return nil, err + } + allowedDenoms = append(allowedDenoms, &ad) + } + pr, err := ormutil.PulsarPageResToGogoPageRes(it.PageResponse()) + if err != nil { + return nil, err + } + return &marketplace.QueryAllowedDenomsResponse{AllowedDenoms: allowedDenoms, Pagination: pr}, nil } diff --git a/x/ecocredit/server/marketplace/query_allowed_denoms_test.go b/x/ecocredit/server/marketplace/query_allowed_denoms_test.go new file mode 100644 index 0000000000..a2c1d1d9a8 --- /dev/null +++ b/x/ecocredit/server/marketplace/query_allowed_denoms_test.go @@ -0,0 +1,43 @@ +package marketplace + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/types/query" + "gotest.tools/v3/assert" + + api "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" + "github.com/regen-network/regen-ledger/types/ormutil" + "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" +) + +func TestQueryAllowedDenoms(t *testing.T) { + t.Parallel() + s := setupBase(t) + + allowedDenom := api.AllowedDenom{ + BankDenom: "uregen", + DisplayDenom: "regen", + Exponent: 18, + } + err := s.marketStore.AllowedDenomTable().Insert(s.ctx, &allowedDenom) + assert.NilError(t, err) + + allowedDenomOsmo := api.AllowedDenom{ + BankDenom: "uosmo", + DisplayDenom: "osmo", + Exponent: 18, + } + err = s.marketStore.AllowedDenomTable().Insert(s.ctx, &allowedDenomOsmo) + assert.NilError(t, err) + + var gogoAllowedDenom marketplace.AllowedDenom + assert.NilError(t, ormutil.PulsarToGogoSlow(&allowedDenomOsmo, &gogoAllowedDenom)) + + res, err := s.k.AllowedDenoms(s.ctx, &marketplace.QueryAllowedDenomsRequest{Pagination: &query.PageRequest{CountTotal: true, Limit: 1}}) + assert.NilError(t, err) + assert.Check(t, res.Pagination != nil) + assert.Equal(t, res.Pagination.Total, uint64(2)) + assert.Equal(t, 1, len(res.AllowedDenoms)) + assert.DeepEqual(t, res.AllowedDenoms[0], &gogoAllowedDenom) +} diff --git a/x/ecocredit/server/marketplace/sell.go b/x/ecocredit/server/marketplace/sell.go index e8deac908e..3aa6eb7386 100644 --- a/x/ecocredit/server/marketplace/sell.go +++ b/x/ecocredit/server/marketplace/sell.go @@ -52,7 +52,11 @@ func (k Keeper) Sell(ctx context.Context, req *marketplace.MsgSell) (*marketplac return nil, err } - if !isDenomAllowed(sdkCtx, order.AskPrice.Denom, k.paramsKeeper) { + allowed, err := isDenomAllowed(ctx, order.AskPrice.Denom, k.stateStore.AllowedDenomTable()) + if err != nil { + return nil, err + } + if !allowed { return nil, sdkerrors.ErrInvalidRequest.Wrapf("%s is not allowed to be used in sell orders", order.AskPrice.Denom) } diff --git a/x/ecocredit/server/marketplace/sell_test.go b/x/ecocredit/server/marketplace/sell_test.go index 2fd59c7118..321603e459 100644 --- a/x/ecocredit/server/marketplace/sell_test.go +++ b/x/ecocredit/server/marketplace/sell_test.go @@ -10,7 +10,6 @@ import ( api "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit/core" "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" ) @@ -18,9 +17,6 @@ func TestSell_Valid(t *testing.T) { t.Parallel() s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], "C01", start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(2) balanceBefore, err := s.coreStore.BatchBalanceTable().Get(s.ctx, s.addr, 1) assert.NilError(t, err) @@ -64,9 +60,11 @@ func TestSell_CreatesMarket(t *testing.T) { s.testSellSetup(batchDenom, "ufoo", "foo", "C01", start, end, creditType) sellTime := time.Now() newCoin := sdk.NewInt64Coin("ubaz", 10) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: newCoin.Denom}} - }).Times(1) + assert.NilError(t, s.marketStore.AllowedDenomTable().Insert(s.ctx, &api.AllowedDenom{ + BankDenom: newCoin.Denom, + DisplayDenom: newCoin.Denom, + Exponent: 18, + })) // market shouldn't exist before sell call has, err := s.k.stateStore.MarketTable().HasByCreditTypeBankDenom(s.ctx, creditType.Abbreviation, newCoin.Denom) @@ -87,7 +85,6 @@ func TestSell_CreatesMarket(t *testing.T) { assert.Equal(t, true, has) } -// TODO: add a check once params are refactored and the ask denom param is active - https://github.com/regen-network/regen-ledger/issues/624 func TestSell_Invalid(t *testing.T) { t.Parallel() s := setupBase(t) @@ -129,9 +126,6 @@ func TestSell_InvalidDenom(t *testing.T) { t.Parallel() s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], "C01", start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(1) sellTime := time.Now() invalidAsk := sdk.NewInt64Coin("ubar", 10) diff --git a/x/ecocredit/server/marketplace/update_sell_orders.go b/x/ecocredit/server/marketplace/update_sell_orders.go index f728170030..fb8c0f72df 100644 --- a/x/ecocredit/server/marketplace/update_sell_orders.go +++ b/x/ecocredit/server/marketplace/update_sell_orders.go @@ -52,9 +52,15 @@ func (k Keeper) applySellOrderUpdates(ctx context.Context, order *api.SellOrder, if err != nil { return err } - if !isDenomAllowed(sdkCtx, update.NewAskPrice.Denom, k.paramsKeeper) { - return sdkerrors.ErrInvalidRequest.Wrapf("%s cannot be used in sell orders", update.NewAskPrice.Denom) + + allowed, err := isDenomAllowed(ctx, update.NewAskPrice.Denom, k.stateStore.AllowedDenomTable()) + if err != nil { + return err } + if !allowed { + return sdkerrors.ErrInvalidRequest.Wrapf("%s is not allowed to be used in sell orders", update.NewAskPrice.Denom) + } + if market.BankDenom != update.NewAskPrice.Denom { creditType, err = k.getCreditTypeFromBatchId(ctx, order.BatchId) if err != nil { diff --git a/x/ecocredit/server/marketplace/update_sell_orders_test.go b/x/ecocredit/server/marketplace/update_sell_orders_test.go index ac396fb6fa..fb4cc447fd 100644 --- a/x/ecocredit/server/marketplace/update_sell_orders_test.go +++ b/x/ecocredit/server/marketplace/update_sell_orders_test.go @@ -4,7 +4,6 @@ import ( "testing" "time" - "github.com/golang/mock/gomock" "gotest.tools/v3/assert" "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" @@ -12,21 +11,16 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + marketApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit/core" "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" ) -var gmAny = gomock.Any() - func TestUpdateSellOrders_QuantityAndAutoRetire(t *testing.T) { t.Parallel() s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], classId, start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(2) expiration := time.Now() _, err := s.k.Sell(s.ctx, &marketplace.MsgSell{ Owner: s.addr.String(), @@ -75,9 +69,6 @@ func TestUpdateSellOrders_QuantityInvalid(t *testing.T) { s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], classId, start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(2) expiration := time.Now() _, err := s.k.Sell(s.ctx, &marketplace.MsgSell{ Owner: s.addr.String(), @@ -121,9 +112,6 @@ func TestUpdateSellOrders_Unauthorized(t *testing.T) { s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], classId, start, end, creditType) _, _, unauthorized := testdata.KeyTestPubAddr() - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(2) expiration := time.Now() _, err := s.k.Sell(s.ctx, &marketplace.MsgSell{ Owner: s.addr.String(), @@ -149,9 +137,6 @@ func TestUpdateSellOrder_AskPrice(t *testing.T) { s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], classId, start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}, {Denom: "ubar"}} - }).Times(3) expiration := time.Now() _, err := s.k.Sell(s.ctx, &marketplace.MsgSell{ Owner: s.addr.String(), @@ -181,6 +166,10 @@ func TestUpdateSellOrder_AskPrice(t *testing.T) { // can update price with new denom in allowed ask denoms askUpdate = sdk.NewInt64Coin("ubar", 18) + assert.NilError(t, s.marketStore.AllowedDenomTable().Insert(s.ctx, &marketApi.AllowedDenom{ + BankDenom: askUpdate.Denom, + DisplayDenom: askUpdate.Denom, + })) _, err = s.k.UpdateSellOrders(s.ctx, &marketplace.MsgUpdateSellOrders{ Owner: s.addr.String(), Updates: []*marketplace.MsgUpdateSellOrders_Update{ @@ -201,10 +190,6 @@ func TestUpdateSellOrder_Expiration(t *testing.T) { s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], classId, start, end, creditType) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(1) - future := time.Date(2077, 1, 1, 1, 1, 1, 1, time.Local) middle := time.Date(2022, 1, 1, 1, 1, 1, 1, time.Local) past := time.Date(1970, 1, 1, 1, 1, 1, 1, time.Local) @@ -254,9 +239,6 @@ func TestSellOrder_InvalidDenom(t *testing.T) { s := setupBase(t) s.testSellSetup(batchDenom, ask.Denom, ask.Denom[1:], classId, start, end, creditType) invalidAsk := sdk.NewInt64Coin("ubar", 10) - s.paramsKeeper.EXPECT().GetParamSet(gmAny, gmAny).Do(func(any interface{}, p *core.Params) { - p.AllowedAskDenoms = []*core.AskDenom{{Denom: ask.Denom}} - }).Times(1) expiration := time.Now() _, err := s.k.Sell(s.ctx, &marketplace.MsgSell{ Owner: s.addr.String(), diff --git a/x/ecocredit/server/marketplace/utils.go b/x/ecocredit/server/marketplace/utils.go index 48414f8736..a30f099fe7 100644 --- a/x/ecocredit/server/marketplace/utils.go +++ b/x/ecocredit/server/marketplace/utils.go @@ -13,15 +13,8 @@ import ( ) // isDenomAllowed checks if the denom is allowed to be used in orders. -func isDenomAllowed(ctx sdk.Context, denom string, pk ecocredit.ParamKeeper) bool { - var params core.Params - pk.GetParamSet(ctx, ¶ms) - for _, askDenom := range params.AllowedAskDenoms { - if askDenom.Denom == denom { - return true - } - } - return false +func isDenomAllowed(ctx context.Context, bankDenom string, table api.AllowedDenomTable) (bool, error) { + return table.Has(ctx, bankDenom) } type orderOptions struct { diff --git a/x/ecocredit/server/proposal.go b/x/ecocredit/server/proposal.go new file mode 100644 index 0000000000..0729c4bd90 --- /dev/null +++ b/x/ecocredit/server/proposal.go @@ -0,0 +1,45 @@ +package server + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + + "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" +) + +// ProposalKeeper defines methods for ecocredit gov handlers. +type ProposalKeeper interface { + AddCreditType(ctx sdk.Context, ctp *core.CreditTypeProposal) error + 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 (s serverImpl) AddCreditType(ctx sdk.Context, ctp *core.CreditTypeProposal) error { + return s.coreKeeper.AddCreditType(ctx, ctp) +} + +func NewProposalHandler(k ProposalKeeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + switch c := content.(type) { + case *core.CreditTypeProposal: + return handleAddCreditTypeProposal(ctx, k, c) + 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) +} + +func handleAddCreditTypeProposal(ctx sdk.Context, k ProposalKeeper, proposal *core.CreditTypeProposal) error { + return k.AddCreditType(ctx, proposal) +} diff --git a/x/ecocredit/server/proposal_test.go b/x/ecocredit/server/proposal_test.go new file mode 100644 index 0000000000..d758e60ee0 --- /dev/null +++ b/x/ecocredit/server/proposal_test.go @@ -0,0 +1,96 @@ +package server + +import ( + "context" + "testing" + + "github.com/cosmos/cosmos-sdk/orm/model/ormtable" + "github.com/cosmos/cosmos-sdk/orm/testing/ormtest" + "github.com/cosmos/cosmos-sdk/store" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/golang/mock/gomock" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" + "gotest.tools/v3/assert" + + "github.com/regen-network/regen-ledger/x/ecocredit/core" + "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) + distKeeper := mocks.NewMockDistributionKeeper(ctrl) + s.server = newServer(storeKey, paramtypes.Subspace{}, accountKeeper, bankKeeper, distKeeper) + db := dbm.NewMemDB() + cms := store.NewCommitMultiStore(db) + cms.MountStoreWithDB(storeKey, sdk.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_CreditType(t *testing.T) { + t.Parallel() + s := setup(t) + handler := NewProposalHandler(s.server) + creditTypeProposal := core.CreditTypeProposal{ + Title: "carbon type", + Description: "i would like to add a carbon type", + CreditType: &core.CreditType{ + Abbreviation: "FOO", + Name: "FOOBAR", + Unit: "metric ton c02 equivalent", + Precision: 6, + }, + } + err := handler(s.sdkCtx, &creditTypeProposal) + assert.NilError(t, err) + res, err := s.server.coreKeeper.CreditTypes(s.ctx, &core.QueryCreditTypesRequest{}) + assert.NilError(t, err) + assert.Check(t, len(res.CreditTypes) == 1) + assert.DeepEqual(t, creditTypeProposal.CreditType, res.CreditTypes[0]) +} + +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 2dc2d29a20..485074882f 100644 --- a/x/ecocredit/server/server.go +++ b/x/ecocredit/server/server.go @@ -34,10 +34,6 @@ type serverImpl struct { stateStore api.StateStore } -func (s serverImpl) AddCreditType(ctx sdk.Context, ctp *coretypes.CreditTypeProposal) error { - return s.coreKeeper.AddCreditType(ctx, ctp) -} - func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper ecocredit.AccountKeeper, bankKeeper ecocredit.BankKeeper, distKeeper ecocredit.DistributionKeeper) serverImpl { s := serverImpl{ @@ -54,10 +50,10 @@ func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, } coreStore, basketStore, marketStore := getStateStores(s.db) + s.stateStore = coreStore s.basketKeeper = basket.NewKeeper(basketStore, coreStore, bankKeeper, distKeeper, s.paramSpace) s.coreKeeper = core.NewKeeper(coreStore, bankKeeper, s.paramSpace) s.marketplaceKeeper = marketplace.NewKeeper(marketStore, coreStore, bankKeeper, s.paramSpace) - return s } diff --git a/x/ecocredit/server/testsuite/suite.go b/x/ecocredit/server/testsuite/suite.go index 45f13b20ed..21be7cf30f 100644 --- a/x/ecocredit/server/testsuite/suite.go +++ b/x/ecocredit/server/testsuite/suite.go @@ -13,6 +13,7 @@ import ( "github.com/stretchr/testify/suite" dbm "github.com/tendermint/tm-db" + marketApi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/x/ecocredit" @@ -135,6 +136,14 @@ func (s *IntegrationTestSuite) ecocreditGenesis() json.RawMessage { ormCtx := ormtable.WrapContextDefault(backend) ss, err := api.NewStateStore(modDB) s.Require().NoError(err) + ms, err := marketApi.NewStateStore(modDB) + s.Require().NoError(err) + + err = ms.AllowedDenomTable().Insert(ormCtx, &marketApi.AllowedDenom{ + BankDenom: sdk.DefaultBondDenom, + DisplayDenom: sdk.DefaultBondDenom, + }) + s.Require().NoError(err) err = ss.CreditTypeTable().Insert(ormCtx, &api.CreditType{ Abbreviation: "C", @@ -1004,8 +1013,7 @@ func (s *IntegrationTestSuite) TestScenario() { }) } - coinPrice := sdk.NewInt64Coin("stake", 1000000) - s.paramSpace.Set(s.sdkCtx, core.KeyAllowedAskDenoms, append(core.DefaultParams().AllowedAskDenoms, &core.AskDenom{Denom: coinPrice.Denom})) + coinPrice := sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000000) expiration := time.Date(2030, 01, 01, 0, 0, 0, 0, time.UTC) expectedSellOrderIds := []uint64{1, 2} diff --git a/x/ecocredit/simulation/genesis.go b/x/ecocredit/simulation/genesis.go index b48a0a7fc4..ecfdc40576 100644 --- a/x/ecocredit/simulation/genesis.go +++ b/x/ecocredit/simulation/genesis.go @@ -18,9 +18,11 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" dbm "github.com/tendermint/tm-db" + marketplaceapi "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1" api "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1" "github.com/regen-network/regen-ledger/x/ecocredit" "github.com/regen-network/regen-ledger/x/ecocredit/core" + "github.com/regen-network/regen-ledger/x/ecocredit/marketplace" ) // Simulation parameter constants @@ -29,13 +31,14 @@ const ( allowedCreators = "allowed_class_creators" typeAllowListEnabled = "allow_list_enabled" typeCreditTypes = "credit_types" + typeAllowedDenom = "allowed_denom" ) -func genAskDenoms() []*core.AskDenom { - return []*core.AskDenom{ +func genAllowedDenoms() []*marketplace.AllowedDenom { + return []*marketplace.AllowedDenom{ { - Denom: "stake", - DisplayDenom: "stake", + BankDenom: sdk.DefaultBondDenom, + DisplayDenom: sdk.DefaultBondDenom, Exponent: 18, }, } @@ -99,6 +102,7 @@ func RandomizedGenState(simState *module.SimulationState) { allowedClassCreators []string allowListEnabled bool creditTypes []*core.CreditType + allowedDenoms []*marketplace.AllowedDenom basketCreationFee sdk.Coins ) @@ -128,12 +132,16 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { creditTypes = genCreditTypes(r) }, ) + simState.AppParams.GetOrGenerate( + simState.Cdc, typeAllowedDenom, &allowedDenoms, simState.Rand, + func(r *rand.Rand) { allowedDenoms = genAllowedDenoms() }, + ) + params := &core.Params{ CreditClassFee: creditClassFee, AllowedClassCreators: allowedClassCreators, AllowlistEnabled: allowListEnabled, BasketFee: basketCreationFee, - AllowedAskDenoms: genAskDenoms(), } db := dbm.NewMemDB() @@ -152,11 +160,15 @@ func RandomizedGenState(simState *module.SimulationState) { if err != nil { panic(err) } + ms, err := marketplaceapi.NewStateStore(ormdb) + if err != nil { + panic(err) + } simState.AppParams.GetOrGenerate( simState.Cdc, typeCreditTypes, &creditTypes, simState.Rand, func(r *rand.Rand) { - if err := genGenesisState(ormCtx, r, simState, ss); err != nil { + if err := genGenesisState(ormCtx, r, simState, ss, ms); err != nil { panic(err) } }) @@ -277,7 +289,7 @@ func getBatchSequence(ctx context.Context, sStore api.StateStore, projectKey uin return seq.NextSequence, nil } -func genGenesisState(ctx context.Context, r *rand.Rand, simState *module.SimulationState, ss api.StateStore) error { +func genGenesisState(ctx context.Context, r *rand.Rand, simState *module.SimulationState, ss api.StateStore, ms marketplaceapi.StateStore) error { accs := simState.Accounts metadata := simtypes.RandStringOfLength(r, simtypes.RandIntBetween(r, 5, 100)) @@ -299,6 +311,14 @@ func genGenesisState(ctx context.Context, r *rand.Rand, simState *module.Simulat return err } + if err := ms.AllowedDenomTable().Insert(ctx, &marketplaceapi.AllowedDenom{ + BankDenom: sdk.DefaultBondDenom, + DisplayDenom: sdk.DefaultBondDenom, + Exponent: 18, + }); err != nil { + return err + } + // create few classes cKey1, err := createClass(ctx, ss, &api.Class{ Id: "C01", diff --git a/x/ecocredit/simulation/params.go b/x/ecocredit/simulation/params.go index 10f0e6e067..46fe13207a 100644 --- a/x/ecocredit/simulation/params.go +++ b/x/ecocredit/simulation/params.go @@ -56,15 +56,5 @@ func ParamChanges() []simtypes.ParamChange { return string(bz) }, ), - - simulation.NewSimParamChange(ecocredit.ModuleName, string(core.KeyAllowedAskDenoms), - func(r *rand.Rand) string { - bz, err := json.Marshal(genAskDenoms()) - if err != nil { - panic(err) - } - return string(bz) - }, - ), } } diff --git a/x/ecocredit/simulation/params_test.go b/x/ecocredit/simulation/params_test.go index c3317369d7..78799079b7 100644 --- a/x/ecocredit/simulation/params_test.go +++ b/x/ecocredit/simulation/params_test.go @@ -1,13 +1,11 @@ package simulation_test import ( - "encoding/json" "math/rand" "testing" "github.com/stretchr/testify/require" - "github.com/regen-network/regen-ledger/x/ecocredit/core" "github.com/regen-network/regen-ledger/x/ecocredit/simulation" ) @@ -15,15 +13,6 @@ func TestParamChanges(t *testing.T) { s := rand.NewSource(1) r := rand.New(s) - bz1, err := json.Marshal([]*core.AskDenom{ - { - Denom: "stake", - DisplayDenom: "stake", - Exponent: 18, - }, - }) - require.NoError(t, err) - expected := []struct { composedKey string key string @@ -33,11 +22,10 @@ func TestParamChanges(t *testing.T) { {"ecocredit/CreditClassFee", "CreditClassFee", "[{\"denom\":\"stake\",\"amount\":\"6\"}]", "ecocredit"}, {"ecocredit/AllowlistEnabled", "AllowlistEnabled", "true", "ecocredit"}, {"ecocredit/AllowedClassCreators", "AllowedClassCreators", "[\"cosmos10z82e5ztmrm4pujgummvmr7aqjzwlp6ga9ams9\"]", "ecocredit"}, - {"ecocredit/AllowedAskDenoms", "AllowedAskDenoms", string(bz1), "ecocredit"}, } paramChanges := simulation.ParamChanges() - require.Len(t, paramChanges, 4) + require.Len(t, paramChanges, 3) for i, p := range paramChanges { require.Equal(t, expected[i].composedKey, p.ComposedKey())