From 8676847bf18c8caf444bc54b915c92f39e11fe15 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:35:58 -0800 Subject: [PATCH 01/31] fix: generate all v1beta1 codes in their own packages, fix core servers --- api/regen/data/v1alpha2/events.pulsar.go | 2 +- api/regen/data/v1alpha2/genesis.pulsar.go | 2 +- api/regen/data/v1alpha2/query.pulsar.go | 2 +- api/regen/data/v1alpha2/query_grpc.pb.go | 2 +- api/regen/data/v1alpha2/tx.pulsar.go | 2 +- api/regen/data/v1alpha2/tx_grpc.pb.go | 2 +- api/regen/data/v1alpha2/types.pulsar.go | 2 +- .../ecocredit/basket/v1beta1/events.pulsar.go | 2 +- .../ecocredit/basket/v1beta1/query.pulsar.go | 2 +- .../ecocredit/basket/v1beta1/query_grpc.pb.go | 2 +- .../ecocredit/basket/v1beta1/state.pulsar.go | 2 +- .../ecocredit/basket/v1beta1/tx.pulsar.go | 2 +- .../ecocredit/basket/v1beta1/tx_grpc.pb.go | 2 +- .../ecocredit/basket/v1beta1/types.pulsar.go | 2 +- .../marketplace/v1beta1/events.pulsar.go | 2 +- .../marketplace/v1beta1/query.pulsar.go | 2 +- .../marketplace/v1beta1/query_grpc.pb.go | 2 +- .../marketplace/v1beta1/state.pulsar.go | 2 +- .../marketplace/v1beta1/tx.pulsar.go | 2 +- .../marketplace/v1beta1/tx_grpc.pb.go | 2 +- .../marketplace/v1beta1/types.pulsar.go | 2 +- .../orderbook/v1beta1/memory.pulsar.go | 2 +- api/regen/ecocredit/v1alpha1/events.pulsar.go | 2 +- .../ecocredit/v1alpha1/genesis.pulsar.go | 2 +- api/regen/ecocredit/v1alpha1/query.pulsar.go | 2 +- api/regen/ecocredit/v1alpha1/query_grpc.pb.go | 2 +- api/regen/ecocredit/v1alpha1/tx.pulsar.go | 2 +- api/regen/ecocredit/v1alpha1/tx_grpc.pb.go | 2 +- api/regen/ecocredit/v1alpha1/types.pulsar.go | 2 +- api/regen/ecocredit/v1alpha2/events.pulsar.go | 2 +- .../ecocredit/v1alpha2/genesis.pulsar.go | 2 +- api/regen/ecocredit/v1alpha2/query.pulsar.go | 2 +- api/regen/ecocredit/v1alpha2/query_grpc.pb.go | 2 +- api/regen/ecocredit/v1alpha2/tx.pulsar.go | 2 +- api/regen/ecocredit/v1alpha2/tx_grpc.pb.go | 2 +- api/regen/ecocredit/v1alpha2/types.pulsar.go | 2 +- api/regen/ecocredit/v1beta1/events.pulsar.go | 2 +- api/regen/ecocredit/v1beta1/query.pulsar.go | 1910 ++++++-- api/regen/ecocredit/v1beta1/query_grpc.pb.go | 40 +- api/regen/ecocredit/v1beta1/state.pulsar.go | 2 +- api/regen/ecocredit/v1beta1/tx.pulsar.go | 2 +- api/regen/ecocredit/v1beta1/tx_grpc.pb.go | 2 +- api/regen/ecocredit/v1beta1/types.pulsar.go | 2 +- api/regen/group/v1alpha1/events.pulsar.go | 2 +- api/regen/group/v1alpha1/genesis.pulsar.go | 2 +- api/regen/group/v1alpha1/query.pulsar.go | 2 +- api/regen/group/v1alpha1/query_grpc.pb.go | 2 +- api/regen/group/v1alpha1/tx.pulsar.go | 2 +- api/regen/group/v1alpha1/tx_grpc.pb.go | 2 +- api/regen/group/v1alpha1/types.pulsar.go | 2 +- go.sum | 1 - .../ecocredit/basket/v1beta1/events.proto | 2 +- .../ecocredit/basket/v1beta1/query.proto | 2 +- .../ecocredit/basket/v1beta1/state.proto | 2 +- proto/regen/ecocredit/basket/v1beta1/tx.proto | 2 +- .../ecocredit/basket/v1beta1/types.proto | 2 +- .../marketplace/v1beta1/events.proto | 2 +- .../ecocredit/marketplace/v1beta1/query.proto | 2 +- .../ecocredit/marketplace/v1beta1/state.proto | 2 +- .../ecocredit/marketplace/v1beta1/tx.proto | 2 +- .../ecocredit/marketplace/v1beta1/types.proto | 2 +- proto/regen/ecocredit/v1beta1/query.proto | 31 +- types/math/dec.go | 4 +- x/data/query.pb.gw.go | 13 +- x/ecocredit/basket/v1beta1/events.pb.go | 39 + x/ecocredit/basket/v1beta1/query.pb.go | 2029 +++++++++ x/ecocredit/basket/v1beta1/query.pb.gw.go | 373 ++ x/ecocredit/basket/v1beta1/state.pb.go | 417 ++ x/ecocredit/basket/v1beta1/tx.pb.go | 2513 +++++++++++ x/ecocredit/basket/v1beta1/types.pb.go | 2291 ++++++++++ x/ecocredit/denom.go | 22 +- x/ecocredit/go.mod | 4 +- x/ecocredit/go.sum | 9 +- x/ecocredit/marketplace/v1beta1/events.pb.go | 2233 +++++++++ x/ecocredit/marketplace/v1beta1/query.pb.go | 3975 +++++++++++++++++ .../marketplace/v1beta1/query.pb.gw.go | 896 ++++ x/ecocredit/marketplace/v1beta1/state.pb.go | 2232 +++++++++ x/ecocredit/marketplace/v1beta1/tx.pb.go | 3716 +++++++++++++++ x/ecocredit/marketplace/v1beta1/types.pb.go | 1549 +++++++ x/ecocredit/query.pb.gw.go | 67 +- x/ecocredit/server/core/denom.go | 16 + x/ecocredit/server/core/genesis.go | 30 + x/ecocredit/server/core/invariants.go | 217 + x/ecocredit/server/core/invariants_test.go | 494 ++ x/ecocredit/server/core/msg_server.go | 1199 +++++ x/ecocredit/server/core/operations.go | 20 + x/ecocredit/server/core/query_server.go | 619 +++ x/ecocredit/server/core/server.go | 83 + x/ecocredit/v1beta1/query.pb.go | 728 ++- x/ecocredit/v1beta1/query.pb.gw.go | 153 +- x/group/query.pb.gw.go | 37 +- 91 files changed, 27605 insertions(+), 471 deletions(-) create mode 100644 x/ecocredit/basket/v1beta1/events.pb.go create mode 100644 x/ecocredit/basket/v1beta1/query.pb.go create mode 100644 x/ecocredit/basket/v1beta1/query.pb.gw.go create mode 100644 x/ecocredit/basket/v1beta1/state.pb.go create mode 100644 x/ecocredit/basket/v1beta1/tx.pb.go create mode 100644 x/ecocredit/basket/v1beta1/types.pb.go create mode 100644 x/ecocredit/marketplace/v1beta1/events.pb.go create mode 100644 x/ecocredit/marketplace/v1beta1/query.pb.go create mode 100644 x/ecocredit/marketplace/v1beta1/query.pb.gw.go create mode 100644 x/ecocredit/marketplace/v1beta1/state.pb.go create mode 100644 x/ecocredit/marketplace/v1beta1/tx.pb.go create mode 100644 x/ecocredit/marketplace/v1beta1/types.pb.go create mode 100644 x/ecocredit/server/core/denom.go create mode 100644 x/ecocredit/server/core/genesis.go create mode 100644 x/ecocredit/server/core/invariants.go create mode 100644 x/ecocredit/server/core/invariants_test.go create mode 100644 x/ecocredit/server/core/msg_server.go create mode 100644 x/ecocredit/server/core/operations.go create mode 100644 x/ecocredit/server/core/query_server.go create mode 100644 x/ecocredit/server/core/server.go diff --git a/api/regen/data/v1alpha2/events.pulsar.go b/api/regen/data/v1alpha2/events.pulsar.go index 97ad006f1d..69823a9e27 100644 --- a/api/regen/data/v1alpha2/events.pulsar.go +++ b/api/regen/data/v1alpha2/events.pulsar.go @@ -1399,7 +1399,7 @@ func (x *fastReflection_EventStoreRawData) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/data/v1alpha2/events.proto const ( diff --git a/api/regen/data/v1alpha2/genesis.pulsar.go b/api/regen/data/v1alpha2/genesis.pulsar.go index a9c12afd09..eff418f8f3 100644 --- a/api/regen/data/v1alpha2/genesis.pulsar.go +++ b/api/regen/data/v1alpha2/genesis.pulsar.go @@ -1162,7 +1162,7 @@ func (x *fastReflection_GenesisContentEntry) ProtoMethods() *protoiface.Methods // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/data/v1alpha2/genesis.proto const ( diff --git a/api/regen/data/v1alpha2/query.pulsar.go b/api/regen/data/v1alpha2/query.pulsar.go index 2bb83f73b2..e9314cce76 100644 --- a/api/regen/data/v1alpha2/query.pulsar.go +++ b/api/regen/data/v1alpha2/query.pulsar.go @@ -3581,7 +3581,7 @@ func (x *fastReflection_QuerySignersResponse) ProtoMethods() *protoiface.Methods // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/data/v1alpha2/query.proto const ( diff --git a/api/regen/data/v1alpha2/query_grpc.pb.go b/api/regen/data/v1alpha2/query_grpc.pb.go index 8fe0ad8164..b7c1b83118 100644 --- a/api/regen/data/v1alpha2/query_grpc.pb.go +++ b/api/regen/data/v1alpha2/query_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/data/v1alpha2/query.proto package datav1alpha2 diff --git a/api/regen/data/v1alpha2/tx.pulsar.go b/api/regen/data/v1alpha2/tx.pulsar.go index 826eeeb720..bbb0312b6c 100644 --- a/api/regen/data/v1alpha2/tx.pulsar.go +++ b/api/regen/data/v1alpha2/tx.pulsar.go @@ -1930,7 +1930,7 @@ func (x *fastReflection_MsgSignDataResponse) ProtoMethods() *protoiface.Methods // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/data/v1alpha2/tx.proto const ( diff --git a/api/regen/data/v1alpha2/tx_grpc.pb.go b/api/regen/data/v1alpha2/tx_grpc.pb.go index d289db00fb..c2d0636238 100644 --- a/api/regen/data/v1alpha2/tx_grpc.pb.go +++ b/api/regen/data/v1alpha2/tx_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/data/v1alpha2/tx.proto package datav1alpha2 diff --git a/api/regen/data/v1alpha2/types.pulsar.go b/api/regen/data/v1alpha2/types.pulsar.go index 6f3a106d4d..1ae5e14093 100644 --- a/api/regen/data/v1alpha2/types.pulsar.go +++ b/api/regen/data/v1alpha2/types.pulsar.go @@ -2177,7 +2177,7 @@ func (x *fastReflection_SignerEntry) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/data/v1alpha2/types.proto const ( diff --git a/api/regen/ecocredit/basket/v1beta1/events.pulsar.go b/api/regen/ecocredit/basket/v1beta1/events.pulsar.go index 4d89e0903a..263aacf37d 100644 --- a/api/regen/ecocredit/basket/v1beta1/events.pulsar.go +++ b/api/regen/ecocredit/basket/v1beta1/events.pulsar.go @@ -10,7 +10,7 @@ import ( // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/basket/v1beta1/events.proto const ( diff --git a/api/regen/ecocredit/basket/v1beta1/query.pulsar.go b/api/regen/ecocredit/basket/v1beta1/query.pulsar.go index 4cd2914467..83119060ec 100644 --- a/api/regen/ecocredit/basket/v1beta1/query.pulsar.go +++ b/api/regen/ecocredit/basket/v1beta1/query.pulsar.go @@ -3715,7 +3715,7 @@ func (x *fastReflection_QueryBasketCreditsResponse) ProtoMethods() *protoiface.M // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/basket/v1beta1/query.proto const ( diff --git a/api/regen/ecocredit/basket/v1beta1/query_grpc.pb.go b/api/regen/ecocredit/basket/v1beta1/query_grpc.pb.go index 7be59359ad..60d3f69360 100644 --- a/api/regen/ecocredit/basket/v1beta1/query_grpc.pb.go +++ b/api/regen/ecocredit/basket/v1beta1/query_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/basket/v1beta1/query.proto package basketv1beta1 diff --git a/api/regen/ecocredit/basket/v1beta1/state.pulsar.go b/api/regen/ecocredit/basket/v1beta1/state.pulsar.go index b3d3adccc4..7efee6be8a 100644 --- a/api/regen/ecocredit/basket/v1beta1/state.pulsar.go +++ b/api/regen/ecocredit/basket/v1beta1/state.pulsar.go @@ -548,7 +548,7 @@ func (x *fastReflection_BasketBalance) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/basket/v1beta1/state.proto const ( diff --git a/api/regen/ecocredit/basket/v1beta1/tx.pulsar.go b/api/regen/ecocredit/basket/v1beta1/tx.pulsar.go index f295c6cded..064b2b1ac2 100644 --- a/api/regen/ecocredit/basket/v1beta1/tx.pulsar.go +++ b/api/regen/ecocredit/basket/v1beta1/tx.pulsar.go @@ -4467,7 +4467,7 @@ func (x *fastReflection_MsgPickFromBasketResponse) ProtoMethods() *protoiface.Me // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/basket/v1beta1/tx.proto const ( diff --git a/api/regen/ecocredit/basket/v1beta1/tx_grpc.pb.go b/api/regen/ecocredit/basket/v1beta1/tx_grpc.pb.go index 7449d0eb02..c8ccf8e92b 100644 --- a/api/regen/ecocredit/basket/v1beta1/tx_grpc.pb.go +++ b/api/regen/ecocredit/basket/v1beta1/tx_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/basket/v1beta1/tx.proto package basketv1beta1 diff --git a/api/regen/ecocredit/basket/v1beta1/types.pulsar.go b/api/regen/ecocredit/basket/v1beta1/types.pulsar.go index f68bb0f9b1..d1798bb6f9 100644 --- a/api/regen/ecocredit/basket/v1beta1/types.pulsar.go +++ b/api/regen/ecocredit/basket/v1beta1/types.pulsar.go @@ -3895,7 +3895,7 @@ func (x *fastReflection_Filter_DateRange) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/basket/v1beta1/types.proto const ( diff --git a/api/regen/ecocredit/marketplace/v1beta1/events.pulsar.go b/api/regen/ecocredit/marketplace/v1beta1/events.pulsar.go index ebe152cd53..3e982f4622 100644 --- a/api/regen/ecocredit/marketplace/v1beta1/events.pulsar.go +++ b/api/regen/ecocredit/marketplace/v1beta1/events.pulsar.go @@ -3607,7 +3607,7 @@ func (x *fastReflection_EventAllowAskDenom) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/marketplace/v1beta1/events.proto const ( diff --git a/api/regen/ecocredit/marketplace/v1beta1/query.pulsar.go b/api/regen/ecocredit/marketplace/v1beta1/query.pulsar.go index 08239bbf28..ee60f0b413 100644 --- a/api/regen/ecocredit/marketplace/v1beta1/query.pulsar.go +++ b/api/regen/ecocredit/marketplace/v1beta1/query.pulsar.go @@ -7935,7 +7935,7 @@ func (x *fastReflection_QueryAllowedDenomsResponse) ProtoMethods() *protoiface.M // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/marketplace/v1beta1/query.proto const ( diff --git a/api/regen/ecocredit/marketplace/v1beta1/query_grpc.pb.go b/api/regen/ecocredit/marketplace/v1beta1/query_grpc.pb.go index 5fe4f720ff..87c0e04adc 100644 --- a/api/regen/ecocredit/marketplace/v1beta1/query_grpc.pb.go +++ b/api/regen/ecocredit/marketplace/v1beta1/query_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/marketplace/v1beta1/query.proto package marketplacev1beta1 diff --git a/api/regen/ecocredit/marketplace/v1beta1/state.pulsar.go b/api/regen/ecocredit/marketplace/v1beta1/state.pulsar.go index 35f15ba5fc..4caf68586d 100644 --- a/api/regen/ecocredit/marketplace/v1beta1/state.pulsar.go +++ b/api/regen/ecocredit/marketplace/v1beta1/state.pulsar.go @@ -3514,7 +3514,7 @@ func (x *fastReflection_Market) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/marketplace/v1beta1/state.proto const ( diff --git a/api/regen/ecocredit/marketplace/v1beta1/tx.pulsar.go b/api/regen/ecocredit/marketplace/v1beta1/tx.pulsar.go index ed8b0fec2d..113378d272 100644 --- a/api/regen/ecocredit/marketplace/v1beta1/tx.pulsar.go +++ b/api/regen/ecocredit/marketplace/v1beta1/tx.pulsar.go @@ -6815,7 +6815,7 @@ func (x *fastReflection_MsgAllowAskDenomResponse) ProtoMethods() *protoiface.Met // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/marketplace/v1beta1/tx.proto const ( diff --git a/api/regen/ecocredit/marketplace/v1beta1/tx_grpc.pb.go b/api/regen/ecocredit/marketplace/v1beta1/tx_grpc.pb.go index 36cba096d4..631d4637c7 100644 --- a/api/regen/ecocredit/marketplace/v1beta1/tx_grpc.pb.go +++ b/api/regen/ecocredit/marketplace/v1beta1/tx_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/marketplace/v1beta1/tx.proto package marketplacev1beta1 diff --git a/api/regen/ecocredit/marketplace/v1beta1/types.pulsar.go b/api/regen/ecocredit/marketplace/v1beta1/types.pulsar.go index 91b22313ac..ea7eb4811d 100644 --- a/api/regen/ecocredit/marketplace/v1beta1/types.pulsar.go +++ b/api/regen/ecocredit/marketplace/v1beta1/types.pulsar.go @@ -2784,7 +2784,7 @@ func (x *fastReflection_BatchSelector) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/marketplace/v1beta1/types.proto const ( diff --git a/api/regen/ecocredit/orderbook/v1beta1/memory.pulsar.go b/api/regen/ecocredit/orderbook/v1beta1/memory.pulsar.go index b48adb1c68..c272e4152c 100644 --- a/api/regen/ecocredit/orderbook/v1beta1/memory.pulsar.go +++ b/api/regen/ecocredit/orderbook/v1beta1/memory.pulsar.go @@ -2334,7 +2334,7 @@ func (x *fastReflection_BuyOrderBatchSelector) ProtoMethods() *protoiface.Method // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/orderbook/v1beta1/memory.proto const ( diff --git a/api/regen/ecocredit/v1alpha1/events.pulsar.go b/api/regen/ecocredit/v1alpha1/events.pulsar.go index e15bc3a94c..4635c4438e 100644 --- a/api/regen/ecocredit/v1alpha1/events.pulsar.go +++ b/api/regen/ecocredit/v1alpha1/events.pulsar.go @@ -3139,7 +3139,7 @@ func (x *fastReflection_EventCancel) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha1/events.proto const ( diff --git a/api/regen/ecocredit/v1alpha1/genesis.pulsar.go b/api/regen/ecocredit/v1alpha1/genesis.pulsar.go index 09f1120f46..b64aae54a5 100644 --- a/api/regen/ecocredit/v1alpha1/genesis.pulsar.go +++ b/api/regen/ecocredit/v1alpha1/genesis.pulsar.go @@ -2301,7 +2301,7 @@ func (x *fastReflection_Supply) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha1/genesis.proto const ( diff --git a/api/regen/ecocredit/v1alpha1/query.pulsar.go b/api/regen/ecocredit/v1alpha1/query.pulsar.go index 2ff97794f6..28bc365f31 100644 --- a/api/regen/ecocredit/v1alpha1/query.pulsar.go +++ b/api/regen/ecocredit/v1alpha1/query.pulsar.go @@ -7320,7 +7320,7 @@ func (x *fastReflection_QueryCreditTypesResponse) ProtoMethods() *protoiface.Met // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha1/query.proto const ( diff --git a/api/regen/ecocredit/v1alpha1/query_grpc.pb.go b/api/regen/ecocredit/v1alpha1/query_grpc.pb.go index f450d1b608..fe40ca4762 100644 --- a/api/regen/ecocredit/v1alpha1/query_grpc.pb.go +++ b/api/regen/ecocredit/v1alpha1/query_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/v1alpha1/query.proto package ecocreditv1alpha1 diff --git a/api/regen/ecocredit/v1alpha1/tx.pulsar.go b/api/regen/ecocredit/v1alpha1/tx.pulsar.go index 45340e027d..6b0bee5bc1 100644 --- a/api/regen/ecocredit/v1alpha1/tx.pulsar.go +++ b/api/regen/ecocredit/v1alpha1/tx.pulsar.go @@ -10277,7 +10277,7 @@ func (x *fastReflection_MsgUpdateClassMetadataResponse) ProtoMethods() *protoifa // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha1/tx.proto const ( diff --git a/api/regen/ecocredit/v1alpha1/tx_grpc.pb.go b/api/regen/ecocredit/v1alpha1/tx_grpc.pb.go index 5138b45ff6..f6266ea893 100644 --- a/api/regen/ecocredit/v1alpha1/tx_grpc.pb.go +++ b/api/regen/ecocredit/v1alpha1/tx_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/v1alpha1/tx.proto package ecocreditv1alpha1 diff --git a/api/regen/ecocredit/v1alpha1/types.pulsar.go b/api/regen/ecocredit/v1alpha1/types.pulsar.go index 4a27e40c58..54e0c2fa5c 100644 --- a/api/regen/ecocredit/v1alpha1/types.pulsar.go +++ b/api/regen/ecocredit/v1alpha1/types.pulsar.go @@ -3657,7 +3657,7 @@ func (x *fastReflection_CreditTypeSeq) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha1/types.proto const ( diff --git a/api/regen/ecocredit/v1alpha2/events.pulsar.go b/api/regen/ecocredit/v1alpha2/events.pulsar.go index 013cdfad32..f55040df92 100644 --- a/api/regen/ecocredit/v1alpha2/events.pulsar.go +++ b/api/regen/ecocredit/v1alpha2/events.pulsar.go @@ -7407,7 +7407,7 @@ func (x *fastReflection_EventAllowAskDenom) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha2/events.proto const ( diff --git a/api/regen/ecocredit/v1alpha2/genesis.pulsar.go b/api/regen/ecocredit/v1alpha2/genesis.pulsar.go index 348c3d05c5..9e49f8973a 100644 --- a/api/regen/ecocredit/v1alpha2/genesis.pulsar.go +++ b/api/regen/ecocredit/v1alpha2/genesis.pulsar.go @@ -2487,7 +2487,7 @@ func (x *fastReflection_Supply) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha2/genesis.proto const ( diff --git a/api/regen/ecocredit/v1alpha2/query.pulsar.go b/api/regen/ecocredit/v1alpha2/query.pulsar.go index b939cfbede..a51e7434a8 100644 --- a/api/regen/ecocredit/v1alpha2/query.pulsar.go +++ b/api/regen/ecocredit/v1alpha2/query.pulsar.go @@ -20863,7 +20863,7 @@ func (x *fastReflection_QueryBasketCreditsResponse) ProtoMethods() *protoiface.M // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha2/query.proto const ( diff --git a/api/regen/ecocredit/v1alpha2/query_grpc.pb.go b/api/regen/ecocredit/v1alpha2/query_grpc.pb.go index 3701982d3a..7a7a00a7f3 100644 --- a/api/regen/ecocredit/v1alpha2/query_grpc.pb.go +++ b/api/regen/ecocredit/v1alpha2/query_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/v1alpha2/query.proto package ecocreditv1alpha2 diff --git a/api/regen/ecocredit/v1alpha2/tx.pulsar.go b/api/regen/ecocredit/v1alpha2/tx.pulsar.go index b72f47f304..bcca86290d 100644 --- a/api/regen/ecocredit/v1alpha2/tx.pulsar.go +++ b/api/regen/ecocredit/v1alpha2/tx.pulsar.go @@ -22457,7 +22457,7 @@ func (x *fastReflection_MsgPickFromBasketResponse) ProtoMethods() *protoiface.Me // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha2/tx.proto const ( diff --git a/api/regen/ecocredit/v1alpha2/tx_grpc.pb.go b/api/regen/ecocredit/v1alpha2/tx_grpc.pb.go index a6e468b977..acd3faede7 100644 --- a/api/regen/ecocredit/v1alpha2/tx_grpc.pb.go +++ b/api/regen/ecocredit/v1alpha2/tx_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/v1alpha2/tx.proto package ecocreditv1alpha2 diff --git a/api/regen/ecocredit/v1alpha2/types.pulsar.go b/api/regen/ecocredit/v1alpha2/types.pulsar.go index a3a12443ef..28082001fe 100644 --- a/api/regen/ecocredit/v1alpha2/types.pulsar.go +++ b/api/regen/ecocredit/v1alpha2/types.pulsar.go @@ -10736,7 +10736,7 @@ func (x *fastReflection_Filter_DateRange) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1alpha2/types.proto const ( diff --git a/api/regen/ecocredit/v1beta1/events.pulsar.go b/api/regen/ecocredit/v1beta1/events.pulsar.go index cb5b86c726..309f62eef2 100644 --- a/api/regen/ecocredit/v1beta1/events.pulsar.go +++ b/api/regen/ecocredit/v1beta1/events.pulsar.go @@ -3815,7 +3815,7 @@ func (x *fastReflection_EventCancel) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1beta1/events.proto const ( diff --git a/api/regen/ecocredit/v1beta1/query.pulsar.go b/api/regen/ecocredit/v1beta1/query.pulsar.go index 9e7efd2487..ea363a6727 100644 --- a/api/regen/ecocredit/v1beta1/query.pulsar.go +++ b/api/regen/ecocredit/v1beta1/query.pulsar.go @@ -2668,6 +2668,1064 @@ func (x *fastReflection_QueryClassInfoResponse) ProtoMethods() *protoiface.Metho } } +var ( + md_QueryClassIssuersRequest protoreflect.MessageDescriptor + fd_QueryClassIssuersRequest_class_id protoreflect.FieldDescriptor + fd_QueryClassIssuersRequest_pagination protoreflect.FieldDescriptor +) + +func init() { + file_regen_ecocredit_v1beta1_query_proto_init() + md_QueryClassIssuersRequest = File_regen_ecocredit_v1beta1_query_proto.Messages().ByName("QueryClassIssuersRequest") + fd_QueryClassIssuersRequest_class_id = md_QueryClassIssuersRequest.Fields().ByName("class_id") + fd_QueryClassIssuersRequest_pagination = md_QueryClassIssuersRequest.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryClassIssuersRequest)(nil) + +type fastReflection_QueryClassIssuersRequest QueryClassIssuersRequest + +func (x *QueryClassIssuersRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryClassIssuersRequest)(x) +} + +func (x *QueryClassIssuersRequest) slowProtoReflect() protoreflect.Message { + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[6] + 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_QueryClassIssuersRequest_messageType fastReflection_QueryClassIssuersRequest_messageType +var _ protoreflect.MessageType = fastReflection_QueryClassIssuersRequest_messageType{} + +type fastReflection_QueryClassIssuersRequest_messageType struct{} + +func (x fastReflection_QueryClassIssuersRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryClassIssuersRequest)(nil) +} +func (x fastReflection_QueryClassIssuersRequest_messageType) New() protoreflect.Message { + return new(fastReflection_QueryClassIssuersRequest) +} +func (x fastReflection_QueryClassIssuersRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryClassIssuersRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryClassIssuersRequest) Descriptor() protoreflect.MessageDescriptor { + return md_QueryClassIssuersRequest +} + +// 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_QueryClassIssuersRequest) Type() protoreflect.MessageType { + return _fastReflection_QueryClassIssuersRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryClassIssuersRequest) New() protoreflect.Message { + return new(fastReflection_QueryClassIssuersRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryClassIssuersRequest) Interface() protoreflect.ProtoMessage { + return (*QueryClassIssuersRequest)(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_QueryClassIssuersRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.ClassId != "" { + value := protoreflect.ValueOfString(x.ClassId) + if !f(fd_QueryClassIssuersRequest_class_id, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryClassIssuersRequest_pagination, 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_QueryClassIssuersRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.class_id": + return x.ClassId != "" + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersRequest")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersRequest 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_QueryClassIssuersRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.class_id": + x.ClassId = "" + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersRequest")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersRequest 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_QueryClassIssuersRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.class_id": + value := x.ClassId + return protoreflect.ValueOfString(value) + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersRequest")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersRequest 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_QueryClassIssuersRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.class_id": + x.ClassId = value.Interface().(string) + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageRequest) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersRequest")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersRequest 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_QueryClassIssuersRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageRequest) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.class_id": + panic(fmt.Errorf("field class_id of message regen.ecocredit.v1beta1.QueryClassIssuersRequest is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersRequest")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersRequest 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_QueryClassIssuersRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.class_id": + return protoreflect.ValueOfString("") + case "regen.ecocredit.v1beta1.QueryClassIssuersRequest.pagination": + m := new(v1beta1.PageRequest) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersRequest")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersRequest 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_QueryClassIssuersRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.v1beta1.QueryClassIssuersRequest", 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_QueryClassIssuersRequest) 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_QueryClassIssuersRequest) 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_QueryClassIssuersRequest) 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_QueryClassIssuersRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryClassIssuersRequest) + 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.ClassId) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + 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().(*QueryClassIssuersRequest) + 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.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + 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.ClassId) > 0 { + i -= len(x.ClassId) + copy(dAtA[i:], x.ClassId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) + 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().(*QueryClassIssuersRequest) + 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: QueryClassIssuersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryClassIssuersRequest: 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 ClassId", 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.ClassId = 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 Pagination", 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.Pagination == nil { + x.Pagination = &v1beta1.PageRequest{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); 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 _ protoreflect.List = (*_QueryClassIssuersResponse_1_list)(nil) + +type _QueryClassIssuersResponse_1_list struct { + list *[]string +} + +func (x *_QueryClassIssuersResponse_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_QueryClassIssuersResponse_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_QueryClassIssuersResponse_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_QueryClassIssuersResponse_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_QueryClassIssuersResponse_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message QueryClassIssuersResponse at list field Issuers as it is not of Message kind")) +} + +func (x *_QueryClassIssuersResponse_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_QueryClassIssuersResponse_1_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_QueryClassIssuersResponse_1_list) IsValid() bool { + return x.list != nil +} + +var ( + md_QueryClassIssuersResponse protoreflect.MessageDescriptor + fd_QueryClassIssuersResponse_issuers protoreflect.FieldDescriptor + fd_QueryClassIssuersResponse_pagination protoreflect.FieldDescriptor +) + +func init() { + file_regen_ecocredit_v1beta1_query_proto_init() + md_QueryClassIssuersResponse = File_regen_ecocredit_v1beta1_query_proto.Messages().ByName("QueryClassIssuersResponse") + fd_QueryClassIssuersResponse_issuers = md_QueryClassIssuersResponse.Fields().ByName("issuers") + fd_QueryClassIssuersResponse_pagination = md_QueryClassIssuersResponse.Fields().ByName("pagination") +} + +var _ protoreflect.Message = (*fastReflection_QueryClassIssuersResponse)(nil) + +type fastReflection_QueryClassIssuersResponse QueryClassIssuersResponse + +func (x *QueryClassIssuersResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_QueryClassIssuersResponse)(x) +} + +func (x *QueryClassIssuersResponse) slowProtoReflect() protoreflect.Message { + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[7] + 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_QueryClassIssuersResponse_messageType fastReflection_QueryClassIssuersResponse_messageType +var _ protoreflect.MessageType = fastReflection_QueryClassIssuersResponse_messageType{} + +type fastReflection_QueryClassIssuersResponse_messageType struct{} + +func (x fastReflection_QueryClassIssuersResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_QueryClassIssuersResponse)(nil) +} +func (x fastReflection_QueryClassIssuersResponse_messageType) New() protoreflect.Message { + return new(fastReflection_QueryClassIssuersResponse) +} +func (x fastReflection_QueryClassIssuersResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_QueryClassIssuersResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_QueryClassIssuersResponse) Descriptor() protoreflect.MessageDescriptor { + return md_QueryClassIssuersResponse +} + +// 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_QueryClassIssuersResponse) Type() protoreflect.MessageType { + return _fastReflection_QueryClassIssuersResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_QueryClassIssuersResponse) New() protoreflect.Message { + return new(fastReflection_QueryClassIssuersResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_QueryClassIssuersResponse) Interface() protoreflect.ProtoMessage { + return (*QueryClassIssuersResponse)(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_QueryClassIssuersResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Issuers) != 0 { + value := protoreflect.ValueOfList(&_QueryClassIssuersResponse_1_list{list: &x.Issuers}) + if !f(fd_QueryClassIssuersResponse_issuers, value) { + return + } + } + if x.Pagination != nil { + value := protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + if !f(fd_QueryClassIssuersResponse_pagination, 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_QueryClassIssuersResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.issuers": + return len(x.Issuers) != 0 + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.pagination": + return x.Pagination != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersResponse 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_QueryClassIssuersResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.issuers": + x.Issuers = nil + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.pagination": + x.Pagination = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersResponse 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_QueryClassIssuersResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.issuers": + if len(x.Issuers) == 0 { + return protoreflect.ValueOfList(&_QueryClassIssuersResponse_1_list{}) + } + listValue := &_QueryClassIssuersResponse_1_list{list: &x.Issuers} + return protoreflect.ValueOfList(listValue) + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.pagination": + value := x.Pagination + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersResponse 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_QueryClassIssuersResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.issuers": + lv := value.List() + clv := lv.(*_QueryClassIssuersResponse_1_list) + x.Issuers = *clv.list + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.pagination": + x.Pagination = value.Message().Interface().(*v1beta1.PageResponse) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersResponse 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_QueryClassIssuersResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.issuers": + if x.Issuers == nil { + x.Issuers = []string{} + } + value := &_QueryClassIssuersResponse_1_list{list: &x.Issuers} + return protoreflect.ValueOfList(value) + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.pagination": + if x.Pagination == nil { + x.Pagination = new(v1beta1.PageResponse) + } + return protoreflect.ValueOfMessage(x.Pagination.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersResponse 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_QueryClassIssuersResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.issuers": + list := []string{} + return protoreflect.ValueOfList(&_QueryClassIssuersResponse_1_list{list: &list}) + case "regen.ecocredit.v1beta1.QueryClassIssuersResponse.pagination": + m := new(v1beta1.PageResponse) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QueryClassIssuersResponse")) + } + panic(fmt.Errorf("message regen.ecocredit.v1beta1.QueryClassIssuersResponse 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_QueryClassIssuersResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in regen.ecocredit.v1beta1.QueryClassIssuersResponse", 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_QueryClassIssuersResponse) 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_QueryClassIssuersResponse) 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_QueryClassIssuersResponse) 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_QueryClassIssuersResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*QueryClassIssuersResponse) + 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.Issuers) > 0 { + for _, s := range x.Issuers { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.Pagination != nil { + l = options.Size(x.Pagination) + 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().(*QueryClassIssuersResponse) + 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.Pagination != nil { + encoded, err := options.Marshal(x.Pagination) + 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.Issuers) > 0 { + for iNdEx := len(x.Issuers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.Issuers[iNdEx]) + copy(dAtA[i:], x.Issuers[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Issuers[iNdEx]))) + 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().(*QueryClassIssuersResponse) + 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: QueryClassIssuersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: QueryClassIssuersResponse: 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 Issuers", 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.Issuers = append(x.Issuers, 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 Pagination", 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.Pagination == nil { + x.Pagination = &v1beta1.PageResponse{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Pagination); 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_QueryProjectsRequest protoreflect.MessageDescriptor fd_QueryProjectsRequest_class_id protoreflect.FieldDescriptor @@ -2690,7 +3748,7 @@ func (x *QueryProjectsRequest) ProtoReflect() protoreflect.Message { } func (x *QueryProjectsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[6] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3240,7 +4298,7 @@ func (x *QueryProjectsResponse) ProtoReflect() protoreflect.Message { } func (x *QueryProjectsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[7] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -3760,7 +4818,7 @@ func (x *QueryProjectInfoRequest) ProtoReflect() protoreflect.Message { } func (x *QueryProjectInfoRequest) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[8] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4180,7 +5238,7 @@ func (x *QueryProjectInfoResponse) ProtoReflect() protoreflect.Message { } func (x *QueryProjectInfoResponse) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[9] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -4617,7 +5675,7 @@ func (x *QueryBatchesRequest) ProtoReflect() protoreflect.Message { } func (x *QueryBatchesRequest) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[10] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5167,7 +6225,7 @@ func (x *QueryBatchesResponse) ProtoReflect() protoreflect.Message { } func (x *QueryBatchesResponse) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[11] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -5687,7 +6745,7 @@ func (x *QueryBatchInfoRequest) ProtoReflect() protoreflect.Message { } func (x *QueryBatchInfoRequest) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[12] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6107,7 +7165,7 @@ func (x *QueryBatchInfoResponse) ProtoReflect() protoreflect.Message { } func (x *QueryBatchInfoResponse) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[13] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -6544,7 +7602,7 @@ func (x *QueryBalanceRequest) ProtoReflect() protoreflect.Message { } func (x *QueryBalanceRequest) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[14] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7028,7 +8086,7 @@ func (x *QueryBalanceResponse) ProtoReflect() protoreflect.Message { } func (x *QueryBalanceResponse) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[15] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7510,7 +8568,7 @@ func (x *QuerySupplyRequest) ProtoReflect() protoreflect.Message { } func (x *QuerySupplyRequest) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[16] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[18] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -7911,9 +8969,10 @@ func (x *fastReflection_QuerySupplyRequest) ProtoMethods() *protoiface.Methods { } var ( - md_QuerySupplyResponse protoreflect.MessageDescriptor - fd_QuerySupplyResponse_tradable_supply protoreflect.FieldDescriptor - fd_QuerySupplyResponse_retired_supply protoreflect.FieldDescriptor + md_QuerySupplyResponse protoreflect.MessageDescriptor + fd_QuerySupplyResponse_tradable_supply protoreflect.FieldDescriptor + fd_QuerySupplyResponse_retired_supply protoreflect.FieldDescriptor + fd_QuerySupplyResponse_cancelled_amount protoreflect.FieldDescriptor ) func init() { @@ -7921,6 +8980,7 @@ func init() { md_QuerySupplyResponse = File_regen_ecocredit_v1beta1_query_proto.Messages().ByName("QuerySupplyResponse") fd_QuerySupplyResponse_tradable_supply = md_QuerySupplyResponse.Fields().ByName("tradable_supply") fd_QuerySupplyResponse_retired_supply = md_QuerySupplyResponse.Fields().ByName("retired_supply") + fd_QuerySupplyResponse_cancelled_amount = md_QuerySupplyResponse.Fields().ByName("cancelled_amount") } var _ protoreflect.Message = (*fastReflection_QuerySupplyResponse)(nil) @@ -7932,7 +8992,7 @@ func (x *QuerySupplyResponse) ProtoReflect() protoreflect.Message { } func (x *QuerySupplyResponse) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[17] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8000,6 +9060,12 @@ func (x *fastReflection_QuerySupplyResponse) Range(f func(protoreflect.FieldDesc return } } + if x.CancelledAmount != "" { + value := protoreflect.ValueOfString(x.CancelledAmount) + if !f(fd_QuerySupplyResponse_cancelled_amount, value) { + return + } + } } // Has reports whether a field is populated. @@ -8019,6 +9085,8 @@ func (x *fastReflection_QuerySupplyResponse) Has(fd protoreflect.FieldDescriptor return x.TradableSupply != "" case "regen.ecocredit.v1beta1.QuerySupplyResponse.retired_supply": return x.RetiredSupply != "" + case "regen.ecocredit.v1beta1.QuerySupplyResponse.cancelled_amount": + return x.CancelledAmount != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QuerySupplyResponse")) @@ -8039,6 +9107,8 @@ func (x *fastReflection_QuerySupplyResponse) Clear(fd protoreflect.FieldDescript x.TradableSupply = "" case "regen.ecocredit.v1beta1.QuerySupplyResponse.retired_supply": x.RetiredSupply = "" + case "regen.ecocredit.v1beta1.QuerySupplyResponse.cancelled_amount": + x.CancelledAmount = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QuerySupplyResponse")) @@ -8061,6 +9131,9 @@ func (x *fastReflection_QuerySupplyResponse) Get(descriptor protoreflect.FieldDe case "regen.ecocredit.v1beta1.QuerySupplyResponse.retired_supply": value := x.RetiredSupply return protoreflect.ValueOfString(value) + case "regen.ecocredit.v1beta1.QuerySupplyResponse.cancelled_amount": + value := x.CancelledAmount + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QuerySupplyResponse")) @@ -8085,6 +9158,8 @@ func (x *fastReflection_QuerySupplyResponse) Set(fd protoreflect.FieldDescriptor x.TradableSupply = value.Interface().(string) case "regen.ecocredit.v1beta1.QuerySupplyResponse.retired_supply": x.RetiredSupply = value.Interface().(string) + case "regen.ecocredit.v1beta1.QuerySupplyResponse.cancelled_amount": + x.CancelledAmount = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QuerySupplyResponse")) @@ -8109,6 +9184,8 @@ func (x *fastReflection_QuerySupplyResponse) Mutable(fd protoreflect.FieldDescri panic(fmt.Errorf("field tradable_supply of message regen.ecocredit.v1beta1.QuerySupplyResponse is not mutable")) case "regen.ecocredit.v1beta1.QuerySupplyResponse.retired_supply": panic(fmt.Errorf("field retired_supply of message regen.ecocredit.v1beta1.QuerySupplyResponse is not mutable")) + case "regen.ecocredit.v1beta1.QuerySupplyResponse.cancelled_amount": + panic(fmt.Errorf("field cancelled_amount of message regen.ecocredit.v1beta1.QuerySupplyResponse is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QuerySupplyResponse")) @@ -8126,6 +9203,8 @@ func (x *fastReflection_QuerySupplyResponse) NewField(fd protoreflect.FieldDescr return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.QuerySupplyResponse.retired_supply": return protoreflect.ValueOfString("") + case "regen.ecocredit.v1beta1.QuerySupplyResponse.cancelled_amount": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.QuerySupplyResponse")) @@ -8203,6 +9282,10 @@ func (x *fastReflection_QuerySupplyResponse) ProtoMethods() *protoiface.Methods if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.CancelledAmount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -8232,6 +9315,13 @@ func (x *fastReflection_QuerySupplyResponse) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.CancelledAmount) > 0 { + i -= len(x.CancelledAmount) + copy(dAtA[i:], x.CancelledAmount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.CancelledAmount))) + i-- + dAtA[i] = 0x1a + } if len(x.RetiredSupply) > 0 { i -= len(x.RetiredSupply) copy(dAtA[i:], x.RetiredSupply) @@ -8359,6 +9449,38 @@ func (x *fastReflection_QuerySupplyResponse) ProtoMethods() *protoiface.Methods } x.RetiredSupply = 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 CancelledAmount", 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.CancelledAmount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -8412,7 +9534,7 @@ func (x *QueryCreditTypesRequest) ProtoReflect() protoreflect.Message { } func (x *QueryCreditTypesRequest) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[18] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -8821,7 +9943,7 @@ func (x *QueryCreditTypesResponse) ProtoReflect() protoreflect.Message { } func (x *QueryCreditTypesResponse) slowProtoReflect() protoreflect.Message { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[19] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -9247,7 +10369,7 @@ func (x *fastReflection_QueryCreditTypesResponse) ProtoMethods() *protoiface.Met // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1beta1/query.proto const ( @@ -9478,6 +10600,98 @@ func (x *QueryClassInfoResponse) GetInfo() *ClassInfo { return nil } +// QueryClassIssuersRequest is the Query/ClassIssuers request type. +type QueryClassIssuersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // class_id is the unique ID of credit class to query. + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *v1beta1.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryClassIssuersRequest) Reset() { + *x = QueryClassIssuersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryClassIssuersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryClassIssuersRequest) ProtoMessage() {} + +// Deprecated: Use QueryClassIssuersRequest.ProtoReflect.Descriptor instead. +func (*QueryClassIssuersRequest) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{6} +} + +func (x *QueryClassIssuersRequest) GetClassId() string { + if x != nil { + return x.ClassId + } + return "" +} + +func (x *QueryClassIssuersRequest) GetPagination() *v1beta1.PageRequest { + if x != nil { + return x.Pagination + } + return nil +} + +// QueryClassIssuersRequest is the Query/ClassIssuers response type. +type QueryClassIssuersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // issuers is a list of issuers for the credit class + Issuers []string `protobuf:"bytes,1,rep,name=issuers,proto3" json:"issuers,omitempty"` + // pagination defines the pagination in the response. + Pagination *v1beta1.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (x *QueryClassIssuersResponse) Reset() { + *x = QueryClassIssuersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryClassIssuersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryClassIssuersResponse) ProtoMessage() {} + +// Deprecated: Use QueryClassIssuersResponse.ProtoReflect.Descriptor instead. +func (*QueryClassIssuersResponse) Descriptor() ([]byte, []int) { + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{7} +} + +func (x *QueryClassIssuersResponse) GetIssuers() []string { + if x != nil { + return x.Issuers + } + return nil +} + +func (x *QueryClassIssuersResponse) GetPagination() *v1beta1.PageResponse { + if x != nil { + return x.Pagination + } + return nil +} + // QueryProjectsRequest is the Query/Projects request type. type QueryProjectsRequest struct { state protoimpl.MessageState @@ -9493,7 +10707,7 @@ type QueryProjectsRequest struct { func (x *QueryProjectsRequest) Reset() { *x = QueryProjectsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[6] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9507,7 +10721,7 @@ func (*QueryProjectsRequest) ProtoMessage() {} // Deprecated: Use QueryProjectsRequest.ProtoReflect.Descriptor instead. func (*QueryProjectsRequest) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{6} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{8} } func (x *QueryProjectsRequest) GetClassId() string { @@ -9539,7 +10753,7 @@ type QueryProjectsResponse struct { func (x *QueryProjectsResponse) Reset() { *x = QueryProjectsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[7] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9553,7 +10767,7 @@ func (*QueryProjectsResponse) ProtoMessage() {} // Deprecated: Use QueryProjectsResponse.ProtoReflect.Descriptor instead. func (*QueryProjectsResponse) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{7} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{9} } func (x *QueryProjectsResponse) GetProjects() []*ProjectInfo { @@ -9583,7 +10797,7 @@ type QueryProjectInfoRequest struct { func (x *QueryProjectInfoRequest) Reset() { *x = QueryProjectInfoRequest{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[8] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9597,7 +10811,7 @@ func (*QueryProjectInfoRequest) ProtoMessage() {} // Deprecated: Use QueryProjectInfoRequest.ProtoReflect.Descriptor instead. func (*QueryProjectInfoRequest) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{8} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{10} } func (x *QueryProjectInfoRequest) GetProjectId() string { @@ -9620,7 +10834,7 @@ type QueryProjectInfoResponse struct { func (x *QueryProjectInfoResponse) Reset() { *x = QueryProjectInfoResponse{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[9] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9634,7 +10848,7 @@ func (*QueryProjectInfoResponse) ProtoMessage() {} // Deprecated: Use QueryProjectInfoResponse.ProtoReflect.Descriptor instead. func (*QueryProjectInfoResponse) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{9} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{11} } func (x *QueryProjectInfoResponse) GetInfo() *ProjectInfo { @@ -9659,7 +10873,7 @@ type QueryBatchesRequest struct { func (x *QueryBatchesRequest) Reset() { *x = QueryBatchesRequest{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[10] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9673,7 +10887,7 @@ func (*QueryBatchesRequest) ProtoMessage() {} // Deprecated: Use QueryBatchesRequest.ProtoReflect.Descriptor instead. func (*QueryBatchesRequest) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{10} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{12} } func (x *QueryBatchesRequest) GetProjectId() string { @@ -9705,7 +10919,7 @@ type QueryBatchesResponse struct { func (x *QueryBatchesResponse) Reset() { *x = QueryBatchesResponse{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[11] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9719,7 +10933,7 @@ func (*QueryBatchesResponse) ProtoMessage() {} // Deprecated: Use QueryBatchesResponse.ProtoReflect.Descriptor instead. func (*QueryBatchesResponse) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{11} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{13} } func (x *QueryBatchesResponse) GetBatches() []*BatchInfo { @@ -9749,7 +10963,7 @@ type QueryBatchInfoRequest struct { func (x *QueryBatchInfoRequest) Reset() { *x = QueryBatchInfoRequest{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[12] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9763,7 +10977,7 @@ func (*QueryBatchInfoRequest) ProtoMessage() {} // Deprecated: Use QueryBatchInfoRequest.ProtoReflect.Descriptor instead. func (*QueryBatchInfoRequest) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{12} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{14} } func (x *QueryBatchInfoRequest) GetBatchDenom() string { @@ -9786,7 +11000,7 @@ type QueryBatchInfoResponse struct { func (x *QueryBatchInfoResponse) Reset() { *x = QueryBatchInfoResponse{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[13] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9800,7 +11014,7 @@ func (*QueryBatchInfoResponse) ProtoMessage() {} // Deprecated: Use QueryBatchInfoResponse.ProtoReflect.Descriptor instead. func (*QueryBatchInfoResponse) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{13} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{15} } func (x *QueryBatchInfoResponse) GetInfo() *BatchInfo { @@ -9825,7 +11039,7 @@ type QueryBalanceRequest struct { func (x *QueryBalanceRequest) Reset() { *x = QueryBalanceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[14] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9839,7 +11053,7 @@ func (*QueryBalanceRequest) ProtoMessage() {} // Deprecated: Use QueryBalanceRequest.ProtoReflect.Descriptor instead. func (*QueryBalanceRequest) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{14} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{16} } func (x *QueryBalanceRequest) GetAccount() string { @@ -9871,7 +11085,7 @@ type QueryBalanceResponse struct { func (x *QueryBalanceResponse) Reset() { *x = QueryBalanceResponse{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[15] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9885,7 +11099,7 @@ func (*QueryBalanceResponse) ProtoMessage() {} // Deprecated: Use QueryBalanceResponse.ProtoReflect.Descriptor instead. func (*QueryBalanceResponse) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{15} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{17} } func (x *QueryBalanceResponse) GetTradableAmount() string { @@ -9915,7 +11129,7 @@ type QuerySupplyRequest struct { func (x *QuerySupplyRequest) Reset() { *x = QuerySupplyRequest{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[16] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9929,7 +11143,7 @@ func (*QuerySupplyRequest) ProtoMessage() {} // Deprecated: Use QuerySupplyRequest.ProtoReflect.Descriptor instead. func (*QuerySupplyRequest) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{16} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{18} } func (x *QuerySupplyRequest) GetBatchDenom() string { @@ -9951,12 +11165,15 @@ type QuerySupplyResponse struct { // retired_supply is the decimal number of retired credits in the batch // supply. RetiredSupply string `protobuf:"bytes,2,opt,name=retired_supply,json=retiredSupply,proto3" json:"retired_supply,omitempty"` + // cancelled_amount is the decimal number of cancelled credits in the batch + // supply. + CancelledAmount string `protobuf:"bytes,3,opt,name=cancelled_amount,json=cancelledAmount,proto3" json:"cancelled_amount,omitempty"` } func (x *QuerySupplyResponse) Reset() { *x = QuerySupplyResponse{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[17] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -9970,7 +11187,7 @@ func (*QuerySupplyResponse) ProtoMessage() {} // Deprecated: Use QuerySupplyResponse.ProtoReflect.Descriptor instead. func (*QuerySupplyResponse) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{17} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{19} } func (x *QuerySupplyResponse) GetTradableSupply() string { @@ -9987,6 +11204,13 @@ func (x *QuerySupplyResponse) GetRetiredSupply() string { return "" } +func (x *QuerySupplyResponse) GetCancelledAmount() string { + if x != nil { + return x.CancelledAmount + } + return "" +} + // QueryCreditTypesRequest is the Query/Credit_Types request type type QueryCreditTypesRequest struct { state protoimpl.MessageState @@ -9997,7 +11221,7 @@ type QueryCreditTypesRequest struct { func (x *QueryCreditTypesRequest) Reset() { *x = QueryCreditTypesRequest{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[18] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10011,7 +11235,7 @@ func (*QueryCreditTypesRequest) ProtoMessage() {} // Deprecated: Use QueryCreditTypesRequest.ProtoReflect.Descriptor instead. func (*QueryCreditTypesRequest) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{18} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{20} } // QueryCreditTypesRequest is the Query/Credit_Types response type @@ -10027,7 +11251,7 @@ type QueryCreditTypesResponse struct { func (x *QueryCreditTypesResponse) Reset() { *x = QueryCreditTypesResponse{} if protoimpl.UnsafeEnabled { - mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[19] + mi := &file_regen_ecocredit_v1beta1_query_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -10041,7 +11265,7 @@ func (*QueryCreditTypesResponse) ProtoMessage() {} // Deprecated: Use QueryCreditTypesResponse.ProtoReflect.Descriptor instead. func (*QueryCreditTypesResponse) Descriptor() ([]byte, []int) { - return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{19} + return file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP(), []int{21} } func (x *QueryCreditTypesResponse) GetCreditTypes() []*CreditType { @@ -10097,210 +11321,240 @@ var file_regen_ecocredit_v1beta1_query_proto_rawDesc = []byte{ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x79, 0x0a, - 0x14, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, - 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, - 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, - 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa2, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, - 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x7d, 0x0a, + 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, + 0x73, 0x73, 0x49, 0x64, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, - 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x54, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x7c, 0x0a, - 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x49, 0x64, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x7e, 0x0a, 0x19, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x73, + 0x75, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69, 0x73, 0x73, 0x75, + 0x65, 0x72, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, - 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x14, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, - 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x79, 0x0a, 0x14, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, + 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa2, 0x01, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x40, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, 0x17, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x54, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x7c, 0x0a, 0x13, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x49, 0x64, 0x12, 0x46, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, - 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, 0x15, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 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, 0x22, 0x50, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, - 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x36, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, - 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x50, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, - 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, - 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x66, 0x0a, 0x14, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, - 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, - 0x74, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x35, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x22, 0x65, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, + 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x9d, 0x01, 0x0a, 0x14, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, + 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, + 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, + 0x73, 0x12, 0x47, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0a, + 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x38, 0x0a, 0x15, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 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, 0x22, 0x50, 0x0a, 0x16, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, + 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, + 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x72, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x50, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, + 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, + 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, + 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x66, 0x0a, 0x14, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, + 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, + 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x35, 0x0a, 0x12, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 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, 0x22, 0x90, 0x01, 0x0a, 0x13, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x22, - 0x19, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x62, 0x0a, 0x18, 0x51, 0x75, + 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x12, + 0x29, 0x0a, 0x10, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x6c, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x19, 0x0a, 0x17, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x72, - 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, - 0x65, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x32, 0xf0, - 0x0c, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x90, 0x01, 0x0a, 0x07, 0x43, 0x6c, 0x61, - 0x73, 0x73, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x62, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x46, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0b, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x32, 0xa6, 0x0e, 0x0a, 0x05, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x90, 0x01, 0x0a, 0x07, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, + 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, + 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, + 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, 0xa1, 0x01, 0x0a, 0x09, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x12, 0x20, 0x2f, 0x72, 0x65, 0x67, 0x65, - 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, 0xa1, 0x01, 0x0a, 0x09, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, 0x72, 0x65, 0x67, 0x65, - 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, - 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6c, 0x61, - 0x73, 0x73, 0x65, 0x73, 0x2f, 0x7b, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x7d, 0x12, - 0xa7, 0x01, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x2d, 0x2e, 0x72, + 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, + 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x2f, + 0x7b, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0xb3, 0x01, 0x0a, 0x0c, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x31, 0x2e, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, + 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x3c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x36, 0x12, 0x34, 0x2f, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x61, + 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x2f, 0x7b, 0x63, + 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, + 0x12, 0xa7, 0x01, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0x2d, 0x2e, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x72, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x36, 0x12, 0x34, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x65, 0x73, 0x2f, 0x7b, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x7d, - 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0xaa, 0x01, 0x0a, 0x0b, 0x50, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, - 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, - 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x70, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0xa6, 0x01, 0x0a, 0x07, 0x42, 0x61, 0x74, 0x63, 0x68, - 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x3e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x12, 0x36, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, + 0x65, 0x63, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x36, 0x12, 0x34, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, + 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, + 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x2f, 0x7b, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, + 0x7d, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x12, 0xaa, 0x01, 0x0a, 0x0b, 0x50, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x30, 0x2e, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x72, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x12, - 0xa4, 0x01, 0x0a, 0x09, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, 0x2e, - 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, - 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, - 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x7b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, - 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x12, 0xb0, 0x01, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, 0x6e, - 0x63, 0x65, 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x48, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x42, 0x12, 0x40, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, - 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x7b, 0x62, 0x61, 0x74, 0x63, 0x68, - 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x2f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x2f, - 0x7b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x7d, 0x12, 0xa2, 0x01, 0x0a, 0x06, 0x53, 0x75, - 0x70, 0x70, 0x6c, 0x79, 0x12, 0x2b, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, - 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x12, 0xa6, 0x01, 0x0a, 0x07, 0x42, 0x61, 0x74, 0x63, + 0x68, 0x65, 0x73, 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x12, 0x35, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, + 0x79, 0x42, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x3e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x12, 0x36, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, + 0x12, 0xa4, 0x01, 0x0a, 0x09, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2e, + 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, + 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x7b, 0x62, 0x61, 0x74, 0x63, 0x68, - 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x12, 0xa1, - 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, 0x30, - 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x72, 0x65, - 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2d, 0x74, 0x79, 0x70, - 0x65, 0x73, 0x12, 0x8c, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b, 0x2e, - 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x21, - 0x12, 0x1f, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x42, 0xfb, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x52, 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, + 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x12, 0xb0, 0x01, 0x0a, 0x07, 0x42, 0x61, 0x6c, 0x61, + 0x6e, 0x63, 0x65, 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x48, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x42, 0x12, 0x40, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x7b, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x2f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x2f, 0x7b, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x7d, 0x12, 0xa2, 0x01, 0x0a, 0x06, 0x53, + 0x75, 0x70, 0x70, 0x6c, 0x79, 0x12, 0x2b, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, + 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x3d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x37, 0x12, 0x35, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, - 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, - 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, - 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x31, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x73, 0x2f, 0x7b, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x2f, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x79, 0x12, + 0xa1, 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x12, + 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x72, + 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2d, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x12, 0x8c, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2b, + 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x27, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x21, 0x12, 0x1f, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x42, 0xfb, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x52, 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, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x52, 0x65, 0x67, + 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, + 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, + 0x23, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, + 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -10315,76 +11569,82 @@ func file_regen_ecocredit_v1beta1_query_proto_rawDescGZIP() []byte { return file_regen_ecocredit_v1beta1_query_proto_rawDescData } -var file_regen_ecocredit_v1beta1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_regen_ecocredit_v1beta1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 22) var file_regen_ecocredit_v1beta1_query_proto_goTypes = []interface{}{ - (*QueryParamsRequest)(nil), // 0: regen.ecocredit.v1beta1.QueryParamsRequest - (*QueryParamsResponse)(nil), // 1: regen.ecocredit.v1beta1.QueryParamsResponse - (*QueryClassesRequest)(nil), // 2: regen.ecocredit.v1beta1.QueryClassesRequest - (*QueryClassesResponse)(nil), // 3: regen.ecocredit.v1beta1.QueryClassesResponse - (*QueryClassInfoRequest)(nil), // 4: regen.ecocredit.v1beta1.QueryClassInfoRequest - (*QueryClassInfoResponse)(nil), // 5: regen.ecocredit.v1beta1.QueryClassInfoResponse - (*QueryProjectsRequest)(nil), // 6: regen.ecocredit.v1beta1.QueryProjectsRequest - (*QueryProjectsResponse)(nil), // 7: regen.ecocredit.v1beta1.QueryProjectsResponse - (*QueryProjectInfoRequest)(nil), // 8: regen.ecocredit.v1beta1.QueryProjectInfoRequest - (*QueryProjectInfoResponse)(nil), // 9: regen.ecocredit.v1beta1.QueryProjectInfoResponse - (*QueryBatchesRequest)(nil), // 10: regen.ecocredit.v1beta1.QueryBatchesRequest - (*QueryBatchesResponse)(nil), // 11: regen.ecocredit.v1beta1.QueryBatchesResponse - (*QueryBatchInfoRequest)(nil), // 12: regen.ecocredit.v1beta1.QueryBatchInfoRequest - (*QueryBatchInfoResponse)(nil), // 13: regen.ecocredit.v1beta1.QueryBatchInfoResponse - (*QueryBalanceRequest)(nil), // 14: regen.ecocredit.v1beta1.QueryBalanceRequest - (*QueryBalanceResponse)(nil), // 15: regen.ecocredit.v1beta1.QueryBalanceResponse - (*QuerySupplyRequest)(nil), // 16: regen.ecocredit.v1beta1.QuerySupplyRequest - (*QuerySupplyResponse)(nil), // 17: regen.ecocredit.v1beta1.QuerySupplyResponse - (*QueryCreditTypesRequest)(nil), // 18: regen.ecocredit.v1beta1.QueryCreditTypesRequest - (*QueryCreditTypesResponse)(nil), // 19: regen.ecocredit.v1beta1.QueryCreditTypesResponse - (*Params)(nil), // 20: regen.ecocredit.v1beta1.Params - (*v1beta1.PageRequest)(nil), // 21: cosmos.base.query.v1beta1.PageRequest - (*ClassInfo)(nil), // 22: regen.ecocredit.v1beta1.ClassInfo - (*v1beta1.PageResponse)(nil), // 23: cosmos.base.query.v1beta1.PageResponse - (*ProjectInfo)(nil), // 24: regen.ecocredit.v1beta1.ProjectInfo - (*BatchInfo)(nil), // 25: regen.ecocredit.v1beta1.BatchInfo - (*CreditType)(nil), // 26: regen.ecocredit.v1beta1.CreditType + (*QueryParamsRequest)(nil), // 0: regen.ecocredit.v1beta1.QueryParamsRequest + (*QueryParamsResponse)(nil), // 1: regen.ecocredit.v1beta1.QueryParamsResponse + (*QueryClassesRequest)(nil), // 2: regen.ecocredit.v1beta1.QueryClassesRequest + (*QueryClassesResponse)(nil), // 3: regen.ecocredit.v1beta1.QueryClassesResponse + (*QueryClassInfoRequest)(nil), // 4: regen.ecocredit.v1beta1.QueryClassInfoRequest + (*QueryClassInfoResponse)(nil), // 5: regen.ecocredit.v1beta1.QueryClassInfoResponse + (*QueryClassIssuersRequest)(nil), // 6: regen.ecocredit.v1beta1.QueryClassIssuersRequest + (*QueryClassIssuersResponse)(nil), // 7: regen.ecocredit.v1beta1.QueryClassIssuersResponse + (*QueryProjectsRequest)(nil), // 8: regen.ecocredit.v1beta1.QueryProjectsRequest + (*QueryProjectsResponse)(nil), // 9: regen.ecocredit.v1beta1.QueryProjectsResponse + (*QueryProjectInfoRequest)(nil), // 10: regen.ecocredit.v1beta1.QueryProjectInfoRequest + (*QueryProjectInfoResponse)(nil), // 11: regen.ecocredit.v1beta1.QueryProjectInfoResponse + (*QueryBatchesRequest)(nil), // 12: regen.ecocredit.v1beta1.QueryBatchesRequest + (*QueryBatchesResponse)(nil), // 13: regen.ecocredit.v1beta1.QueryBatchesResponse + (*QueryBatchInfoRequest)(nil), // 14: regen.ecocredit.v1beta1.QueryBatchInfoRequest + (*QueryBatchInfoResponse)(nil), // 15: regen.ecocredit.v1beta1.QueryBatchInfoResponse + (*QueryBalanceRequest)(nil), // 16: regen.ecocredit.v1beta1.QueryBalanceRequest + (*QueryBalanceResponse)(nil), // 17: regen.ecocredit.v1beta1.QueryBalanceResponse + (*QuerySupplyRequest)(nil), // 18: regen.ecocredit.v1beta1.QuerySupplyRequest + (*QuerySupplyResponse)(nil), // 19: regen.ecocredit.v1beta1.QuerySupplyResponse + (*QueryCreditTypesRequest)(nil), // 20: regen.ecocredit.v1beta1.QueryCreditTypesRequest + (*QueryCreditTypesResponse)(nil), // 21: regen.ecocredit.v1beta1.QueryCreditTypesResponse + (*Params)(nil), // 22: regen.ecocredit.v1beta1.Params + (*v1beta1.PageRequest)(nil), // 23: cosmos.base.query.v1beta1.PageRequest + (*ClassInfo)(nil), // 24: regen.ecocredit.v1beta1.ClassInfo + (*v1beta1.PageResponse)(nil), // 25: cosmos.base.query.v1beta1.PageResponse + (*ProjectInfo)(nil), // 26: regen.ecocredit.v1beta1.ProjectInfo + (*BatchInfo)(nil), // 27: regen.ecocredit.v1beta1.BatchInfo + (*CreditType)(nil), // 28: regen.ecocredit.v1beta1.CreditType } var file_regen_ecocredit_v1beta1_query_proto_depIdxs = []int32{ - 20, // 0: regen.ecocredit.v1beta1.QueryParamsResponse.params:type_name -> regen.ecocredit.v1beta1.Params - 21, // 1: regen.ecocredit.v1beta1.QueryClassesRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 22, // 2: regen.ecocredit.v1beta1.QueryClassesResponse.classes:type_name -> regen.ecocredit.v1beta1.ClassInfo - 23, // 3: regen.ecocredit.v1beta1.QueryClassesResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 22, // 4: regen.ecocredit.v1beta1.QueryClassInfoResponse.info:type_name -> regen.ecocredit.v1beta1.ClassInfo - 21, // 5: regen.ecocredit.v1beta1.QueryProjectsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 24, // 6: regen.ecocredit.v1beta1.QueryProjectsResponse.projects:type_name -> regen.ecocredit.v1beta1.ProjectInfo - 23, // 7: regen.ecocredit.v1beta1.QueryProjectsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 24, // 8: regen.ecocredit.v1beta1.QueryProjectInfoResponse.info:type_name -> regen.ecocredit.v1beta1.ProjectInfo - 21, // 9: regen.ecocredit.v1beta1.QueryBatchesRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest - 25, // 10: regen.ecocredit.v1beta1.QueryBatchesResponse.batches:type_name -> regen.ecocredit.v1beta1.BatchInfo - 23, // 11: regen.ecocredit.v1beta1.QueryBatchesResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse - 25, // 12: regen.ecocredit.v1beta1.QueryBatchInfoResponse.info:type_name -> regen.ecocredit.v1beta1.BatchInfo - 26, // 13: regen.ecocredit.v1beta1.QueryCreditTypesResponse.credit_types:type_name -> regen.ecocredit.v1beta1.CreditType - 2, // 14: regen.ecocredit.v1beta1.Query.Classes:input_type -> regen.ecocredit.v1beta1.QueryClassesRequest - 4, // 15: regen.ecocredit.v1beta1.Query.ClassInfo:input_type -> regen.ecocredit.v1beta1.QueryClassInfoRequest - 6, // 16: regen.ecocredit.v1beta1.Query.Projects:input_type -> regen.ecocredit.v1beta1.QueryProjectsRequest - 8, // 17: regen.ecocredit.v1beta1.Query.ProjectInfo:input_type -> regen.ecocredit.v1beta1.QueryProjectInfoRequest - 10, // 18: regen.ecocredit.v1beta1.Query.Batches:input_type -> regen.ecocredit.v1beta1.QueryBatchesRequest - 12, // 19: regen.ecocredit.v1beta1.Query.BatchInfo:input_type -> regen.ecocredit.v1beta1.QueryBatchInfoRequest - 14, // 20: regen.ecocredit.v1beta1.Query.Balance:input_type -> regen.ecocredit.v1beta1.QueryBalanceRequest - 16, // 21: regen.ecocredit.v1beta1.Query.Supply:input_type -> regen.ecocredit.v1beta1.QuerySupplyRequest - 18, // 22: regen.ecocredit.v1beta1.Query.CreditTypes:input_type -> regen.ecocredit.v1beta1.QueryCreditTypesRequest - 0, // 23: regen.ecocredit.v1beta1.Query.Params:input_type -> regen.ecocredit.v1beta1.QueryParamsRequest - 3, // 24: regen.ecocredit.v1beta1.Query.Classes:output_type -> regen.ecocredit.v1beta1.QueryClassesResponse - 5, // 25: regen.ecocredit.v1beta1.Query.ClassInfo:output_type -> regen.ecocredit.v1beta1.QueryClassInfoResponse - 7, // 26: regen.ecocredit.v1beta1.Query.Projects:output_type -> regen.ecocredit.v1beta1.QueryProjectsResponse - 9, // 27: regen.ecocredit.v1beta1.Query.ProjectInfo:output_type -> regen.ecocredit.v1beta1.QueryProjectInfoResponse - 11, // 28: regen.ecocredit.v1beta1.Query.Batches:output_type -> regen.ecocredit.v1beta1.QueryBatchesResponse - 13, // 29: regen.ecocredit.v1beta1.Query.BatchInfo:output_type -> regen.ecocredit.v1beta1.QueryBatchInfoResponse - 15, // 30: regen.ecocredit.v1beta1.Query.Balance:output_type -> regen.ecocredit.v1beta1.QueryBalanceResponse - 17, // 31: regen.ecocredit.v1beta1.Query.Supply:output_type -> regen.ecocredit.v1beta1.QuerySupplyResponse - 19, // 32: regen.ecocredit.v1beta1.Query.CreditTypes:output_type -> regen.ecocredit.v1beta1.QueryCreditTypesResponse - 1, // 33: regen.ecocredit.v1beta1.Query.Params:output_type -> regen.ecocredit.v1beta1.QueryParamsResponse - 24, // [24:34] is the sub-list for method output_type - 14, // [14:24] is the sub-list for method input_type - 14, // [14:14] is the sub-list for extension type_name - 14, // [14:14] is the sub-list for extension extendee - 0, // [0:14] is the sub-list for field type_name + 22, // 0: regen.ecocredit.v1beta1.QueryParamsResponse.params:type_name -> regen.ecocredit.v1beta1.Params + 23, // 1: regen.ecocredit.v1beta1.QueryClassesRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 24, // 2: regen.ecocredit.v1beta1.QueryClassesResponse.classes:type_name -> regen.ecocredit.v1beta1.ClassInfo + 25, // 3: regen.ecocredit.v1beta1.QueryClassesResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 24, // 4: regen.ecocredit.v1beta1.QueryClassInfoResponse.info:type_name -> regen.ecocredit.v1beta1.ClassInfo + 23, // 5: regen.ecocredit.v1beta1.QueryClassIssuersRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 25, // 6: regen.ecocredit.v1beta1.QueryClassIssuersResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 23, // 7: regen.ecocredit.v1beta1.QueryProjectsRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 26, // 8: regen.ecocredit.v1beta1.QueryProjectsResponse.projects:type_name -> regen.ecocredit.v1beta1.ProjectInfo + 25, // 9: regen.ecocredit.v1beta1.QueryProjectsResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 26, // 10: regen.ecocredit.v1beta1.QueryProjectInfoResponse.info:type_name -> regen.ecocredit.v1beta1.ProjectInfo + 23, // 11: regen.ecocredit.v1beta1.QueryBatchesRequest.pagination:type_name -> cosmos.base.query.v1beta1.PageRequest + 27, // 12: regen.ecocredit.v1beta1.QueryBatchesResponse.batches:type_name -> regen.ecocredit.v1beta1.BatchInfo + 25, // 13: regen.ecocredit.v1beta1.QueryBatchesResponse.pagination:type_name -> cosmos.base.query.v1beta1.PageResponse + 27, // 14: regen.ecocredit.v1beta1.QueryBatchInfoResponse.info:type_name -> regen.ecocredit.v1beta1.BatchInfo + 28, // 15: regen.ecocredit.v1beta1.QueryCreditTypesResponse.credit_types:type_name -> regen.ecocredit.v1beta1.CreditType + 2, // 16: regen.ecocredit.v1beta1.Query.Classes:input_type -> regen.ecocredit.v1beta1.QueryClassesRequest + 4, // 17: regen.ecocredit.v1beta1.Query.ClassInfo:input_type -> regen.ecocredit.v1beta1.QueryClassInfoRequest + 6, // 18: regen.ecocredit.v1beta1.Query.ClassIssuers:input_type -> regen.ecocredit.v1beta1.QueryClassIssuersRequest + 8, // 19: regen.ecocredit.v1beta1.Query.Projects:input_type -> regen.ecocredit.v1beta1.QueryProjectsRequest + 10, // 20: regen.ecocredit.v1beta1.Query.ProjectInfo:input_type -> regen.ecocredit.v1beta1.QueryProjectInfoRequest + 12, // 21: regen.ecocredit.v1beta1.Query.Batches:input_type -> regen.ecocredit.v1beta1.QueryBatchesRequest + 14, // 22: regen.ecocredit.v1beta1.Query.BatchInfo:input_type -> regen.ecocredit.v1beta1.QueryBatchInfoRequest + 16, // 23: regen.ecocredit.v1beta1.Query.Balance:input_type -> regen.ecocredit.v1beta1.QueryBalanceRequest + 18, // 24: regen.ecocredit.v1beta1.Query.Supply:input_type -> regen.ecocredit.v1beta1.QuerySupplyRequest + 20, // 25: regen.ecocredit.v1beta1.Query.CreditTypes:input_type -> regen.ecocredit.v1beta1.QueryCreditTypesRequest + 0, // 26: regen.ecocredit.v1beta1.Query.Params:input_type -> regen.ecocredit.v1beta1.QueryParamsRequest + 3, // 27: regen.ecocredit.v1beta1.Query.Classes:output_type -> regen.ecocredit.v1beta1.QueryClassesResponse + 5, // 28: regen.ecocredit.v1beta1.Query.ClassInfo:output_type -> regen.ecocredit.v1beta1.QueryClassInfoResponse + 7, // 29: regen.ecocredit.v1beta1.Query.ClassIssuers:output_type -> regen.ecocredit.v1beta1.QueryClassIssuersResponse + 9, // 30: regen.ecocredit.v1beta1.Query.Projects:output_type -> regen.ecocredit.v1beta1.QueryProjectsResponse + 11, // 31: regen.ecocredit.v1beta1.Query.ProjectInfo:output_type -> regen.ecocredit.v1beta1.QueryProjectInfoResponse + 13, // 32: regen.ecocredit.v1beta1.Query.Batches:output_type -> regen.ecocredit.v1beta1.QueryBatchesResponse + 15, // 33: regen.ecocredit.v1beta1.Query.BatchInfo:output_type -> regen.ecocredit.v1beta1.QueryBatchInfoResponse + 17, // 34: regen.ecocredit.v1beta1.Query.Balance:output_type -> regen.ecocredit.v1beta1.QueryBalanceResponse + 19, // 35: regen.ecocredit.v1beta1.Query.Supply:output_type -> regen.ecocredit.v1beta1.QuerySupplyResponse + 21, // 36: regen.ecocredit.v1beta1.Query.CreditTypes:output_type -> regen.ecocredit.v1beta1.QueryCreditTypesResponse + 1, // 37: regen.ecocredit.v1beta1.Query.Params:output_type -> regen.ecocredit.v1beta1.QueryParamsResponse + 27, // [27:38] is the sub-list for method output_type + 16, // [16:27] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name } func init() { file_regen_ecocredit_v1beta1_query_proto_init() } @@ -10468,7 +11728,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryProjectsRequest); i { + switch v := v.(*QueryClassIssuersRequest); i { case 0: return &v.state case 1: @@ -10480,7 +11740,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryProjectsResponse); i { + switch v := v.(*QueryClassIssuersResponse); i { case 0: return &v.state case 1: @@ -10492,7 +11752,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryProjectInfoRequest); i { + switch v := v.(*QueryProjectsRequest); i { case 0: return &v.state case 1: @@ -10504,7 +11764,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryProjectInfoResponse); i { + switch v := v.(*QueryProjectsResponse); i { case 0: return &v.state case 1: @@ -10516,7 +11776,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryBatchesRequest); i { + switch v := v.(*QueryProjectInfoRequest); i { case 0: return &v.state case 1: @@ -10528,7 +11788,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryBatchesResponse); i { + switch v := v.(*QueryProjectInfoResponse); i { case 0: return &v.state case 1: @@ -10540,7 +11800,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryBatchInfoRequest); i { + switch v := v.(*QueryBatchesRequest); i { case 0: return &v.state case 1: @@ -10552,7 +11812,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryBatchInfoResponse); i { + switch v := v.(*QueryBatchesResponse); i { case 0: return &v.state case 1: @@ -10564,7 +11824,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryBalanceRequest); i { + switch v := v.(*QueryBatchInfoRequest); i { case 0: return &v.state case 1: @@ -10576,7 +11836,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryBalanceResponse); i { + switch v := v.(*QueryBatchInfoResponse); i { case 0: return &v.state case 1: @@ -10588,7 +11848,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QuerySupplyRequest); i { + switch v := v.(*QueryBalanceRequest); i { case 0: return &v.state case 1: @@ -10600,7 +11860,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QuerySupplyResponse); i { + switch v := v.(*QueryBalanceResponse); i { case 0: return &v.state case 1: @@ -10612,7 +11872,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QueryCreditTypesRequest); i { + switch v := v.(*QuerySupplyRequest); i { case 0: return &v.state case 1: @@ -10624,6 +11884,30 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { } } file_regen_ecocredit_v1beta1_query_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QuerySupplyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_regen_ecocredit_v1beta1_query_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryCreditTypesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_regen_ecocredit_v1beta1_query_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*QueryCreditTypesResponse); i { case 0: return &v.state @@ -10642,7 +11926,7 @@ func file_regen_ecocredit_v1beta1_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_regen_ecocredit_v1beta1_query_proto_rawDesc, NumEnums: 0, - NumMessages: 20, + NumMessages: 22, NumExtensions: 0, NumServices: 1, }, diff --git a/api/regen/ecocredit/v1beta1/query_grpc.pb.go b/api/regen/ecocredit/v1beta1/query_grpc.pb.go index 256c985e69..03de0a9b1c 100644 --- a/api/regen/ecocredit/v1beta1/query_grpc.pb.go +++ b/api/regen/ecocredit/v1beta1/query_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/v1beta1/query.proto package ecocreditv1beta1 @@ -26,6 +26,8 @@ type QueryClient interface { Classes(ctx context.Context, in *QueryClassesRequest, opts ...grpc.CallOption) (*QueryClassesResponse, error) // ClassInfo queries for information on a credit class. ClassInfo(ctx context.Context, in *QueryClassInfoRequest, opts ...grpc.CallOption) (*QueryClassInfoResponse, error) + // ClassIssuers queries for the addresses of the issuers for a credit class. + ClassIssuers(ctx context.Context, in *QueryClassIssuersRequest, opts ...grpc.CallOption) (*QueryClassIssuersResponse, error) // Projects queries for all projects within a class with pagination. Projects(ctx context.Context, in *QueryProjectsRequest, opts ...grpc.CallOption) (*QueryProjectsResponse, error) // ClassInfo queries for information on a project. @@ -72,6 +74,15 @@ func (c *queryClient) ClassInfo(ctx context.Context, in *QueryClassInfoRequest, return out, nil } +func (c *queryClient) ClassIssuers(ctx context.Context, in *QueryClassIssuersRequest, opts ...grpc.CallOption) (*QueryClassIssuersResponse, error) { + out := new(QueryClassIssuersResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.v1beta1.Query/ClassIssuers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) Projects(ctx context.Context, in *QueryProjectsRequest, opts ...grpc.CallOption) (*QueryProjectsResponse, error) { out := new(QueryProjectsResponse) err := c.cc.Invoke(ctx, "/regen.ecocredit.v1beta1.Query/Projects", in, out, opts...) @@ -152,6 +163,8 @@ type QueryServer interface { Classes(context.Context, *QueryClassesRequest) (*QueryClassesResponse, error) // ClassInfo queries for information on a credit class. ClassInfo(context.Context, *QueryClassInfoRequest) (*QueryClassInfoResponse, error) + // ClassIssuers queries for the addresses of the issuers for a credit class. + ClassIssuers(context.Context, *QueryClassIssuersRequest) (*QueryClassIssuersResponse, error) // Projects queries for all projects within a class with pagination. Projects(context.Context, *QueryProjectsRequest) (*QueryProjectsResponse, error) // ClassInfo queries for information on a project. @@ -183,6 +196,9 @@ func (UnimplementedQueryServer) Classes(context.Context, *QueryClassesRequest) ( func (UnimplementedQueryServer) ClassInfo(context.Context, *QueryClassInfoRequest) (*QueryClassInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClassInfo not implemented") } +func (UnimplementedQueryServer) ClassIssuers(context.Context, *QueryClassIssuersRequest) (*QueryClassIssuersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassIssuers not implemented") +} func (UnimplementedQueryServer) Projects(context.Context, *QueryProjectsRequest) (*QueryProjectsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Projects not implemented") } @@ -256,6 +272,24 @@ func _Query_ClassInfo_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Query_ClassIssuers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClassIssuersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ClassIssuers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.v1beta1.Query/ClassIssuers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ClassIssuers(ctx, req.(*QueryClassIssuersRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_Projects_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryProjectsRequest) if err := dec(in); err != nil { @@ -415,6 +449,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "ClassInfo", Handler: _Query_ClassInfo_Handler, }, + { + MethodName: "ClassIssuers", + Handler: _Query_ClassIssuers_Handler, + }, { MethodName: "Projects", Handler: _Query_Projects_Handler, diff --git a/api/regen/ecocredit/v1beta1/state.pulsar.go b/api/regen/ecocredit/v1beta1/state.pulsar.go index 5b4af8da3e..b07815e055 100644 --- a/api/regen/ecocredit/v1beta1/state.pulsar.go +++ b/api/regen/ecocredit/v1beta1/state.pulsar.go @@ -5727,7 +5727,7 @@ func (x *fastReflection_BatchSupply) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1beta1/state.proto const ( diff --git a/api/regen/ecocredit/v1beta1/tx.pulsar.go b/api/regen/ecocredit/v1beta1/tx.pulsar.go index 1590df16a7..771d4fae1a 100644 --- a/api/regen/ecocredit/v1beta1/tx.pulsar.go +++ b/api/regen/ecocredit/v1beta1/tx.pulsar.go @@ -11311,7 +11311,7 @@ func (x *fastReflection_MsgUpdateClassMetadataResponse) ProtoMethods() *protoifa // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1beta1/tx.proto const ( diff --git a/api/regen/ecocredit/v1beta1/tx_grpc.pb.go b/api/regen/ecocredit/v1beta1/tx_grpc.pb.go index ea642beb25..c5ce88b1f7 100644 --- a/api/regen/ecocredit/v1beta1/tx_grpc.pb.go +++ b/api/regen/ecocredit/v1beta1/tx_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/ecocredit/v1beta1/tx.proto package ecocreditv1beta1 diff --git a/api/regen/ecocredit/v1beta1/types.pulsar.go b/api/regen/ecocredit/v1beta1/types.pulsar.go index c4797cdab9..1a1dea00ee 100644 --- a/api/regen/ecocredit/v1beta1/types.pulsar.go +++ b/api/regen/ecocredit/v1beta1/types.pulsar.go @@ -827,7 +827,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/ecocredit/v1beta1/types.proto const ( diff --git a/api/regen/group/v1alpha1/events.pulsar.go b/api/regen/group/v1alpha1/events.pulsar.go index 88a1f65b38..a6a5f24e95 100644 --- a/api/regen/group/v1alpha1/events.pulsar.go +++ b/api/regen/group/v1alpha1/events.pulsar.go @@ -2875,7 +2875,7 @@ func (x *fastReflection_EventExec) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/group/v1alpha1/events.proto const ( diff --git a/api/regen/group/v1alpha1/genesis.pulsar.go b/api/regen/group/v1alpha1/genesis.pulsar.go index 83282bfdcb..38fdc07572 100644 --- a/api/regen/group/v1alpha1/genesis.pulsar.go +++ b/api/regen/group/v1alpha1/genesis.pulsar.go @@ -1205,7 +1205,7 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/group/v1alpha1/genesis.proto const ( diff --git a/api/regen/group/v1alpha1/query.pulsar.go b/api/regen/group/v1alpha1/query.pulsar.go index 5384a5a650..f646904362 100644 --- a/api/regen/group/v1alpha1/query.pulsar.go +++ b/api/regen/group/v1alpha1/query.pulsar.go @@ -10909,7 +10909,7 @@ func (x *fastReflection_QueryVotesByVoterResponse) ProtoMethods() *protoiface.Me // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/group/v1alpha1/query.proto const ( diff --git a/api/regen/group/v1alpha1/query_grpc.pb.go b/api/regen/group/v1alpha1/query_grpc.pb.go index 802b5810f5..fe4ba1f7b9 100644 --- a/api/regen/group/v1alpha1/query_grpc.pb.go +++ b/api/regen/group/v1alpha1/query_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/group/v1alpha1/query.proto package groupv1alpha1 diff --git a/api/regen/group/v1alpha1/tx.pulsar.go b/api/regen/group/v1alpha1/tx.pulsar.go index 1d22208c7f..c22a1b4915 100644 --- a/api/regen/group/v1alpha1/tx.pulsar.go +++ b/api/regen/group/v1alpha1/tx.pulsar.go @@ -10558,7 +10558,7 @@ func (x *fastReflection_MsgExecResponse) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/group/v1alpha1/tx.proto const ( diff --git a/api/regen/group/v1alpha1/tx_grpc.pb.go b/api/regen/group/v1alpha1/tx_grpc.pb.go index eac2a30959..84172ca02e 100644 --- a/api/regen/group/v1alpha1/tx_grpc.pb.go +++ b/api/regen/group/v1alpha1/tx_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.2.0 -// - protoc (unknown) +// - protoc v3.19.1 // source: regen/group/v1alpha1/tx.proto package groupv1alpha1 diff --git a/api/regen/group/v1alpha1/types.pulsar.go b/api/regen/group/v1alpha1/types.pulsar.go index d290272399..5f05ad2f7e 100644 --- a/api/regen/group/v1alpha1/types.pulsar.go +++ b/api/regen/group/v1alpha1/types.pulsar.go @@ -6029,7 +6029,7 @@ func (x *fastReflection_Vote) ProtoMethods() *protoiface.Methods { // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 -// protoc (unknown) +// protoc v3.19.1 // source: regen/group/v1alpha1/types.proto const ( diff --git a/go.sum b/go.sum index bdba051200..5f68029119 100644 --- a/go.sum +++ b/go.sum @@ -240,7 +240,6 @@ github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNs github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3/go.mod h1:Ht15guGn9F8b0lv8NkjXE9/asAvVUOt2n4gvQ4q5MyU= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.6/go.mod h1:pH7cqdUlm/zbtGUxlg9Lf/KL8poW4N9HkSN1AKAwRKk= github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7/go.mod h1:woV5EBAWmTaXKs7YXioQsYheXSZkmZIgLPq+Koi/GB8= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= diff --git a/proto/regen/ecocredit/basket/v1beta1/events.proto b/proto/regen/ecocredit/basket/v1beta1/events.proto index 6013b46504..96a3706e4e 100644 --- a/proto/regen/ecocredit/basket/v1beta1/events.proto +++ b/proto/regen/ecocredit/basket/v1beta1/events.proto @@ -2,4 +2,4 @@ syntax = "proto3"; package regen.ecocredit.basket.v1beta1; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket/v1beta1"; diff --git a/proto/regen/ecocredit/basket/v1beta1/query.proto b/proto/regen/ecocredit/basket/v1beta1/query.proto index 8d97f03e1d..d6d0ede01f 100644 --- a/proto/regen/ecocredit/basket/v1beta1/query.proto +++ b/proto/regen/ecocredit/basket/v1beta1/query.proto @@ -6,7 +6,7 @@ import "google/api/annotations.proto"; import "regen/ecocredit/basket/v1beta1/types.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket/v1beta1"; // Msg is the regen.ecocredit.basket.v1beta1 Query service. service Query { diff --git a/proto/regen/ecocredit/basket/v1beta1/state.proto b/proto/regen/ecocredit/basket/v1beta1/state.proto index 9eaab6e419..3fc822962c 100644 --- a/proto/regen/ecocredit/basket/v1beta1/state.proto +++ b/proto/regen/ecocredit/basket/v1beta1/state.proto @@ -4,7 +4,7 @@ package regen.ecocredit.basket.v1beta1; import "cosmos/orm/v1alpha1/orm.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket/v1beta1"; // BasketBalance stores the amount of credits from a batch in a basket message BasketBalance { diff --git a/proto/regen/ecocredit/basket/v1beta1/tx.proto b/proto/regen/ecocredit/basket/v1beta1/tx.proto index 54ceeaac31..b9be223df3 100644 --- a/proto/regen/ecocredit/basket/v1beta1/tx.proto +++ b/proto/regen/ecocredit/basket/v1beta1/tx.proto @@ -4,7 +4,7 @@ package regen.ecocredit.basket.v1beta1; import "regen/ecocredit/basket/v1beta1/types.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket/v1beta1"; // Msg is the regen.ecocredit.basket.v1beta1 Msg service. service Msg { diff --git a/proto/regen/ecocredit/basket/v1beta1/types.proto b/proto/regen/ecocredit/basket/v1beta1/types.proto index 9d57fab868..5e3dff9e17 100644 --- a/proto/regen/ecocredit/basket/v1beta1/types.proto +++ b/proto/regen/ecocredit/basket/v1beta1/types.proto @@ -5,7 +5,7 @@ package regen.ecocredit.basket.v1beta1; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/basket/v1beta1"; // BasketCredit represents the information for a credit batch inside a basket. message BasketCredit { diff --git a/proto/regen/ecocredit/marketplace/v1beta1/events.proto b/proto/regen/ecocredit/marketplace/v1beta1/events.proto index ae9001f3b2..d296278cd2 100644 --- a/proto/regen/ecocredit/marketplace/v1beta1/events.proto +++ b/proto/regen/ecocredit/marketplace/v1beta1/events.proto @@ -6,7 +6,7 @@ import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/v1beta1"; // EventSell is an event emitted when a sell order is created. message EventSell { diff --git a/proto/regen/ecocredit/marketplace/v1beta1/query.proto b/proto/regen/ecocredit/marketplace/v1beta1/query.proto index 295ca9d8cc..b09eb45c5e 100644 --- a/proto/regen/ecocredit/marketplace/v1beta1/query.proto +++ b/proto/regen/ecocredit/marketplace/v1beta1/query.proto @@ -6,7 +6,7 @@ import "google/api/annotations.proto"; import "regen/ecocredit/marketplace/v1beta1/state.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/v1beta1"; // Msg is the regen.ecocredit.marketplace.v1beta1 Query service. service Query { diff --git a/proto/regen/ecocredit/marketplace/v1beta1/state.proto b/proto/regen/ecocredit/marketplace/v1beta1/state.proto index 9336b3ba82..1f48fe0c7c 100644 --- a/proto/regen/ecocredit/marketplace/v1beta1/state.proto +++ b/proto/regen/ecocredit/marketplace/v1beta1/state.proto @@ -6,7 +6,7 @@ import "google/protobuf/timestamp.proto"; import "cosmos/orm/v1alpha1/orm.proto"; import "regen/ecocredit/marketplace/v1beta1/types.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/v1beta1"; // SellOrder represents the information for a sell order. message SellOrder { diff --git a/proto/regen/ecocredit/marketplace/v1beta1/tx.proto b/proto/regen/ecocredit/marketplace/v1beta1/tx.proto index 037b3ff5e9..7c6a7943c4 100644 --- a/proto/regen/ecocredit/marketplace/v1beta1/tx.proto +++ b/proto/regen/ecocredit/marketplace/v1beta1/tx.proto @@ -7,7 +7,7 @@ import "cosmos/base/v1beta1/coin.proto"; import "google/protobuf/timestamp.proto"; import "regen/ecocredit/marketplace/v1beta1/types.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/v1beta1"; // Msg is the regen.ecocredit.marketplace.v1beta1 Msg service. service Msg { diff --git a/proto/regen/ecocredit/marketplace/v1beta1/types.proto b/proto/regen/ecocredit/marketplace/v1beta1/types.proto index 65c8f3f0ca..ab3637bf96 100644 --- a/proto/regen/ecocredit/marketplace/v1beta1/types.proto +++ b/proto/regen/ecocredit/marketplace/v1beta1/types.proto @@ -4,7 +4,7 @@ package regen.ecocredit.marketplace.v1beta1; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; +option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/marketplace/v1beta1"; // Filter is used to create filtered buy orders which match credit batch // sell orders based on selection criteria rather than matching individual diff --git a/proto/regen/ecocredit/v1beta1/query.proto b/proto/regen/ecocredit/v1beta1/query.proto index 8d5f8fbf01..e1fa7c140a 100644 --- a/proto/regen/ecocredit/v1beta1/query.proto +++ b/proto/regen/ecocredit/v1beta1/query.proto @@ -24,7 +24,14 @@ service Query { "/regen/ecocredit/v1beta1/classes/{class_id}"; } - // Projects queries for all projects within a class with pagination. + // ClassIssuers queries for the addresses of the issuers for a credit class. + rpc ClassIssuers(QueryClassIssuersRequest) returns (QueryClassIssuersResponse) { + option (google.api.http).get = + "/regen/ecocredit/v1alpha2/classes/{class_id}/issuers"; + } + + + // Projects queries for all projects within a class with pagination. rpc Projects(QueryProjectsRequest) returns (QueryProjectsResponse) { option (google.api.http).get = "/regen/ecocredit/v1beta1/classes/{class_id}/projects"; @@ -113,6 +120,24 @@ message QueryClassInfoResponse { ClassInfo info = 1; } +// QueryClassIssuersRequest is the Query/ClassIssuers request type. +message QueryClassIssuersRequest { + // class_id is the unique ID of credit class to query. + string class_id = 1; + + // pagination defines an optional pagination for the request. + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryClassIssuersRequest is the Query/ClassIssuers response type. +message QueryClassIssuersResponse { + // issuers is a list of issuers for the credit class + repeated string issuers = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + // QueryProjectsRequest is the Query/Projects request type. message QueryProjectsRequest { @@ -218,6 +243,10 @@ message QuerySupplyResponse { // retired_supply is the decimal number of retired credits in the batch // supply. string retired_supply = 2; + + // cancelled_amount is the decimal number of cancelled credits in the batch + // supply. + string cancelled_amount = 3; } // QueryCreditTypesRequest is the Query/Credit_Types request type diff --git a/types/math/dec.go b/types/math/dec.go index f61db05f03..887040d050 100644 --- a/types/math/dec.go +++ b/types/math/dec.go @@ -2,7 +2,6 @@ package math import ( "fmt" - "github.com/cockroachdb/apd/v2" "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -33,6 +32,9 @@ var dec128Context = apd.Context{ } func NewDecFromString(s string) (Dec, error) { + if s == "" { + s = "0" + } d, _, err := apd.NewFromString(s) if err != nil { return Dec{}, ErrInvalidDecString.Wrap(err.Error()) diff --git a/x/data/query.pb.gw.go b/x/data/query.pb.gw.go index ce1a719a83..487d029e7f 100644 --- a/x/data/query.pb.gw.go +++ b/x/data/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_ByIRI_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryByIRIRequest @@ -232,12 +234,14 @@ func local_request_Query_Signers_0(ctx context.Context, marshaler runtime.Marsha // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_ByIRI_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -245,6 +249,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ByIRI_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -258,6 +263,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_BySigner_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -265,6 +272,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_BySigner_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -278,6 +286,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Signers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -285,6 +295,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Signers_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/ecocredit/basket/v1beta1/events.pb.go b/x/ecocredit/basket/v1beta1/events.pb.go new file mode 100644 index 0000000000..be45c46047 --- /dev/null +++ b/x/ecocredit/basket/v1beta1/events.pb.go @@ -0,0 +1,39 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/basket/v1beta1/events.proto + +package v1beta1 + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { + proto.RegisterFile("regen/ecocredit/basket/v1beta1/events.proto", fileDescriptor_0b65fabc48182a26) +} + +var fileDescriptor_0b65fabc48182a26 = []byte{ + // 150 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, 0x4f, 0x4a, 0x2c, 0xce, + 0x4e, 0x2d, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, + 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x03, 0x2b, 0xd6, 0x83, 0x2b, 0xd6, 0x83, + 0x28, 0xd6, 0x83, 0x2a, 0x76, 0x8a, 0x3a, 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, 0x87, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xb0, 0x21, 0xba, + 0x79, 0xa9, 0x25, 0xe5, 0xf9, 0x45, 0xd9, 0x50, 0x5e, 0x4e, 0x6a, 0x4a, 0x7a, 0x6a, 0x91, 0x7e, + 0x05, 0x4e, 0x87, 0x24, 0xb1, 0x81, 0x9d, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xe2, 0x42, + 0x91, 0x3f, 0xb1, 0x00, 0x00, 0x00, +} diff --git a/x/ecocredit/basket/v1beta1/query.pb.go b/x/ecocredit/basket/v1beta1/query.pb.go new file mode 100644 index 0000000000..43136b4dee --- /dev/null +++ b/x/ecocredit/basket/v1beta1/query.pb.go @@ -0,0 +1,2029 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/basket/v1beta1/query.proto + +package v1beta1 + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Basket defines a credit basket. +type Basket struct { + // curator is the address of the basket curator who is able to change certain + // basket settings. + Curator string `protobuf:"bytes,1,opt,name=curator,proto3" json:"curator,omitempty"` + // name will be used to create a bank denom for this basket token of the form + // ecocredit:{curator}:{name}. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // display_name will be used to create a bank Metadata display name for this + // basket token of the form ecocredit:{curator}:{display_name}. + DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // exponent is the exponent that will be used for denom metadata. An exponent + // of 6 will mean that 10^6 units of a basket token should be displayed + // as one unit in user interfaces. + Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"` + // basket_criteria is the criteria by which credits can be added to the + // basket. Basket criteria will be applied in order and the first criteria + // which applies to a credit will determine its multiplier in the basket. + BasketCriteria []*BasketCriteria `protobuf:"bytes,5,rep,name=basket_criteria,json=basketCriteria,proto3" json:"basket_criteria,omitempty"` + // disable_auto_retire allows auto-retirement to be disabled. + // The credits will be auto-retired if disable_auto_retire is + // false unless the credits were previously put into the basket by the + // address picking them from the basket, in which case they will remain + // tradable. + DisableAutoRetire bool `protobuf:"varint,6,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // allow_picking specifies whether an address which didn't deposit the credits + // in the basket can pick those credits or not. + AllowPicking bool `protobuf:"varint,7,opt,name=allow_picking,json=allowPicking,proto3" json:"allow_picking,omitempty"` +} + +func (m *Basket) Reset() { *m = Basket{} } +func (m *Basket) String() string { return proto.CompactTextString(m) } +func (*Basket) ProtoMessage() {} +func (*Basket) Descriptor() ([]byte, []int) { + return fileDescriptor_e03f8820496919c5, []int{0} +} +func (m *Basket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Basket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Basket.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 *Basket) XXX_Merge(src proto.Message) { + xxx_messageInfo_Basket.Merge(m, src) +} +func (m *Basket) XXX_Size() int { + return m.Size() +} +func (m *Basket) XXX_DiscardUnknown() { + xxx_messageInfo_Basket.DiscardUnknown(m) +} + +var xxx_messageInfo_Basket proto.InternalMessageInfo + +func (m *Basket) GetCurator() string { + if m != nil { + return m.Curator + } + return "" +} + +func (m *Basket) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Basket) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func (m *Basket) GetExponent() uint32 { + if m != nil { + return m.Exponent + } + return 0 +} + +func (m *Basket) GetBasketCriteria() []*BasketCriteria { + if m != nil { + return m.BasketCriteria + } + return nil +} + +func (m *Basket) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *Basket) GetAllowPicking() bool { + if m != nil { + return m.AllowPicking + } + return false +} + +// QueryBasketRequest is the Query/Basket request type. +type QueryBasketRequest struct { + // basket_denom represents the denom of the basket to query. + BasketDenom string `protobuf:"bytes,1,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` +} + +func (m *QueryBasketRequest) Reset() { *m = QueryBasketRequest{} } +func (m *QueryBasketRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBasketRequest) ProtoMessage() {} +func (*QueryBasketRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e03f8820496919c5, []int{1} +} +func (m *QueryBasketRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBasketRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBasketRequest.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 *QueryBasketRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBasketRequest.Merge(m, src) +} +func (m *QueryBasketRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBasketRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBasketRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBasketRequest proto.InternalMessageInfo + +func (m *QueryBasketRequest) GetBasketDenom() string { + if m != nil { + return m.BasketDenom + } + return "" +} + +// QueryBasketResponse is the Query/Basket response type. +type QueryBasketResponse struct { + // basket is the queried basket. + Basket *Basket `protobuf:"bytes,1,opt,name=basket,proto3" json:"basket,omitempty"` +} + +func (m *QueryBasketResponse) Reset() { *m = QueryBasketResponse{} } +func (m *QueryBasketResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBasketResponse) ProtoMessage() {} +func (*QueryBasketResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e03f8820496919c5, []int{2} +} +func (m *QueryBasketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBasketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBasketResponse.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 *QueryBasketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBasketResponse.Merge(m, src) +} +func (m *QueryBasketResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBasketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBasketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBasketResponse proto.InternalMessageInfo + +func (m *QueryBasketResponse) GetBasket() *Basket { + if m != nil { + return m.Basket + } + return nil +} + +// QueryBasketsRequest is the Query/Baskets request type. +type QueryBasketsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBasketsRequest) Reset() { *m = QueryBasketsRequest{} } +func (m *QueryBasketsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBasketsRequest) ProtoMessage() {} +func (*QueryBasketsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e03f8820496919c5, []int{3} +} +func (m *QueryBasketsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBasketsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBasketsRequest.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 *QueryBasketsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBasketsRequest.Merge(m, src) +} +func (m *QueryBasketsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBasketsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBasketsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBasketsRequest proto.InternalMessageInfo + +func (m *QueryBasketsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBasketsResponse is the Query/Baskets response type. +type QueryBasketsResponse struct { + // baskets are the fetched baskets. + Baskets []*Basket `protobuf:"bytes,1,rep,name=baskets,proto3" json:"baskets,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBasketsResponse) Reset() { *m = QueryBasketsResponse{} } +func (m *QueryBasketsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBasketsResponse) ProtoMessage() {} +func (*QueryBasketsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e03f8820496919c5, []int{4} +} +func (m *QueryBasketsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBasketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBasketsResponse.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 *QueryBasketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBasketsResponse.Merge(m, src) +} +func (m *QueryBasketsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBasketsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBasketsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBasketsResponse proto.InternalMessageInfo + +func (m *QueryBasketsResponse) GetBaskets() []*Basket { + if m != nil { + return m.Baskets + } + return nil +} + +func (m *QueryBasketsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBasketCreditsRequest is the Query/BasketCredits request type. +type QueryBasketCreditsRequest struct { + // basket_denom is the basket denom to query credits for. + BasketDenom string `protobuf:"bytes,1,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` +} + +func (m *QueryBasketCreditsRequest) Reset() { *m = QueryBasketCreditsRequest{} } +func (m *QueryBasketCreditsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBasketCreditsRequest) ProtoMessage() {} +func (*QueryBasketCreditsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_e03f8820496919c5, []int{5} +} +func (m *QueryBasketCreditsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBasketCreditsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBasketCreditsRequest.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 *QueryBasketCreditsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBasketCreditsRequest.Merge(m, src) +} +func (m *QueryBasketCreditsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBasketCreditsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBasketCreditsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBasketCreditsRequest proto.InternalMessageInfo + +func (m *QueryBasketCreditsRequest) GetBasketDenom() string { + if m != nil { + return m.BasketDenom + } + return "" +} + +// QueryBasketCreditsResponse is the Query/BasketCredits response type. +type QueryBasketCreditsResponse struct { + // credits are the credits inside the basket. + Credits []*BasketCredit `protobuf:"bytes,1,rep,name=credits,proto3" json:"credits,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBasketCreditsResponse) Reset() { *m = QueryBasketCreditsResponse{} } +func (m *QueryBasketCreditsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBasketCreditsResponse) ProtoMessage() {} +func (*QueryBasketCreditsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e03f8820496919c5, []int{6} +} +func (m *QueryBasketCreditsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBasketCreditsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBasketCreditsResponse.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 *QueryBasketCreditsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBasketCreditsResponse.Merge(m, src) +} +func (m *QueryBasketCreditsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBasketCreditsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBasketCreditsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBasketCreditsResponse proto.InternalMessageInfo + +func (m *QueryBasketCreditsResponse) GetCredits() []*BasketCredit { + if m != nil { + return m.Credits + } + return nil +} + +func (m *QueryBasketCreditsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*Basket)(nil), "regen.ecocredit.basket.v1beta1.Basket") + proto.RegisterType((*QueryBasketRequest)(nil), "regen.ecocredit.basket.v1beta1.QueryBasketRequest") + proto.RegisterType((*QueryBasketResponse)(nil), "regen.ecocredit.basket.v1beta1.QueryBasketResponse") + proto.RegisterType((*QueryBasketsRequest)(nil), "regen.ecocredit.basket.v1beta1.QueryBasketsRequest") + proto.RegisterType((*QueryBasketsResponse)(nil), "regen.ecocredit.basket.v1beta1.QueryBasketsResponse") + proto.RegisterType((*QueryBasketCreditsRequest)(nil), "regen.ecocredit.basket.v1beta1.QueryBasketCreditsRequest") + proto.RegisterType((*QueryBasketCreditsResponse)(nil), "regen.ecocredit.basket.v1beta1.QueryBasketCreditsResponse") +} + +func init() { + proto.RegisterFile("regen/ecocredit/basket/v1beta1/query.proto", fileDescriptor_e03f8820496919c5) +} + +var fileDescriptor_e03f8820496919c5 = []byte{ + // 657 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdf, 0x6a, 0x13, 0x4f, + 0x14, 0xee, 0xa4, 0x6d, 0xd2, 0xdf, 0xa4, 0xfd, 0x89, 0x53, 0x2f, 0xd6, 0x45, 0x96, 0x34, 0x05, + 0x8d, 0xa2, 0xbb, 0x26, 0x15, 0xac, 0xbd, 0x28, 0xb5, 0x95, 0x7a, 0x27, 0x75, 0x41, 0x84, 0x82, + 0x84, 0xc9, 0xe6, 0xb0, 0x5d, 0xba, 0xd9, 0xd9, 0xce, 0x4c, 0xfa, 0x07, 0xf1, 0xc6, 0x27, 0x10, + 0x7c, 0x00, 0x51, 0x2f, 0xc5, 0xf7, 0xe8, 0x65, 0xc1, 0x1b, 0x2f, 0xa5, 0xf5, 0x41, 0x64, 0x67, + 0x66, 0x63, 0xd7, 0x7f, 0x49, 0xc4, 0xbb, 0xcc, 0x39, 0xdf, 0xf7, 0x9d, 0xef, 0x9c, 0x39, 0xd9, + 0xc1, 0x37, 0x38, 0x84, 0x90, 0x78, 0x10, 0xb0, 0x80, 0x43, 0x37, 0x92, 0x5e, 0x87, 0x8a, 0x5d, + 0x90, 0xde, 0x7e, 0xb3, 0x03, 0x92, 0x36, 0xbd, 0xbd, 0x3e, 0xf0, 0x23, 0x37, 0xe5, 0x4c, 0x32, + 0xe2, 0x28, 0xac, 0x3b, 0xc0, 0xba, 0x1a, 0xeb, 0x1a, 0xac, 0x7d, 0x25, 0x64, 0x2c, 0x8c, 0xc1, + 0xa3, 0x69, 0xe4, 0xd1, 0x24, 0x61, 0x92, 0xca, 0x88, 0x25, 0x42, 0xb3, 0xed, 0x61, 0x95, 0xe4, + 0x51, 0x0a, 0x03, 0x6c, 0xc0, 0x44, 0x8f, 0x89, 0x0c, 0x02, 0xda, 0xc2, 0x00, 0x96, 0xd2, 0x30, + 0x4a, 0x94, 0xb0, 0xc6, 0xd6, 0xdf, 0x97, 0x70, 0x79, 0x5d, 0x49, 0x11, 0x0b, 0x57, 0x82, 0x3e, + 0xa7, 0x92, 0x71, 0x0b, 0xd5, 0x50, 0xe3, 0x3f, 0x3f, 0x3f, 0x12, 0x82, 0xa7, 0x12, 0xda, 0x03, + 0xab, 0xa4, 0xc2, 0xea, 0x37, 0x59, 0xc0, 0xb3, 0xdd, 0x48, 0xa4, 0x31, 0x3d, 0x6a, 0xab, 0xdc, + 0xa4, 0xca, 0x55, 0x4d, 0xec, 0x51, 0x06, 0xb1, 0xf1, 0x0c, 0x1c, 0xa6, 0x2c, 0x81, 0x44, 0x5a, + 0x53, 0x35, 0xd4, 0x98, 0xf3, 0x07, 0x67, 0xf2, 0x14, 0x5f, 0xd0, 0x1d, 0xb4, 0x03, 0x1e, 0x49, + 0xe0, 0x11, 0xb5, 0xa6, 0x6b, 0x93, 0x8d, 0x6a, 0xcb, 0x75, 0xff, 0x3c, 0x27, 0x57, 0xbb, 0xdd, + 0x30, 0x2c, 0xff, 0xff, 0x4e, 0xe1, 0x4c, 0x5c, 0x3c, 0xdf, 0x8d, 0x04, 0xed, 0xc4, 0xd0, 0xa6, + 0x7d, 0xc9, 0xda, 0x1c, 0x64, 0xc4, 0xc1, 0x2a, 0xd7, 0x50, 0x63, 0xc6, 0xbf, 0x68, 0x52, 0xf7, + 0xfb, 0x92, 0xf9, 0x2a, 0x41, 0x16, 0xf1, 0x1c, 0x8d, 0x63, 0x76, 0xd0, 0x4e, 0xa3, 0x60, 0x37, + 0x4a, 0x42, 0xab, 0xa2, 0x90, 0xb3, 0x2a, 0xb8, 0xa5, 0x63, 0xf5, 0xbb, 0x98, 0x3c, 0xce, 0xe6, + 0xa8, 0x6b, 0xfb, 0xb0, 0xd7, 0x07, 0x21, 0xb3, 0x11, 0x98, 0x1e, 0xba, 0x90, 0xb0, 0x9e, 0x99, + 0x5a, 0x55, 0xc7, 0x1e, 0x64, 0xa1, 0xfa, 0x13, 0x3c, 0x5f, 0x20, 0x8a, 0x94, 0x25, 0x02, 0xc8, + 0x2a, 0x2e, 0x6b, 0x94, 0xe2, 0x54, 0x5b, 0x57, 0x47, 0x6b, 0xda, 0x37, 0xac, 0xfa, 0xb3, 0x82, + 0xac, 0xc8, 0x0d, 0x6d, 0x62, 0xfc, 0xfd, 0x82, 0x07, 0xd2, 0x7a, 0x1b, 0x32, 0x45, 0x70, 0xf5, + 0x42, 0xe6, 0xaa, 0x5b, 0x34, 0x04, 0xc3, 0xf5, 0xcf, 0x31, 0xeb, 0x6f, 0x11, 0xbe, 0x54, 0xd4, + 0x37, 0xbe, 0xd7, 0x70, 0x45, 0x3b, 0x10, 0x16, 0x52, 0xb7, 0x35, 0xaa, 0xf1, 0x9c, 0x46, 0x1e, + 0x16, 0x2c, 0x96, 0x94, 0xc5, 0x6b, 0x43, 0x2d, 0xea, 0xf2, 0x05, 0x8f, 0xab, 0xf8, 0xf2, 0x39, + 0x8b, 0x1b, 0xaa, 0xb8, 0x18, 0xe3, 0x66, 0x3e, 0x22, 0x6c, 0xff, 0x4a, 0xc0, 0x74, 0xba, 0x89, + 0x2b, 0xba, 0xa1, 0xbc, 0xd3, 0x9b, 0xa3, 0xee, 0x65, 0x96, 0xf3, 0x73, 0xf2, 0x3f, 0xeb, 0xb7, + 0xf5, 0x6e, 0x0a, 0x4f, 0x2b, 0xbf, 0xe4, 0x03, 0x1a, 0xfc, 0x65, 0x5b, 0xc3, 0x4c, 0xfd, 0xbc, + 0xb5, 0xf6, 0xd2, 0x58, 0x1c, 0xed, 0xa4, 0xbe, 0xfc, 0xf2, 0xd3, 0xd7, 0xd7, 0xa5, 0x16, 0xb9, + 0xed, 0xfd, 0xf8, 0x1d, 0xda, 0x6f, 0xd2, 0x38, 0xdd, 0xa1, 0x4d, 0xf3, 0x41, 0x12, 0xde, 0xf3, + 0xf3, 0x93, 0x7f, 0x41, 0xde, 0x20, 0x5c, 0x31, 0x6b, 0x44, 0xc6, 0x29, 0x9d, 0xdf, 0xa5, 0x7d, + 0x67, 0x3c, 0x92, 0x31, 0x7c, 0x5d, 0x19, 0x5e, 0x24, 0x0b, 0x43, 0x0d, 0x93, 0x63, 0x84, 0xe7, + 0x0a, 0x4b, 0x40, 0xee, 0x8d, 0x51, 0xb2, 0xb8, 0x79, 0xf6, 0xca, 0xdf, 0x50, 0x8d, 0xe7, 0x35, + 0xe5, 0x79, 0x85, 0x2c, 0x8f, 0x3b, 0x64, 0xcf, 0x6c, 0xdb, 0xfa, 0xf6, 0xf1, 0xa9, 0x83, 0x4e, + 0x4e, 0x1d, 0xf4, 0xe5, 0xd4, 0x41, 0xaf, 0xce, 0x9c, 0x89, 0x93, 0x33, 0x67, 0xe2, 0xf3, 0x99, + 0x33, 0xb1, 0xbd, 0x16, 0x46, 0x72, 0xa7, 0xdf, 0x71, 0x03, 0xd6, 0xd3, 0xea, 0xb7, 0x12, 0x90, + 0x07, 0x8c, 0xef, 0x9a, 0x53, 0x0c, 0xdd, 0x10, 0xb8, 0x77, 0xf8, 0xdb, 0x17, 0xa6, 0x53, 0x56, + 0x0f, 0xc6, 0xd2, 0xb7, 0x00, 0x00, 0x00, 0xff, 0xff, 0x96, 0x7e, 0xaa, 0xea, 0xf4, 0x06, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Basket queries one basket by denom. + Basket(ctx context.Context, in *QueryBasketRequest, opts ...grpc.CallOption) (*QueryBasketResponse, error) + // Baskets lists all baskets in the ecocredit module. + Baskets(ctx context.Context, in *QueryBasketsRequest, opts ...grpc.CallOption) (*QueryBasketsResponse, error) + // BasketCredits lists all ecocredits inside a given basket. + BasketCredits(ctx context.Context, in *QueryBasketCreditsRequest, opts ...grpc.CallOption) (*QueryBasketCreditsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Basket(ctx context.Context, in *QueryBasketRequest, opts ...grpc.CallOption) (*QueryBasketResponse, error) { + out := new(QueryBasketResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.basket.v1beta1.Query/Basket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Baskets(ctx context.Context, in *QueryBasketsRequest, opts ...grpc.CallOption) (*QueryBasketsResponse, error) { + out := new(QueryBasketsResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.basket.v1beta1.Query/Baskets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BasketCredits(ctx context.Context, in *QueryBasketCreditsRequest, opts ...grpc.CallOption) (*QueryBasketCreditsResponse, error) { + out := new(QueryBasketCreditsResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.basket.v1beta1.Query/BasketCredits", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Basket queries one basket by denom. + Basket(context.Context, *QueryBasketRequest) (*QueryBasketResponse, error) + // Baskets lists all baskets in the ecocredit module. + Baskets(context.Context, *QueryBasketsRequest) (*QueryBasketsResponse, error) + // BasketCredits lists all ecocredits inside a given basket. + BasketCredits(context.Context, *QueryBasketCreditsRequest) (*QueryBasketCreditsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Basket(ctx context.Context, req *QueryBasketRequest) (*QueryBasketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Basket not implemented") +} +func (*UnimplementedQueryServer) Baskets(ctx context.Context, req *QueryBasketsRequest) (*QueryBasketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Baskets not implemented") +} +func (*UnimplementedQueryServer) BasketCredits(ctx context.Context, req *QueryBasketCreditsRequest) (*QueryBasketCreditsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BasketCredits not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Basket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBasketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Basket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.basket.v1beta1.Query/Basket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Basket(ctx, req.(*QueryBasketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Baskets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBasketsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Baskets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.basket.v1beta1.Query/Baskets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Baskets(ctx, req.(*QueryBasketsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BasketCredits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBasketCreditsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BasketCredits(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.basket.v1beta1.Query/BasketCredits", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BasketCredits(ctx, req.(*QueryBasketCreditsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "regen.ecocredit.basket.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Basket", + Handler: _Query_Basket_Handler, + }, + { + MethodName: "Baskets", + Handler: _Query_Baskets_Handler, + }, + { + MethodName: "BasketCredits", + Handler: _Query_BasketCredits_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "regen/ecocredit/basket/v1beta1/query.proto", +} + +func (m *Basket) 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 *Basket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Basket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AllowPicking { + i-- + if m.AllowPicking { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(m.BasketCriteria) > 0 { + for iNdEx := len(m.BasketCriteria) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BasketCriteria[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.Exponent != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x20 + } + if len(m.DisplayName) > 0 { + i -= len(m.DisplayName) + copy(dAtA[i:], m.DisplayName) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DisplayName))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Curator) > 0 { + i -= len(m.Curator) + copy(dAtA[i:], m.Curator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Curator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBasketRequest) 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 *QueryBasketRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBasketRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BasketDenom) > 0 { + i -= len(m.BasketDenom) + copy(dAtA[i:], m.BasketDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BasketDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBasketResponse) 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 *QueryBasketResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBasketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Basket != nil { + { + size, err := m.Basket.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBasketsRequest) 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 *QueryBasketsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBasketsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBasketsResponse) 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 *QueryBasketsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBasketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Baskets) > 0 { + for iNdEx := len(m.Baskets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Baskets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryBasketCreditsRequest) 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 *QueryBasketCreditsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBasketCreditsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BasketDenom) > 0 { + i -= len(m.BasketDenom) + copy(dAtA[i:], m.BasketDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BasketDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBasketCreditsResponse) 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 *QueryBasketCreditsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBasketCreditsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Credits) > 0 { + for iNdEx := len(m.Credits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Credits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Basket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Curator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.DisplayName) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovQuery(uint64(m.Exponent)) + } + if len(m.BasketCriteria) > 0 { + for _, e := range m.BasketCriteria { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.DisableAutoRetire { + n += 2 + } + if m.AllowPicking { + n += 2 + } + return n +} + +func (m *QueryBasketRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BasketDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBasketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Basket != nil { + l = m.Basket.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBasketsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBasketsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Baskets) > 0 { + for _, e := range m.Baskets { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBasketCreditsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BasketDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBasketCreditsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Credits) > 0 { + for _, e := range m.Credits { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Basket) 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 ErrIntOverflowQuery + } + 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: Basket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Basket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Curator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Curator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisplayName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisplayName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + } + m.Exponent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exponent |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketCriteria", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketCriteria = append(m.BasketCriteria, &BasketCriteria{}) + if err := m.BasketCriteria[len(m.BasketCriteria)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowPicking", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowPicking = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBasketRequest) 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 ErrIntOverflowQuery + } + 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: QueryBasketRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBasketRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBasketResponse) 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 ErrIntOverflowQuery + } + 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: QueryBasketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBasketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Basket", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Basket == nil { + m.Basket = &Basket{} + } + if err := m.Basket.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBasketsRequest) 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 ErrIntOverflowQuery + } + 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: QueryBasketsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBasketsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBasketsResponse) 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 ErrIntOverflowQuery + } + 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: QueryBasketsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBasketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Baskets", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Baskets = append(m.Baskets, &Basket{}) + if err := m.Baskets[len(m.Baskets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBasketCreditsRequest) 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 ErrIntOverflowQuery + } + 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: QueryBasketCreditsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBasketCreditsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBasketCreditsResponse) 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 ErrIntOverflowQuery + } + 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: QueryBasketCreditsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBasketCreditsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Credits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Credits = append(m.Credits, &BasketCredit{}) + if err := m.Credits[len(m.Credits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/basket/v1beta1/query.pb.gw.go b/x/ecocredit/basket/v1beta1/query.pb.gw.go new file mode 100644 index 0000000000..1189ffd9df --- /dev/null +++ b/x/ecocredit/basket/v1beta1/query.pb.gw.go @@ -0,0 +1,373 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: regen/ecocredit/basket/v1beta1/query.proto + +/* +Package v1beta1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package v1beta1 + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Basket_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBasketRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["basket_denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "basket_denom") + } + + protoReq.BasketDenom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "basket_denom", err) + } + + msg, err := client.Basket(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Basket_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBasketRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["basket_denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "basket_denom") + } + + protoReq.BasketDenom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "basket_denom", err) + } + + msg, err := server.Basket(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Baskets_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Baskets_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBasketsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Baskets_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Baskets(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Baskets_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBasketsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Baskets_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Baskets(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BasketCredits_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBasketCreditsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["basket_denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "basket_denom") + } + + protoReq.BasketDenom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "basket_denom", err) + } + + msg, err := client.BasketCredits(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BasketCredits_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBasketCreditsRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["basket_denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "basket_denom") + } + + protoReq.BasketDenom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "basket_denom", err) + } + + msg, err := server.BasketCredits(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Basket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Basket_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Basket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Baskets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Baskets_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Baskets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BasketCredits_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BasketCredits_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BasketCredits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Basket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Basket_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Basket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Baskets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Baskets_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Baskets_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BasketCredits_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BasketCredits_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BasketCredits_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Basket_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"regen", "ecocredit", "v1alpha1", "baskets", "basket_denom"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Baskets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"regen", "ecocredit", "v1alpha1", "baskets"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BasketCredits_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"regen", "ecocredit", "v1alpha1", "baskets", "basket_denom", "credits"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Basket_0 = runtime.ForwardResponseMessage + + forward_Query_Baskets_0 = runtime.ForwardResponseMessage + + forward_Query_BasketCredits_0 = runtime.ForwardResponseMessage +) diff --git a/x/ecocredit/basket/v1beta1/state.pb.go b/x/ecocredit/basket/v1beta1/state.pb.go new file mode 100644 index 0000000000..a33ceb76aa --- /dev/null +++ b/x/ecocredit/basket/v1beta1/state.pb.go @@ -0,0 +1,417 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/basket/v1beta1/state.proto + +package v1beta1 + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// BasketBalance stores the amount of credits from a batch in a basket +type BasketBalance struct { + // basket_denom is the denom of the basket + BasketDenom string `protobuf:"bytes,1,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` + // batch_id is the id of the credit batch + BatchId uint64 `protobuf:"varint,2,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + // balance is the amount of ecocredits held in the basket + Balance string `protobuf:"bytes,3,opt,name=balance,proto3" json:"balance,omitempty"` +} + +func (m *BasketBalance) Reset() { *m = BasketBalance{} } +func (m *BasketBalance) String() string { return proto.CompactTextString(m) } +func (*BasketBalance) ProtoMessage() {} +func (*BasketBalance) Descriptor() ([]byte, []int) { + return fileDescriptor_87a9a9e13a9680aa, []int{0} +} +func (m *BasketBalance) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BasketBalance) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BasketBalance.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 *BasketBalance) XXX_Merge(src proto.Message) { + xxx_messageInfo_BasketBalance.Merge(m, src) +} +func (m *BasketBalance) XXX_Size() int { + return m.Size() +} +func (m *BasketBalance) XXX_DiscardUnknown() { + xxx_messageInfo_BasketBalance.DiscardUnknown(m) +} + +var xxx_messageInfo_BasketBalance proto.InternalMessageInfo + +func (m *BasketBalance) GetBasketDenom() string { + if m != nil { + return m.BasketDenom + } + return "" +} + +func (m *BasketBalance) GetBatchId() uint64 { + if m != nil { + return m.BatchId + } + return 0 +} + +func (m *BasketBalance) GetBalance() string { + if m != nil { + return m.Balance + } + return "" +} + +func init() { + proto.RegisterType((*BasketBalance)(nil), "regen.ecocredit.basket.v1beta1.BasketBalance") +} + +func init() { + proto.RegisterFile("regen/ecocredit/basket/v1beta1/state.proto", fileDescriptor_87a9a9e13a9680aa) +} + +var fileDescriptor_87a9a9e13a9680aa = []byte{ + // 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, 0x4f, 0x4a, 0x2c, 0xce, + 0x4e, 0x2d, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x2e, 0x49, 0x2c, 0x49, + 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x03, 0xab, 0xd5, 0x83, 0xab, 0xd5, 0x83, 0xa8, + 0xd5, 0x83, 0xaa, 0x95, 0x92, 0x4d, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0xcf, 0x2f, 0xca, 0xd5, + 0x2f, 0x33, 0x4c, 0xcc, 0x29, 0xc8, 0x48, 0x34, 0x04, 0x71, 0x20, 0xda, 0x95, 0xba, 0x18, 0xb9, + 0x78, 0x9d, 0xc0, 0x3a, 0x9c, 0x12, 0x73, 0x12, 0xf3, 0x92, 0x53, 0x85, 0x14, 0xb9, 0x78, 0x20, + 0x46, 0xc4, 0xa7, 0xa4, 0xe6, 0xe5, 0xe7, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x06, 0x71, 0x43, + 0xc4, 0x5c, 0x40, 0x42, 0x42, 0x92, 0x5c, 0x1c, 0x49, 0x89, 0x25, 0xc9, 0x19, 0xf1, 0x99, 0x29, + 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x2c, 0x41, 0xec, 0x60, 0xbe, 0x67, 0x8a, 0x90, 0x04, 0x17, 0x7b, + 0x12, 0xc4, 0x20, 0x09, 0x66, 0xb0, 0x46, 0x18, 0xd7, 0x4a, 0xf1, 0xd3, 0xbc, 0xcb, 0x7d, 0xcc, + 0xd2, 0x5c, 0xe2, 0x5c, 0xa2, 0xc8, 0xe6, 0xeb, 0xc0, 0x4d, 0x62, 0x74, 0x8a, 0x3a, 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, 0x87, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, + 0xe4, 0xfc, 0x5c, 0x7d, 0xb0, 0x87, 0x75, 0xf3, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xa1, 0xbc, + 0x9c, 0xd4, 0x94, 0xf4, 0xd4, 0x22, 0xfd, 0x0a, 0x9c, 0x61, 0x96, 0xc4, 0x06, 0xf6, 0xaf, 0x31, + 0x20, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x92, 0xd5, 0xce, 0x5c, 0x01, 0x00, 0x00, +} + +func (m *BasketBalance) 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 *BasketBalance) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BasketBalance) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Balance) > 0 { + i -= len(m.Balance) + copy(dAtA[i:], m.Balance) + i = encodeVarintState(dAtA, i, uint64(len(m.Balance))) + i-- + dAtA[i] = 0x1a + } + if m.BatchId != 0 { + i = encodeVarintState(dAtA, i, uint64(m.BatchId)) + i-- + dAtA[i] = 0x10 + } + if len(m.BasketDenom) > 0 { + i -= len(m.BasketDenom) + copy(dAtA[i:], m.BasketDenom) + i = encodeVarintState(dAtA, i, uint64(len(m.BasketDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintState(dAtA []byte, offset int, v uint64) int { + offset -= sovState(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BasketBalance) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BasketDenom) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.BatchId != 0 { + n += 1 + sovState(uint64(m.BatchId)) + } + l = len(m.Balance) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + return n +} + +func sovState(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozState(x uint64) (n int) { + return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BasketBalance) 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 ErrIntOverflowState + } + 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: BasketBalance: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BasketBalance: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Balance = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipState(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthState + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupState + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthState + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowState = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/basket/v1beta1/tx.pb.go b/x/ecocredit/basket/v1beta1/tx.pb.go new file mode 100644 index 0000000000..ad40f374fa --- /dev/null +++ b/x/ecocredit/basket/v1beta1/tx.pb.go @@ -0,0 +1,2513 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/basket/v1beta1/tx.proto + +package v1beta1 + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateBasket is the Msg/CreateBasket request type. +type MsgCreateBasket struct { + // curator is the address of the basket curator who is able to change certain + // basket settings. + Curator string `protobuf:"bytes,1,opt,name=curator,proto3" json:"curator,omitempty"` + // name will be used to create a bank denom for this basket token of the form + // ecocredit:{curator}:{name}. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // display_name will be used to create a bank Metadata display name for this + // basket token of the form ecocredit:{curator}:{display_name}. + DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` + // exponent is the exponent that will be used for denom metadata. An exponent + // of 6 will mean that 10^6 units of a basket token should be displayed + // as one unit in user interfaces. + Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"` + // basket_criteria is the criteria by which credits can be added to the + // basket. Basket criteria will be applied in order and the first criteria + // which applies to a credit will determine its multiplier in the basket. + BasketCriteria []*BasketCriteria `protobuf:"bytes,5,rep,name=basket_criteria,json=basketCriteria,proto3" json:"basket_criteria,omitempty"` + // disable_auto_retire allows auto-retirement to be disabled. + // The credits will be auto-retired if disable_auto_retire is + // false unless the credits were previously put into the basket by the + // address picking them from the basket, in which case they will remain + // tradable. + DisableAutoRetire bool `protobuf:"varint,6,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // allow_picking specifies whether an address which didn't deposit the credits + // in the basket can pick those credits or not. + AllowPicking bool `protobuf:"varint,7,opt,name=allow_picking,json=allowPicking,proto3" json:"allow_picking,omitempty"` +} + +func (m *MsgCreateBasket) Reset() { *m = MsgCreateBasket{} } +func (m *MsgCreateBasket) String() string { return proto.CompactTextString(m) } +func (*MsgCreateBasket) ProtoMessage() {} +func (*MsgCreateBasket) Descriptor() ([]byte, []int) { + return fileDescriptor_9e55200bd8b36dca, []int{0} +} +func (m *MsgCreateBasket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateBasket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateBasket.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 *MsgCreateBasket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateBasket.Merge(m, src) +} +func (m *MsgCreateBasket) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateBasket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateBasket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateBasket proto.InternalMessageInfo + +func (m *MsgCreateBasket) GetCurator() string { + if m != nil { + return m.Curator + } + return "" +} + +func (m *MsgCreateBasket) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgCreateBasket) GetDisplayName() string { + if m != nil { + return m.DisplayName + } + return "" +} + +func (m *MsgCreateBasket) GetExponent() uint32 { + if m != nil { + return m.Exponent + } + return 0 +} + +func (m *MsgCreateBasket) GetBasketCriteria() []*BasketCriteria { + if m != nil { + return m.BasketCriteria + } + return nil +} + +func (m *MsgCreateBasket) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *MsgCreateBasket) GetAllowPicking() bool { + if m != nil { + return m.AllowPicking + } + return false +} + +// MsgCreateBasketResponse is the Msg/CreateBasket response type. +type MsgCreateBasketResponse struct { + // basket_denom is the unique denomination ID of the newly created basket. + BasketDenom string `protobuf:"bytes,1,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` +} + +func (m *MsgCreateBasketResponse) Reset() { *m = MsgCreateBasketResponse{} } +func (m *MsgCreateBasketResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateBasketResponse) ProtoMessage() {} +func (*MsgCreateBasketResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9e55200bd8b36dca, []int{1} +} +func (m *MsgCreateBasketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateBasketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateBasketResponse.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 *MsgCreateBasketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateBasketResponse.Merge(m, src) +} +func (m *MsgCreateBasketResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateBasketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateBasketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateBasketResponse proto.InternalMessageInfo + +func (m *MsgCreateBasketResponse) GetBasketDenom() string { + if m != nil { + return m.BasketDenom + } + return "" +} + +// MsgAddToBasket is the Msg/AddToBasket request type. +type MsgAddToBasket struct { + // owner is the owner of credits being added to the basket. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // basket_denom is the basket denom to add credits to. + BasketDenom string `protobuf:"bytes,2,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` + // credits are credits to add to the basket. If they do not match the basket's + // admission criteria the operation will fail. + Credits []*BasketCredit `protobuf:"bytes,3,rep,name=credits,proto3" json:"credits,omitempty"` +} + +func (m *MsgAddToBasket) Reset() { *m = MsgAddToBasket{} } +func (m *MsgAddToBasket) String() string { return proto.CompactTextString(m) } +func (*MsgAddToBasket) ProtoMessage() {} +func (*MsgAddToBasket) Descriptor() ([]byte, []int) { + return fileDescriptor_9e55200bd8b36dca, []int{2} +} +func (m *MsgAddToBasket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddToBasket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddToBasket.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 *MsgAddToBasket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddToBasket.Merge(m, src) +} +func (m *MsgAddToBasket) XXX_Size() int { + return m.Size() +} +func (m *MsgAddToBasket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddToBasket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddToBasket proto.InternalMessageInfo + +func (m *MsgAddToBasket) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *MsgAddToBasket) GetBasketDenom() string { + if m != nil { + return m.BasketDenom + } + return "" +} + +func (m *MsgAddToBasket) GetCredits() []*BasketCredit { + if m != nil { + return m.Credits + } + return nil +} + +// MsgAddToBasketResponse is the Msg/AddToBasket response type. +type MsgAddToBasketResponse struct { + // amount_received is the amount of basket tokens received. + AmountReceived string `protobuf:"bytes,1,opt,name=amount_received,json=amountReceived,proto3" json:"amount_received,omitempty"` +} + +func (m *MsgAddToBasketResponse) Reset() { *m = MsgAddToBasketResponse{} } +func (m *MsgAddToBasketResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddToBasketResponse) ProtoMessage() {} +func (*MsgAddToBasketResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9e55200bd8b36dca, []int{3} +} +func (m *MsgAddToBasketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddToBasketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddToBasketResponse.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 *MsgAddToBasketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddToBasketResponse.Merge(m, src) +} +func (m *MsgAddToBasketResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddToBasketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddToBasketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddToBasketResponse proto.InternalMessageInfo + +func (m *MsgAddToBasketResponse) GetAmountReceived() string { + if m != nil { + return m.AmountReceived + } + return "" +} + +// MsgTakeFromBasket is the Msg/TakeFromBasket request type. +type MsgTakeFromBasket struct { + // owner is the owner of the basket tokens. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // basket_denom is the basket denom to take credits from. + BasketDenom string `protobuf:"bytes,2,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` + // amount is the number of credits to take from the basket. + Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` + // retirement_location is the optional retirement location for the credits + // which will be used only if retire_on_take is true for this basket. + RetirementLocation string `protobuf:"bytes,4,opt,name=retirement_location,json=retirementLocation,proto3" json:"retirement_location,omitempty"` +} + +func (m *MsgTakeFromBasket) Reset() { *m = MsgTakeFromBasket{} } +func (m *MsgTakeFromBasket) String() string { return proto.CompactTextString(m) } +func (*MsgTakeFromBasket) ProtoMessage() {} +func (*MsgTakeFromBasket) Descriptor() ([]byte, []int) { + return fileDescriptor_9e55200bd8b36dca, []int{4} +} +func (m *MsgTakeFromBasket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTakeFromBasket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTakeFromBasket.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 *MsgTakeFromBasket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTakeFromBasket.Merge(m, src) +} +func (m *MsgTakeFromBasket) XXX_Size() int { + return m.Size() +} +func (m *MsgTakeFromBasket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTakeFromBasket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTakeFromBasket proto.InternalMessageInfo + +func (m *MsgTakeFromBasket) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *MsgTakeFromBasket) GetBasketDenom() string { + if m != nil { + return m.BasketDenom + } + return "" +} + +func (m *MsgTakeFromBasket) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +func (m *MsgTakeFromBasket) GetRetirementLocation() string { + if m != nil { + return m.RetirementLocation + } + return "" +} + +// MsgTakeFromBasketResponse is the Msg/TakeFromBasket response type. +type MsgTakeFromBasketResponse struct { + // credits are the credits taken out of the basket. + Credits []*BasketCredit `protobuf:"bytes,1,rep,name=credits,proto3" json:"credits,omitempty"` +} + +func (m *MsgTakeFromBasketResponse) Reset() { *m = MsgTakeFromBasketResponse{} } +func (m *MsgTakeFromBasketResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTakeFromBasketResponse) ProtoMessage() {} +func (*MsgTakeFromBasketResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9e55200bd8b36dca, []int{5} +} +func (m *MsgTakeFromBasketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTakeFromBasketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTakeFromBasketResponse.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 *MsgTakeFromBasketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTakeFromBasketResponse.Merge(m, src) +} +func (m *MsgTakeFromBasketResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTakeFromBasketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTakeFromBasketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTakeFromBasketResponse proto.InternalMessageInfo + +func (m *MsgTakeFromBasketResponse) GetCredits() []*BasketCredit { + if m != nil { + return m.Credits + } + return nil +} + +// MsgPickFromBasket is the Msg/PickFromBasket request type. +type MsgPickFromBasket struct { + // owner is the owner of the basket tokens. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // basket_denom is the basket denom to pick credits from. + BasketDenom string `protobuf:"bytes,2,opt,name=basket_denom,json=basketDenom,proto3" json:"basket_denom,omitempty"` + // credits are the units of credits being picked from the basket + Credits []*BasketCredit `protobuf:"bytes,3,rep,name=credits,proto3" json:"credits,omitempty"` + // retirement_location is the optional retirement location for the credits + // which will be used only if retire_on_take is true for this basket. + RetirementLocation string `protobuf:"bytes,4,opt,name=retirement_location,json=retirementLocation,proto3" json:"retirement_location,omitempty"` +} + +func (m *MsgPickFromBasket) Reset() { *m = MsgPickFromBasket{} } +func (m *MsgPickFromBasket) String() string { return proto.CompactTextString(m) } +func (*MsgPickFromBasket) ProtoMessage() {} +func (*MsgPickFromBasket) Descriptor() ([]byte, []int) { + return fileDescriptor_9e55200bd8b36dca, []int{6} +} +func (m *MsgPickFromBasket) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPickFromBasket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPickFromBasket.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 *MsgPickFromBasket) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPickFromBasket.Merge(m, src) +} +func (m *MsgPickFromBasket) XXX_Size() int { + return m.Size() +} +func (m *MsgPickFromBasket) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPickFromBasket.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPickFromBasket proto.InternalMessageInfo + +func (m *MsgPickFromBasket) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *MsgPickFromBasket) GetBasketDenom() string { + if m != nil { + return m.BasketDenom + } + return "" +} + +func (m *MsgPickFromBasket) GetCredits() []*BasketCredit { + if m != nil { + return m.Credits + } + return nil +} + +func (m *MsgPickFromBasket) GetRetirementLocation() string { + if m != nil { + return m.RetirementLocation + } + return "" +} + +// MsgPickFromBasketResponse is the Msg/PickFromBasket response type. +type MsgPickFromBasketResponse struct { +} + +func (m *MsgPickFromBasketResponse) Reset() { *m = MsgPickFromBasketResponse{} } +func (m *MsgPickFromBasketResponse) String() string { return proto.CompactTextString(m) } +func (*MsgPickFromBasketResponse) ProtoMessage() {} +func (*MsgPickFromBasketResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9e55200bd8b36dca, []int{7} +} +func (m *MsgPickFromBasketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgPickFromBasketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgPickFromBasketResponse.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 *MsgPickFromBasketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgPickFromBasketResponse.Merge(m, src) +} +func (m *MsgPickFromBasketResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgPickFromBasketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgPickFromBasketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgPickFromBasketResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateBasket)(nil), "regen.ecocredit.basket.v1beta1.MsgCreateBasket") + proto.RegisterType((*MsgCreateBasketResponse)(nil), "regen.ecocredit.basket.v1beta1.MsgCreateBasketResponse") + proto.RegisterType((*MsgAddToBasket)(nil), "regen.ecocredit.basket.v1beta1.MsgAddToBasket") + proto.RegisterType((*MsgAddToBasketResponse)(nil), "regen.ecocredit.basket.v1beta1.MsgAddToBasketResponse") + proto.RegisterType((*MsgTakeFromBasket)(nil), "regen.ecocredit.basket.v1beta1.MsgTakeFromBasket") + proto.RegisterType((*MsgTakeFromBasketResponse)(nil), "regen.ecocredit.basket.v1beta1.MsgTakeFromBasketResponse") + proto.RegisterType((*MsgPickFromBasket)(nil), "regen.ecocredit.basket.v1beta1.MsgPickFromBasket") + proto.RegisterType((*MsgPickFromBasketResponse)(nil), "regen.ecocredit.basket.v1beta1.MsgPickFromBasketResponse") +} + +func init() { + proto.RegisterFile("regen/ecocredit/basket/v1beta1/tx.proto", fileDescriptor_9e55200bd8b36dca) +} + +var fileDescriptor_9e55200bd8b36dca = []byte{ + // 610 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xae, 0x9b, 0xfe, 0x6e, 0xda, 0x54, 0xdd, 0xa2, 0x62, 0x82, 0x64, 0x85, 0x70, 0x68, 0x84, + 0xc0, 0x56, 0x8b, 0x04, 0x42, 0xe2, 0x40, 0x5b, 0xd4, 0x13, 0x41, 0xc8, 0xaa, 0x84, 0xd4, 0x8b, + 0xb5, 0xb6, 0x47, 0xc6, 0x8a, 0xbd, 0x6b, 0xad, 0xd7, 0x6d, 0x7a, 0xe1, 0x19, 0xe0, 0xc0, 0x5b, + 0xf0, 0x1a, 0x48, 0x1c, 0x7b, 0xe4, 0x88, 0xda, 0x77, 0xe0, 0x8c, 0xb2, 0xbb, 0x31, 0x71, 0x02, + 0x34, 0x51, 0x7b, 0xcb, 0xcc, 0x7c, 0xf3, 0xf3, 0x7d, 0x33, 0xce, 0xa2, 0x1d, 0x0e, 0x11, 0x50, + 0x07, 0x02, 0x16, 0x70, 0x08, 0x63, 0xe1, 0xf8, 0x24, 0xef, 0x81, 0x70, 0x4e, 0x77, 0x7d, 0x10, + 0x64, 0xd7, 0x11, 0x7d, 0x3b, 0xe3, 0x4c, 0x30, 0x6c, 0x49, 0xa0, 0x5d, 0x02, 0x6d, 0x05, 0xb4, + 0x35, 0xb0, 0xf9, 0xe8, 0xba, 0x42, 0xe7, 0x19, 0xe4, 0xaa, 0x56, 0xfb, 0xeb, 0x3c, 0xda, 0xe8, + 0xe6, 0xd1, 0x21, 0x07, 0x22, 0xe0, 0x40, 0xe2, 0xb0, 0x89, 0x96, 0x83, 0x82, 0x13, 0xc1, 0xb8, + 0x69, 0xb4, 0x8c, 0xce, 0xaa, 0x3b, 0x34, 0x31, 0x46, 0x0b, 0x94, 0xa4, 0x60, 0xce, 0x4b, 0xb7, + 0xfc, 0x8d, 0x1f, 0xa0, 0xb5, 0x30, 0xce, 0xb3, 0x84, 0x9c, 0x7b, 0x32, 0x56, 0x93, 0xb1, 0xba, + 0xf6, 0xbd, 0x1d, 0x40, 0x9a, 0x68, 0x05, 0xfa, 0x19, 0xa3, 0x40, 0x85, 0xb9, 0xd0, 0x32, 0x3a, + 0xeb, 0x6e, 0x69, 0xe3, 0xf7, 0x68, 0x43, 0x8d, 0xe7, 0x05, 0x3c, 0x16, 0xc0, 0x63, 0x62, 0x2e, + 0xb6, 0x6a, 0x9d, 0xfa, 0x9e, 0x6d, 0xff, 0x9f, 0xa6, 0xad, 0xa6, 0x3d, 0xd4, 0x59, 0x6e, 0xc3, + 0xaf, 0xd8, 0xd8, 0x46, 0x5b, 0x61, 0x9c, 0x13, 0x3f, 0x01, 0x8f, 0x14, 0x82, 0x79, 0x1c, 0x44, + 0xcc, 0xc1, 0x5c, 0x6a, 0x19, 0x9d, 0x15, 0x77, 0x53, 0x87, 0xf6, 0x0b, 0xc1, 0x5c, 0x19, 0xc0, + 0x0f, 0xd1, 0x3a, 0x49, 0x12, 0x76, 0xe6, 0x65, 0x71, 0xd0, 0x8b, 0x69, 0x64, 0x2e, 0x4b, 0xe4, + 0x9a, 0x74, 0xbe, 0x53, 0xbe, 0xf6, 0x4b, 0x74, 0x77, 0x4c, 0x2d, 0x17, 0xf2, 0x8c, 0xd1, 0x5c, + 0xea, 0xa0, 0x89, 0x84, 0x40, 0x59, 0xaa, 0xa5, 0xab, 0x2b, 0xdf, 0xeb, 0x81, 0xab, 0xfd, 0xd9, + 0x40, 0x8d, 0x6e, 0x1e, 0xed, 0x87, 0xe1, 0x31, 0xd3, 0x5a, 0xdf, 0x41, 0x8b, 0xec, 0x8c, 0xc2, + 0x50, 0x69, 0x65, 0x4c, 0xd4, 0x9a, 0x9f, 0xa8, 0x85, 0x8f, 0xd0, 0xb2, 0x92, 0x25, 0x37, 0x6b, + 0x52, 0xaf, 0xc7, 0xd3, 0xea, 0x35, 0x88, 0xb9, 0xc3, 0xe4, 0xf6, 0x3e, 0xda, 0xae, 0x8e, 0x54, + 0x12, 0xda, 0x41, 0x1b, 0x24, 0x65, 0x05, 0x15, 0x1e, 0x87, 0x00, 0xe2, 0x53, 0x08, 0xf5, 0x90, + 0x0d, 0xe5, 0x76, 0xb5, 0xb7, 0xfd, 0xc5, 0x40, 0x9b, 0xdd, 0x3c, 0x3a, 0x26, 0x3d, 0x38, 0xe2, + 0x2c, 0xbd, 0x29, 0xb3, 0x6d, 0xb4, 0xa4, 0x1a, 0xe8, 0x53, 0xd2, 0x16, 0x76, 0xd0, 0x96, 0xda, + 0x61, 0x0a, 0x54, 0x78, 0x09, 0x0b, 0x88, 0x88, 0x19, 0x95, 0x07, 0xb5, 0xea, 0xe2, 0x3f, 0xa1, + 0x37, 0x3a, 0xd2, 0x0e, 0xd0, 0xbd, 0x89, 0xb1, 0x4a, 0x76, 0x23, 0xfa, 0x19, 0x37, 0xd1, 0xef, + 0x9b, 0x22, 0x3f, 0x38, 0x90, 0xdb, 0x20, 0x7f, 0x4b, 0x6b, 0x9d, 0x5d, 0xac, 0xfb, 0x52, 0xac, + 0x2a, 0x8d, 0xa1, 0x58, 0x7b, 0xbf, 0x6a, 0xa8, 0xd6, 0xcd, 0x23, 0xdc, 0x47, 0x6b, 0x95, 0x7f, + 0x0a, 0xe7, 0xba, 0xe1, 0xc6, 0x3e, 0x96, 0xe6, 0xf3, 0x19, 0x13, 0xca, 0x75, 0x15, 0xa8, 0x3e, + 0xfa, 0xd9, 0xd8, 0x53, 0xd4, 0x19, 0xc1, 0x37, 0x9f, 0xcd, 0x86, 0x2f, 0xdb, 0x7e, 0x44, 0x8d, + 0xb1, 0xb3, 0xde, 0x9d, 0xa2, 0x52, 0x35, 0xa5, 0xf9, 0x62, 0xe6, 0x94, 0xd1, 0xfe, 0x63, 0x97, + 0x35, 0x4d, 0xff, 0x6a, 0xca, 0x54, 0xfd, 0xff, 0xbe, 0xf8, 0x83, 0x93, 0xef, 0x97, 0x96, 0x71, + 0x71, 0x69, 0x19, 0x3f, 0x2f, 0x2d, 0xe3, 0xd3, 0x95, 0x35, 0x77, 0x71, 0x65, 0xcd, 0xfd, 0xb8, + 0xb2, 0xe6, 0x4e, 0x5e, 0x45, 0xb1, 0xf8, 0x50, 0xf8, 0x76, 0xc0, 0x52, 0x47, 0x96, 0x7f, 0x42, + 0x41, 0x9c, 0x31, 0xde, 0xd3, 0x56, 0x02, 0x61, 0x04, 0xdc, 0xe9, 0xff, 0xf3, 0x19, 0xf2, 0x97, + 0xe4, 0x0b, 0xf4, 0xf4, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8b, 0xb5, 0x84, 0x37, 0xf8, 0x06, + 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // CreateBasket creates a bank denom which wraps credits. + CreateBasket(ctx context.Context, in *MsgCreateBasket, opts ...grpc.CallOption) (*MsgCreateBasketResponse, error) + // AddToBasket adds credits to a basket in return for basket tokens. + AddToBasket(ctx context.Context, in *MsgAddToBasket, opts ...grpc.CallOption) (*MsgAddToBasketResponse, error) + // TakeFromBasket takes credits from a basket without regard for which + // credits they are. The credits will be auto-retired if disable_auto_retire + // is false. Credits will be chosen randomly using the previous block hash + // as a consensus source of randomness. + // More concretely, the implementation is as follows: + // - take the previous block hash and convert it into an uint64, + // - given the total number of different credits within the basket `n`, the + // first credits that will get picked correspond to: hash modulo n (in + // terms of order), + // - then if we need to take more credits, we get some from the next one and + // so on. + TakeFromBasket(ctx context.Context, in *MsgTakeFromBasket, opts ...grpc.CallOption) (*MsgTakeFromBasketResponse, error) + // PickFromBasket picks specific credits from a basket. If allow_picking is + // set to false, then only an address which deposited credits in the basket + // can pick those credits. All other addresses will be blocked from picking + // those credits. The credits will be auto-retired if disable_auto_retire is + // false unless the credits were previously put into the basket by the + // address picking them from the basket, in which case they will remain + // tradable. This functionality allows the owner of a credit to have more + // control over the credits they are putting in baskets then ordinary users + // to deal with the scenario where basket tokens end up being worth + // significantly less than the credits on their own. + PickFromBasket(ctx context.Context, in *MsgPickFromBasket, opts ...grpc.CallOption) (*MsgPickFromBasketResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateBasket(ctx context.Context, in *MsgCreateBasket, opts ...grpc.CallOption) (*MsgCreateBasketResponse, error) { + out := new(MsgCreateBasketResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.basket.v1beta1.Msg/CreateBasket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) AddToBasket(ctx context.Context, in *MsgAddToBasket, opts ...grpc.CallOption) (*MsgAddToBasketResponse, error) { + out := new(MsgAddToBasketResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.basket.v1beta1.Msg/AddToBasket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) TakeFromBasket(ctx context.Context, in *MsgTakeFromBasket, opts ...grpc.CallOption) (*MsgTakeFromBasketResponse, error) { + out := new(MsgTakeFromBasketResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.basket.v1beta1.Msg/TakeFromBasket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) PickFromBasket(ctx context.Context, in *MsgPickFromBasket, opts ...grpc.CallOption) (*MsgPickFromBasketResponse, error) { + out := new(MsgPickFromBasketResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.basket.v1beta1.Msg/PickFromBasket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateBasket creates a bank denom which wraps credits. + CreateBasket(context.Context, *MsgCreateBasket) (*MsgCreateBasketResponse, error) + // AddToBasket adds credits to a basket in return for basket tokens. + AddToBasket(context.Context, *MsgAddToBasket) (*MsgAddToBasketResponse, error) + // TakeFromBasket takes credits from a basket without regard for which + // credits they are. The credits will be auto-retired if disable_auto_retire + // is false. Credits will be chosen randomly using the previous block hash + // as a consensus source of randomness. + // More concretely, the implementation is as follows: + // - take the previous block hash and convert it into an uint64, + // - given the total number of different credits within the basket `n`, the + // first credits that will get picked correspond to: hash modulo n (in + // terms of order), + // - then if we need to take more credits, we get some from the next one and + // so on. + TakeFromBasket(context.Context, *MsgTakeFromBasket) (*MsgTakeFromBasketResponse, error) + // PickFromBasket picks specific credits from a basket. If allow_picking is + // set to false, then only an address which deposited credits in the basket + // can pick those credits. All other addresses will be blocked from picking + // those credits. The credits will be auto-retired if disable_auto_retire is + // false unless the credits were previously put into the basket by the + // address picking them from the basket, in which case they will remain + // tradable. This functionality allows the owner of a credit to have more + // control over the credits they are putting in baskets then ordinary users + // to deal with the scenario where basket tokens end up being worth + // significantly less than the credits on their own. + PickFromBasket(context.Context, *MsgPickFromBasket) (*MsgPickFromBasketResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateBasket(ctx context.Context, req *MsgCreateBasket) (*MsgCreateBasketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBasket not implemented") +} +func (*UnimplementedMsgServer) AddToBasket(ctx context.Context, req *MsgAddToBasket) (*MsgAddToBasketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddToBasket not implemented") +} +func (*UnimplementedMsgServer) TakeFromBasket(ctx context.Context, req *MsgTakeFromBasket) (*MsgTakeFromBasketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TakeFromBasket not implemented") +} +func (*UnimplementedMsgServer) PickFromBasket(ctx context.Context, req *MsgPickFromBasket) (*MsgPickFromBasketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PickFromBasket not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateBasket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateBasket) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateBasket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.basket.v1beta1.Msg/CreateBasket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateBasket(ctx, req.(*MsgCreateBasket)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_AddToBasket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddToBasket) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddToBasket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.basket.v1beta1.Msg/AddToBasket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddToBasket(ctx, req.(*MsgAddToBasket)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_TakeFromBasket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTakeFromBasket) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TakeFromBasket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.basket.v1beta1.Msg/TakeFromBasket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TakeFromBasket(ctx, req.(*MsgTakeFromBasket)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_PickFromBasket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgPickFromBasket) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).PickFromBasket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.basket.v1beta1.Msg/PickFromBasket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).PickFromBasket(ctx, req.(*MsgPickFromBasket)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "regen.ecocredit.basket.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateBasket", + Handler: _Msg_CreateBasket_Handler, + }, + { + MethodName: "AddToBasket", + Handler: _Msg_AddToBasket_Handler, + }, + { + MethodName: "TakeFromBasket", + Handler: _Msg_TakeFromBasket_Handler, + }, + { + MethodName: "PickFromBasket", + Handler: _Msg_PickFromBasket_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "regen/ecocredit/basket/v1beta1/tx.proto", +} + +func (m *MsgCreateBasket) 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 *MsgCreateBasket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateBasket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AllowPicking { + i-- + if m.AllowPicking { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(m.BasketCriteria) > 0 { + for iNdEx := len(m.BasketCriteria) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BasketCriteria[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.Exponent != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x20 + } + if len(m.DisplayName) > 0 { + i -= len(m.DisplayName) + copy(dAtA[i:], m.DisplayName) + i = encodeVarintTx(dAtA, i, uint64(len(m.DisplayName))) + i-- + dAtA[i] = 0x1a + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Curator) > 0 { + i -= len(m.Curator) + copy(dAtA[i:], m.Curator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Curator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateBasketResponse) 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 *MsgCreateBasketResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateBasketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BasketDenom) > 0 { + i -= len(m.BasketDenom) + copy(dAtA[i:], m.BasketDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BasketDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddToBasket) 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 *MsgAddToBasket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddToBasket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Credits) > 0 { + for iNdEx := len(m.Credits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Credits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.BasketDenom) > 0 { + i -= len(m.BasketDenom) + copy(dAtA[i:], m.BasketDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BasketDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddToBasketResponse) 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 *MsgAddToBasketResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddToBasketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.AmountReceived) > 0 { + i -= len(m.AmountReceived) + copy(dAtA[i:], m.AmountReceived) + i = encodeVarintTx(dAtA, i, uint64(len(m.AmountReceived))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTakeFromBasket) 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 *MsgTakeFromBasket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTakeFromBasket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RetirementLocation) > 0 { + i -= len(m.RetirementLocation) + copy(dAtA[i:], m.RetirementLocation) + i = encodeVarintTx(dAtA, i, uint64(len(m.RetirementLocation))) + i-- + dAtA[i] = 0x22 + } + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintTx(dAtA, i, uint64(len(m.Amount))) + i-- + dAtA[i] = 0x1a + } + if len(m.BasketDenom) > 0 { + i -= len(m.BasketDenom) + copy(dAtA[i:], m.BasketDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BasketDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTakeFromBasketResponse) 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 *MsgTakeFromBasketResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTakeFromBasketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Credits) > 0 { + for iNdEx := len(m.Credits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Credits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgPickFromBasket) 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 *MsgPickFromBasket) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPickFromBasket) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RetirementLocation) > 0 { + i -= len(m.RetirementLocation) + copy(dAtA[i:], m.RetirementLocation) + i = encodeVarintTx(dAtA, i, uint64(len(m.RetirementLocation))) + i-- + dAtA[i] = 0x22 + } + if len(m.Credits) > 0 { + for iNdEx := len(m.Credits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Credits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.BasketDenom) > 0 { + i -= len(m.BasketDenom) + copy(dAtA[i:], m.BasketDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BasketDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgPickFromBasketResponse) 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 *MsgPickFromBasketResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgPickFromBasketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateBasket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Curator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DisplayName) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovTx(uint64(m.Exponent)) + } + if len(m.BasketCriteria) > 0 { + for _, e := range m.BasketCriteria { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if m.DisableAutoRetire { + n += 2 + } + if m.AllowPicking { + n += 2 + } + return n +} + +func (m *MsgCreateBasketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BasketDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgAddToBasket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BasketDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Credits) > 0 { + for _, e := range m.Credits { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgAddToBasketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AmountReceived) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgTakeFromBasket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BasketDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Amount) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.RetirementLocation) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgTakeFromBasketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Credits) > 0 { + for _, e := range m.Credits { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgPickFromBasket) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BasketDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Credits) > 0 { + for _, e := range m.Credits { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.RetirementLocation) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgPickFromBasketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateBasket) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateBasket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateBasket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Curator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Curator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisplayName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisplayName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + } + m.Exponent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exponent |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketCriteria", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketCriteria = append(m.BasketCriteria, &BasketCriteria{}) + if err := m.BasketCriteria[len(m.BasketCriteria)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowPicking", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllowPicking = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateBasketResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateBasketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateBasketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddToBasket) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddToBasket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddToBasket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Credits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Credits = append(m.Credits, &BasketCredit{}) + if err := m.Credits[len(m.Credits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddToBasketResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAddToBasketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddToBasketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AmountReceived", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AmountReceived = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTakeFromBasket) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTakeFromBasket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTakeFromBasket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetirementLocation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RetirementLocation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTakeFromBasketResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTakeFromBasketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTakeFromBasketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Credits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Credits = append(m.Credits, &BasketCredit{}) + if err := m.Credits[len(m.Credits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPickFromBasket) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgPickFromBasket: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPickFromBasket: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BasketDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BasketDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Credits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Credits = append(m.Credits, &BasketCredit{}) + if err := m.Credits[len(m.Credits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetirementLocation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RetirementLocation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgPickFromBasketResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgPickFromBasketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgPickFromBasketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/basket/v1beta1/types.pb.go b/x/ecocredit/basket/v1beta1/types.pb.go new file mode 100644 index 0000000000..d67ed18868 --- /dev/null +++ b/x/ecocredit/basket/v1beta1/types.pb.go @@ -0,0 +1,2291 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/basket/v1beta1/types.proto + +package v1beta1 + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// BasketCredit represents the information for a credit batch inside a basket. +type BasketCredit struct { + // batch_denom is the unique ID of the credit batch. + BatchDenom string `protobuf:"bytes,1,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + // tradable_amount is the number of credits in this transfer that can be + // traded by the recipient. Decimal values are acceptable within the + // precision returned by Query/Precision. + TradableAmount string `protobuf:"bytes,2,opt,name=tradable_amount,json=tradableAmount,proto3" json:"tradable_amount,omitempty"` +} + +func (m *BasketCredit) Reset() { *m = BasketCredit{} } +func (m *BasketCredit) String() string { return proto.CompactTextString(m) } +func (*BasketCredit) ProtoMessage() {} +func (*BasketCredit) Descriptor() ([]byte, []int) { + return fileDescriptor_685ac2fc3638ac99, []int{0} +} +func (m *BasketCredit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BasketCredit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BasketCredit.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 *BasketCredit) XXX_Merge(src proto.Message) { + xxx_messageInfo_BasketCredit.Merge(m, src) +} +func (m *BasketCredit) XXX_Size() int { + return m.Size() +} +func (m *BasketCredit) XXX_DiscardUnknown() { + xxx_messageInfo_BasketCredit.DiscardUnknown(m) +} + +var xxx_messageInfo_BasketCredit proto.InternalMessageInfo + +func (m *BasketCredit) GetBatchDenom() string { + if m != nil { + return m.BatchDenom + } + return "" +} + +func (m *BasketCredit) GetTradableAmount() string { + if m != nil { + return m.TradableAmount + } + return "" +} + +// BasketCriteria defines a criteria by which credits can be added to a basket. +type BasketCriteria struct { + // filter defines condition(s) that credits should satisfy in order to be + // added to the basket. + Filter *Filter `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` + // multiplier is an integer number which is applied to credit units when + // converting to basket units. For example if the multiplier is 2000, then + // 1.1 credits will result in 2200 basket tokens. If there are any fractional + // amounts left over in this calculation when adding credits to a basket, + // those fractional amounts will not get added to the basket. + Multiplier string `protobuf:"bytes,2,opt,name=multiplier,proto3" json:"multiplier,omitempty"` +} + +func (m *BasketCriteria) Reset() { *m = BasketCriteria{} } +func (m *BasketCriteria) String() string { return proto.CompactTextString(m) } +func (*BasketCriteria) ProtoMessage() {} +func (*BasketCriteria) Descriptor() ([]byte, []int) { + return fileDescriptor_685ac2fc3638ac99, []int{1} +} +func (m *BasketCriteria) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BasketCriteria) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BasketCriteria.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 *BasketCriteria) XXX_Merge(src proto.Message) { + xxx_messageInfo_BasketCriteria.Merge(m, src) +} +func (m *BasketCriteria) XXX_Size() int { + return m.Size() +} +func (m *BasketCriteria) XXX_DiscardUnknown() { + xxx_messageInfo_BasketCriteria.DiscardUnknown(m) +} + +var xxx_messageInfo_BasketCriteria proto.InternalMessageInfo + +func (m *BasketCriteria) GetFilter() *Filter { + if m != nil { + return m.Filter + } + return nil +} + +func (m *BasketCriteria) GetMultiplier() string { + if m != nil { + return m.Multiplier + } + return "" +} + +// Filter defines condition(s) that credits should satisfy in order to be added +// to the basket. It can handled nested conditions linked with and/or operators. +type Filter struct { + // sum is the oneof that specifies the type of filter. + // + // Types that are valid to be assigned to Sum: + // *Filter_And_ + // *Filter_Or_ + // *Filter_CreditTypeName + // *Filter_ClassId + // *Filter_ProjectId + // *Filter_BatchDenom + // *Filter_ClassAdmin + // *Filter_Issuer + // *Filter_Owner + // *Filter_ProjectLocation + // *Filter_DateRange_ + // *Filter_Tag + Sum isFilter_Sum `protobuf_oneof:"sum"` +} + +func (m *Filter) Reset() { *m = Filter{} } +func (m *Filter) String() string { return proto.CompactTextString(m) } +func (*Filter) ProtoMessage() {} +func (*Filter) Descriptor() ([]byte, []int) { + return fileDescriptor_685ac2fc3638ac99, []int{2} +} +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 + +type isFilter_Sum interface { + isFilter_Sum() + MarshalTo([]byte) (int, error) + Size() int +} + +type Filter_And_ struct { + And *Filter_And `protobuf:"bytes,1,opt,name=and,proto3,oneof" json:"and,omitempty"` +} +type Filter_Or_ struct { + Or *Filter_Or `protobuf:"bytes,2,opt,name=or,proto3,oneof" json:"or,omitempty"` +} +type Filter_CreditTypeName struct { + CreditTypeName string `protobuf:"bytes,3,opt,name=credit_type_name,json=creditTypeName,proto3,oneof" json:"credit_type_name,omitempty"` +} +type Filter_ClassId struct { + ClassId string `protobuf:"bytes,4,opt,name=class_id,json=classId,proto3,oneof" json:"class_id,omitempty"` +} +type Filter_ProjectId struct { + ProjectId string `protobuf:"bytes,5,opt,name=project_id,json=projectId,proto3,oneof" json:"project_id,omitempty"` +} +type Filter_BatchDenom struct { + BatchDenom string `protobuf:"bytes,6,opt,name=batch_denom,json=batchDenom,proto3,oneof" json:"batch_denom,omitempty"` +} +type Filter_ClassAdmin struct { + ClassAdmin string `protobuf:"bytes,7,opt,name=class_admin,json=classAdmin,proto3,oneof" json:"class_admin,omitempty"` +} +type Filter_Issuer struct { + Issuer string `protobuf:"bytes,8,opt,name=issuer,proto3,oneof" json:"issuer,omitempty"` +} +type Filter_Owner struct { + Owner string `protobuf:"bytes,9,opt,name=owner,proto3,oneof" json:"owner,omitempty"` +} +type Filter_ProjectLocation struct { + ProjectLocation string `protobuf:"bytes,10,opt,name=project_location,json=projectLocation,proto3,oneof" json:"project_location,omitempty"` +} +type Filter_DateRange_ struct { + DateRange *Filter_DateRange `protobuf:"bytes,11,opt,name=date_range,json=dateRange,proto3,oneof" json:"date_range,omitempty"` +} +type Filter_Tag struct { + Tag string `protobuf:"bytes,12,opt,name=tag,proto3,oneof" json:"tag,omitempty"` +} + +func (*Filter_And_) isFilter_Sum() {} +func (*Filter_Or_) isFilter_Sum() {} +func (*Filter_CreditTypeName) isFilter_Sum() {} +func (*Filter_ClassId) isFilter_Sum() {} +func (*Filter_ProjectId) isFilter_Sum() {} +func (*Filter_BatchDenom) isFilter_Sum() {} +func (*Filter_ClassAdmin) isFilter_Sum() {} +func (*Filter_Issuer) isFilter_Sum() {} +func (*Filter_Owner) isFilter_Sum() {} +func (*Filter_ProjectLocation) isFilter_Sum() {} +func (*Filter_DateRange_) isFilter_Sum() {} +func (*Filter_Tag) isFilter_Sum() {} + +func (m *Filter) GetSum() isFilter_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *Filter) GetAnd() *Filter_And { + if x, ok := m.GetSum().(*Filter_And_); ok { + return x.And + } + return nil +} + +func (m *Filter) GetOr() *Filter_Or { + if x, ok := m.GetSum().(*Filter_Or_); ok { + return x.Or + } + return nil +} + +func (m *Filter) GetCreditTypeName() string { + if x, ok := m.GetSum().(*Filter_CreditTypeName); ok { + return x.CreditTypeName + } + return "" +} + +func (m *Filter) GetClassId() string { + if x, ok := m.GetSum().(*Filter_ClassId); ok { + return x.ClassId + } + return "" +} + +func (m *Filter) GetProjectId() string { + if x, ok := m.GetSum().(*Filter_ProjectId); ok { + return x.ProjectId + } + return "" +} + +func (m *Filter) GetBatchDenom() string { + if x, ok := m.GetSum().(*Filter_BatchDenom); ok { + return x.BatchDenom + } + return "" +} + +func (m *Filter) GetClassAdmin() string { + if x, ok := m.GetSum().(*Filter_ClassAdmin); ok { + return x.ClassAdmin + } + return "" +} + +func (m *Filter) GetIssuer() string { + if x, ok := m.GetSum().(*Filter_Issuer); ok { + return x.Issuer + } + return "" +} + +func (m *Filter) GetOwner() string { + if x, ok := m.GetSum().(*Filter_Owner); ok { + return x.Owner + } + return "" +} + +func (m *Filter) GetProjectLocation() string { + if x, ok := m.GetSum().(*Filter_ProjectLocation); ok { + return x.ProjectLocation + } + return "" +} + +func (m *Filter) GetDateRange() *Filter_DateRange { + if x, ok := m.GetSum().(*Filter_DateRange_); ok { + return x.DateRange + } + return nil +} + +func (m *Filter) GetTag() string { + if x, ok := m.GetSum().(*Filter_Tag); ok { + return x.Tag + } + return "" +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Filter) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Filter_And_)(nil), + (*Filter_Or_)(nil), + (*Filter_CreditTypeName)(nil), + (*Filter_ClassId)(nil), + (*Filter_ProjectId)(nil), + (*Filter_BatchDenom)(nil), + (*Filter_ClassAdmin)(nil), + (*Filter_Issuer)(nil), + (*Filter_Owner)(nil), + (*Filter_ProjectLocation)(nil), + (*Filter_DateRange_)(nil), + (*Filter_Tag)(nil), + } +} + +// And specifies an "and" condition between the list of filters. +type Filter_And struct { + // filters is a list of filters where all conditions should be satisfied. + Filters []*Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` +} + +func (m *Filter_And) Reset() { *m = Filter_And{} } +func (m *Filter_And) String() string { return proto.CompactTextString(m) } +func (*Filter_And) ProtoMessage() {} +func (*Filter_And) Descriptor() ([]byte, []int) { + return fileDescriptor_685ac2fc3638ac99, []int{2, 0} +} +func (m *Filter_And) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Filter_And) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Filter_And.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_And) XXX_Merge(src proto.Message) { + xxx_messageInfo_Filter_And.Merge(m, src) +} +func (m *Filter_And) XXX_Size() int { + return m.Size() +} +func (m *Filter_And) XXX_DiscardUnknown() { + xxx_messageInfo_Filter_And.DiscardUnknown(m) +} + +var xxx_messageInfo_Filter_And proto.InternalMessageInfo + +func (m *Filter_And) GetFilters() []*Filter { + if m != nil { + return m.Filters + } + return nil +} + +// And specifies an "or" condition between the list of filters. +type Filter_Or struct { + // filters is a list of filters where at least one of the conditions should be satisfied. + Filters []*Filter `protobuf:"bytes,1,rep,name=filters,proto3" json:"filters,omitempty"` +} + +func (m *Filter_Or) Reset() { *m = Filter_Or{} } +func (m *Filter_Or) String() string { return proto.CompactTextString(m) } +func (*Filter_Or) ProtoMessage() {} +func (*Filter_Or) Descriptor() ([]byte, []int) { + return fileDescriptor_685ac2fc3638ac99, []int{2, 1} +} +func (m *Filter_Or) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Filter_Or) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Filter_Or.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_Or) XXX_Merge(src proto.Message) { + xxx_messageInfo_Filter_Or.Merge(m, src) +} +func (m *Filter_Or) XXX_Size() int { + return m.Size() +} +func (m *Filter_Or) XXX_DiscardUnknown() { + xxx_messageInfo_Filter_Or.DiscardUnknown(m) +} + +var xxx_messageInfo_Filter_Or proto.InternalMessageInfo + +func (m *Filter_Or) GetFilters() []*Filter { + if m != nil { + return m.Filters + } + return nil +} + +// DateRange defines a period for credit batches in a basket. +type Filter_DateRange struct { + // start_date is the beginning of the period during which this credit batch + // was quantified and verified. If it is empty then there is no start date + // limit. + StartDate *time.Time `protobuf:"bytes,7,opt,name=start_date,json=startDate,proto3,stdtime" json:"start_date,omitempty"` + // end_date is the end of the period during which this credit batch was + // quantified and verified. If it is empty then there is no end date + // limit. + EndDate *time.Time `protobuf:"bytes,8,opt,name=end_date,json=endDate,proto3,stdtime" json:"end_date,omitempty"` +} + +func (m *Filter_DateRange) Reset() { *m = Filter_DateRange{} } +func (m *Filter_DateRange) String() string { return proto.CompactTextString(m) } +func (*Filter_DateRange) ProtoMessage() {} +func (*Filter_DateRange) Descriptor() ([]byte, []int) { + return fileDescriptor_685ac2fc3638ac99, []int{2, 2} +} +func (m *Filter_DateRange) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Filter_DateRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Filter_DateRange.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_DateRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_Filter_DateRange.Merge(m, src) +} +func (m *Filter_DateRange) XXX_Size() int { + return m.Size() +} +func (m *Filter_DateRange) XXX_DiscardUnknown() { + xxx_messageInfo_Filter_DateRange.DiscardUnknown(m) +} + +var xxx_messageInfo_Filter_DateRange proto.InternalMessageInfo + +func (m *Filter_DateRange) GetStartDate() *time.Time { + if m != nil { + return m.StartDate + } + return nil +} + +func (m *Filter_DateRange) GetEndDate() *time.Time { + if m != nil { + return m.EndDate + } + return nil +} + +func init() { + proto.RegisterType((*BasketCredit)(nil), "regen.ecocredit.basket.v1beta1.BasketCredit") + proto.RegisterType((*BasketCriteria)(nil), "regen.ecocredit.basket.v1beta1.BasketCriteria") + proto.RegisterType((*Filter)(nil), "regen.ecocredit.basket.v1beta1.Filter") + proto.RegisterType((*Filter_And)(nil), "regen.ecocredit.basket.v1beta1.Filter.And") + proto.RegisterType((*Filter_Or)(nil), "regen.ecocredit.basket.v1beta1.Filter.Or") + proto.RegisterType((*Filter_DateRange)(nil), "regen.ecocredit.basket.v1beta1.Filter.DateRange") +} + +func init() { + proto.RegisterFile("regen/ecocredit/basket/v1beta1/types.proto", fileDescriptor_685ac2fc3638ac99) +} + +var fileDescriptor_685ac2fc3638ac99 = []byte{ + // 607 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x4e, 0xdc, 0x3a, + 0x14, 0x9e, 0xcc, 0xc0, 0xfc, 0x9c, 0x41, 0x80, 0xac, 0xab, 0xab, 0x68, 0xae, 0x94, 0x01, 0x16, + 0xf7, 0xde, 0x52, 0x35, 0x29, 0x74, 0x89, 0x44, 0x99, 0x29, 0xa2, 0x20, 0x55, 0x45, 0x8d, 0x58, + 0x54, 0x6c, 0x22, 0x27, 0x3e, 0x84, 0x94, 0xc4, 0x8e, 0x1c, 0x4f, 0x29, 0x8f, 0xd0, 0x1d, 0x6f, + 0xd0, 0xd7, 0xe9, 0x92, 0x65, 0x77, 0xad, 0xe0, 0x45, 0x2a, 0x3b, 0x0e, 0xa2, 0x8b, 0x56, 0x53, + 0xa9, 0xbb, 0x9c, 0xef, 0xe7, 0xfc, 0xf8, 0xd8, 0x81, 0x4d, 0x89, 0x29, 0xf2, 0x00, 0x13, 0x91, + 0x48, 0x64, 0x99, 0x0a, 0x62, 0x5a, 0x5d, 0xa0, 0x0a, 0xde, 0x6f, 0xc5, 0xa8, 0xe8, 0x56, 0xa0, + 0xae, 0x4a, 0xac, 0xfc, 0x52, 0x0a, 0x25, 0x88, 0x67, 0xb4, 0xfe, 0xbd, 0xd6, 0xaf, 0xb5, 0xbe, + 0xd5, 0x8e, 0xfe, 0x4a, 0x45, 0x2a, 0x8c, 0x34, 0xd0, 0x5f, 0xb5, 0x6b, 0x34, 0x4e, 0x85, 0x48, + 0x73, 0x0c, 0x4c, 0x14, 0xcf, 0xce, 0x02, 0x95, 0x15, 0x58, 0x29, 0x5a, 0x94, 0xb5, 0x60, 0xe3, + 0x2d, 0x2c, 0x4d, 0x4d, 0xa2, 0x17, 0x26, 0x2b, 0x19, 0xc3, 0x30, 0xa6, 0x2a, 0x39, 0x8f, 0x18, + 0x72, 0x51, 0xb8, 0xce, 0x9a, 0xf3, 0xff, 0x20, 0x04, 0x03, 0xed, 0x6b, 0x84, 0xfc, 0x07, 0x2b, + 0x4a, 0x52, 0x46, 0xe3, 0x1c, 0x23, 0x5a, 0x88, 0x19, 0x57, 0x6e, 0xdb, 0x88, 0x96, 0x1b, 0x78, + 0x62, 0xd0, 0x8d, 0x12, 0x96, 0x9b, 0xcc, 0x99, 0x42, 0x99, 0x51, 0xb2, 0x0b, 0xdd, 0xb3, 0x2c, + 0x57, 0x28, 0x4d, 0xda, 0xe1, 0xf6, 0xbf, 0xfe, 0xaf, 0x67, 0xf2, 0x0f, 0x8c, 0x3a, 0xb4, 0x2e, + 0xe2, 0x01, 0x14, 0xb3, 0x5c, 0x65, 0x65, 0x9e, 0xa1, 0xb4, 0x55, 0x1f, 0x20, 0x1b, 0x9f, 0xba, + 0xd0, 0xad, 0x2d, 0x64, 0x17, 0x3a, 0x94, 0x33, 0x5b, 0x67, 0x73, 0xbe, 0x3a, 0xfe, 0x84, 0xb3, + 0xc3, 0x56, 0xa8, 0x8d, 0x64, 0x07, 0xda, 0xa2, 0x2e, 0x31, 0xdc, 0x7e, 0x34, 0xa7, 0xfd, 0x58, + 0x1e, 0xb6, 0xc2, 0xb6, 0x90, 0x64, 0x13, 0x56, 0x6b, 0x61, 0xa4, 0x17, 0x18, 0x71, 0x5a, 0xa0, + 0xdb, 0xd1, 0xdd, 0x1e, 0xb6, 0xc2, 0xe5, 0x9a, 0x39, 0xb9, 0x2a, 0xf1, 0x35, 0x2d, 0x90, 0xfc, + 0x03, 0xfd, 0x24, 0xa7, 0x55, 0x15, 0x65, 0xcc, 0x5d, 0xb0, 0x9a, 0x9e, 0x41, 0x8e, 0x18, 0x19, + 0x03, 0x94, 0x52, 0xbc, 0xc3, 0x44, 0x69, 0x7a, 0xd1, 0xd2, 0x03, 0x8b, 0x1d, 0x31, 0xb2, 0xfe, + 0xe3, 0xb6, 0xba, 0x56, 0xf1, 0x70, 0x5f, 0xeb, 0x30, 0xac, 0x0b, 0x50, 0x56, 0x64, 0xdc, 0xed, + 0x35, 0x12, 0x03, 0x4e, 0x34, 0x46, 0x5c, 0xe8, 0x66, 0x55, 0x35, 0x43, 0xe9, 0xf6, 0x2d, 0x6b, + 0x63, 0xf2, 0x37, 0x2c, 0x8a, 0x4b, 0x8e, 0xd2, 0x1d, 0x58, 0xa2, 0x0e, 0xc9, 0x63, 0x58, 0x6d, + 0x1a, 0xcb, 0x45, 0x42, 0x55, 0x26, 0xb8, 0x0b, 0x56, 0xb2, 0x62, 0x99, 0x57, 0x96, 0x20, 0x6f, + 0x00, 0x18, 0x55, 0x18, 0x49, 0xca, 0x53, 0x74, 0x87, 0xe6, 0x4c, 0x9f, 0xce, 0x79, 0xa6, 0xfb, + 0x54, 0x61, 0xa8, 0x7d, 0x7a, 0x6e, 0xd6, 0x04, 0x84, 0x40, 0x47, 0xd1, 0xd4, 0x5d, 0xb2, 0x25, + 0x75, 0x30, 0x7a, 0x09, 0x9d, 0x09, 0x67, 0x64, 0x0f, 0x7a, 0xf5, 0x75, 0xa9, 0x5c, 0x67, 0xad, + 0xf3, 0x1b, 0xb7, 0xac, 0xb1, 0x8d, 0x0e, 0xa0, 0x7d, 0x2c, 0xff, 0x40, 0x9e, 0x8f, 0x0e, 0x0c, + 0xee, 0xfb, 0x27, 0xcf, 0x01, 0x2a, 0x45, 0xa5, 0x8a, 0xf4, 0x14, 0x66, 0x0d, 0xc3, 0xed, 0x91, + 0x5f, 0x3f, 0x4f, 0xbf, 0x79, 0x9e, 0xfe, 0x49, 0xf3, 0x3c, 0xa7, 0x0b, 0xd7, 0x5f, 0xc7, 0x4e, + 0x38, 0x30, 0x1e, 0x9d, 0x85, 0xec, 0x40, 0x1f, 0x39, 0xab, 0xed, 0xfd, 0x39, 0xed, 0x3d, 0xe4, + 0x4c, 0x9b, 0xa7, 0x8b, 0xd0, 0xa9, 0x66, 0xc5, 0xf4, 0xf4, 0xf3, 0xad, 0xe7, 0xdc, 0xdc, 0x7a, + 0xce, 0xb7, 0x5b, 0xcf, 0xb9, 0xbe, 0xf3, 0x5a, 0x37, 0x77, 0x5e, 0xeb, 0xcb, 0x9d, 0xd7, 0x3a, + 0xdd, 0x4b, 0x33, 0x75, 0x3e, 0x8b, 0xfd, 0x44, 0x14, 0x81, 0x99, 0xf3, 0x09, 0x47, 0x75, 0x29, + 0xe4, 0x85, 0x8d, 0x72, 0x64, 0x29, 0xca, 0xe0, 0xc3, 0x4f, 0x7f, 0x56, 0x71, 0xd7, 0x74, 0xf1, + 0xec, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xba, 0x40, 0x92, 0x11, 0xd5, 0x04, 0x00, 0x00, +} + +func (m *BasketCredit) 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 *BasketCredit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BasketCredit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TradableAmount) > 0 { + i -= len(m.TradableAmount) + copy(dAtA[i:], m.TradableAmount) + i = encodeVarintTypes(dAtA, i, uint64(len(m.TradableAmount))) + i-- + dAtA[i] = 0x12 + } + if len(m.BatchDenom) > 0 { + i -= len(m.BatchDenom) + copy(dAtA[i:], m.BatchDenom) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BatchDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BasketCriteria) 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 *BasketCriteria) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BasketCriteria) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Multiplier) > 0 { + i -= len(m.Multiplier) + copy(dAtA[i:], m.Multiplier) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Multiplier))) + i-- + dAtA[i] = 0x12 + } + if m.Filter != nil { + { + size, err := m.Filter.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) 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 m.Sum != nil { + { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *Filter_And_) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_And_) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.And != nil { + { + size, err := m.And.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_Or_) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_Or_) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Or != nil { + { + size, err := m.Or.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_CreditTypeName) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_CreditTypeName) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.CreditTypeName) + copy(dAtA[i:], m.CreditTypeName) + i = encodeVarintTypes(dAtA, i, uint64(len(m.CreditTypeName))) + i-- + dAtA[i] = 0x1a + return len(dAtA) - i, nil +} +func (m *Filter_ClassId) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_ClassId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x22 + return len(dAtA) - i, nil +} +func (m *Filter_ProjectId) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_ProjectId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.ProjectId) + copy(dAtA[i:], m.ProjectId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ProjectId))) + i-- + dAtA[i] = 0x2a + return len(dAtA) - i, nil +} +func (m *Filter_BatchDenom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_BatchDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.BatchDenom) + copy(dAtA[i:], m.BatchDenom) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BatchDenom))) + i-- + dAtA[i] = 0x32 + return len(dAtA) - i, nil +} +func (m *Filter_ClassAdmin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_ClassAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.ClassAdmin) + copy(dAtA[i:], m.ClassAdmin) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ClassAdmin))) + i-- + dAtA[i] = 0x3a + return len(dAtA) - i, nil +} +func (m *Filter_Issuer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_Issuer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Issuer) + copy(dAtA[i:], m.Issuer) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Issuer))) + i-- + dAtA[i] = 0x42 + return len(dAtA) - i, nil +} +func (m *Filter_Owner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_Owner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x4a + return len(dAtA) - i, nil +} +func (m *Filter_ProjectLocation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_ProjectLocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.ProjectLocation) + copy(dAtA[i:], m.ProjectLocation) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ProjectLocation))) + i-- + dAtA[i] = 0x52 + return len(dAtA) - i, nil +} +func (m *Filter_DateRange_) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_DateRange_) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.DateRange != nil { + { + size, err := m.DateRange.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + return len(dAtA) - i, nil +} +func (m *Filter_Tag) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_Tag) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Tag) + copy(dAtA[i:], m.Tag) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Tag))) + i-- + dAtA[i] = 0x62 + return len(dAtA) - i, nil +} +func (m *Filter_And) 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_And) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_And) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[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_Or) 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_Or) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_Or) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Filters) > 0 { + for iNdEx := len(m.Filters) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Filters[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_DateRange) 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_DateRange) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Filter_DateRange) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.EndDate != nil { + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.EndDate, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndDate):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTypes(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x42 + } + if m.StartDate != nil { + n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.StartDate, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartDate):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintTypes(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x3a + } + 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 *BasketCredit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BatchDenom) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.TradableAmount) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *BasketCriteria) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Filter != nil { + l = m.Filter.Size() + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Multiplier) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + return n +} + +func (m *Filter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *Filter_And_) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.And != nil { + l = m.And.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Filter_Or_) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Or != nil { + l = m.Or.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Filter_CreditTypeName) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.CreditTypeName) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_ClassId) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_ProjectId) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProjectId) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_BatchDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BatchDenom) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_ClassAdmin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassAdmin) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_Issuer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Issuer) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_Owner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_ProjectLocation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProjectLocation) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_DateRange_) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DateRange != nil { + l = m.DateRange.Size() + n += 1 + l + sovTypes(uint64(l)) + } + return n +} +func (m *Filter_Tag) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Tag) + n += 1 + l + sovTypes(uint64(l)) + return n +} +func (m *Filter_And) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Filter_Or) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Filters) > 0 { + for _, e := range m.Filters { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *Filter_DateRange) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StartDate != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.StartDate) + n += 1 + l + sovTypes(uint64(l)) + } + if m.EndDate != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.EndDate) + 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 *BasketCredit) 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: BasketCredit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BasketCredit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", 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.BatchDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TradableAmount", 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.TradableAmount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BasketCriteria) 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: BasketCriteria: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BasketCriteria: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", 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.Filter == nil { + m.Filter = &Filter{} + } + if err := m.Filter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Multiplier", 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.Multiplier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (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) 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 And", 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 := &Filter_And{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Filter_And_{v} + iNdEx = postIndex + case 2: + 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 + } + v := &Filter_Or{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Filter_Or_{v} + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreditTypeName", 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.Sum = &Filter_CreditTypeName{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", 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.Sum = &Filter_ClassId{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProjectId", 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.Sum = &Filter_ProjectId{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", 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.Sum = &Filter_BatchDenom{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassAdmin", 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.Sum = &Filter_ClassAdmin{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Issuer", 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.Sum = &Filter_Issuer{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Sum = &Filter_Owner{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", 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.Sum = &Filter_ProjectLocation{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DateRange", 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 := &Filter_DateRange{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &Filter_DateRange_{v} + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tag", 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.Sum = &Filter_Tag{string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (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_And) 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: And: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: And: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", 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.Filters = append(m.Filters, &Filter{}) + if err := m.Filters[len(m.Filters)-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 { + return ErrInvalidLengthTypes + } + if (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_Or) 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: Or: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Or: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", 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.Filters = append(m.Filters, &Filter{}) + if err := m.Filters[len(m.Filters)-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 { + return ErrInvalidLengthTypes + } + if (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_DateRange) 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: DateRange: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DateRange: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StartDate", 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.StartDate == nil { + m.StartDate = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.StartDate, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EndDate", 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.EndDate == nil { + m.EndDate = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.EndDate, 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 { + return ErrInvalidLengthTypes + } + if (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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/denom.go b/x/ecocredit/denom.go index 0622115bae..2f64e93952 100644 --- a/x/ecocredit/denom.go +++ b/x/ecocredit/denom.go @@ -3,10 +3,11 @@ package ecocredit import ( "fmt" "regexp" + "strings" "time" ) -// Calculate the ID to use for a new credit class, based on the credit type and +// FormatClassID formats the ID to use for a new credit class, based on the credit type and // sequence number. This format may evolve over time, but will maintain // backwards compatibility. // @@ -16,7 +17,7 @@ func FormatClassID(creditType CreditType, classSeqNo uint64) string { return fmt.Sprintf("%s%02d", creditType.Abbreviation, classSeqNo) } -// Calculate the denomination to use for a batch, based on the batch +// FormatDenom formats the denomination to use for a batch, based on the batch // information. This format may evolve over time, but will maintain backwards // compatibility. // @@ -57,7 +58,7 @@ var ( reFullBatchDenom = regexp.MustCompile(fmt.Sprintf(`^%s$`, ReBatchDenom)) ) -// Validate a class ID conforms to the format described in FormatClassID. The +// ValidateClassID validates a class ID conforms to the format described in FormatClassID. The // return is nil if the ID is valid. func ValidateClassID(classId string) error { matches := reFullClassID.FindStringSubmatch(classId) @@ -67,7 +68,7 @@ func ValidateClassID(classId string) error { return nil } -// Validate a batch denomination conforms to the format described in +// ValidateDenom validates a batch denomination conforms to the format described in // FormatDenom. The return is nil if the denom is valid. func ValidateDenom(denom string) error { matches := reFullBatchDenom.FindStringSubmatch(denom) @@ -76,3 +77,16 @@ func ValidateDenom(denom string) error { } return nil } + +// GetClassIdFromBatchDenom returns the classID in a batch denom +func GetClassIdFromBatchDenom(denom string) string { + var s strings.Builder + for _, r := range denom { + if r != '-' { + s.WriteRune(r) + continue + } + break + } + return s.String() +} diff --git a/x/ecocredit/go.mod b/x/ecocredit/go.mod index 94dc17436e..eeaccee40e 100644 --- a/x/ecocredit/go.mod +++ b/x/ecocredit/go.mod @@ -4,6 +4,7 @@ go 1.17 require ( github.com/cosmos/cosmos-sdk v0.44.2 + github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 @@ -19,6 +20,7 @@ require ( github.com/tendermint/tm-db v0.6.6 google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb google.golang.org/grpc v1.44.0 + google.golang.org/protobuf v1.27.1 pgregory.net/rapid v0.4.7 sigs.k8s.io/yaml v1.1.0 ) @@ -39,7 +41,6 @@ require ( github.com/coinbase/rosetta-sdk-go v0.6.10 // indirect github.com/confio/ics23/go v0.6.6 // indirect github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect - github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 // indirect github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/iavl v0.17.1 // indirect @@ -118,7 +119,6 @@ require ( golang.org/x/sys v0.0.0-20210903071746-97244b99971b // indirect golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect golang.org/x/text v0.3.6 // indirect - google.golang.org/protobuf v1.27.1 // indirect gopkg.in/ini.v1 v1.62.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect diff --git a/x/ecocredit/go.sum b/x/ecocredit/go.sum index 72243c98e4..48f1b00ae9 100644 --- a/x/ecocredit/go.sum +++ b/x/ecocredit/go.sum @@ -220,17 +220,12 @@ github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a/go.mod h1:F5haX7 github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/cosmos-proto v1.0.0-alpha6/go.mod h1:msdDWOvfStHLG+Z2y2SJ0dcqimZ2vc8M1MPnZ4jOF7U= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3 h1:tqpedvX/1UgQyX3W2hlW6Xg801FyojYT/NOHbW0oG+s= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3/go.mod h1:Ht15guGn9F8b0lv8NkjXE9/asAvVUOt2n4gvQ4q5MyU= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 h1:z2si9sQNUTj2jw+24SujuUxcoNS3TVga/fdYsS4rJII= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.6 h1:ZfS4+Vf+zdX3ABGmThHSJt9KTOOIxCxGg8mbob7JbUw= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.6/go.mod h1:pH7cqdUlm/zbtGUxlg9Lf/KL8poW4N9HkSN1AKAwRKk= github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7 h1:pDxU4OFliJjQ22Tqf9kCfPZFtJla/yfGnV6EojVw+d8= github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7/go.mod h1:woV5EBAWmTaXKs7YXioQsYheXSZkmZIgLPq+Koi/GB8= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= @@ -1594,8 +1589,7 @@ google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1610,7 +1604,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/x/ecocredit/marketplace/v1beta1/events.pb.go b/x/ecocredit/marketplace/v1beta1/events.pb.go new file mode 100644 index 0000000000..46137921e2 --- /dev/null +++ b/x/ecocredit/marketplace/v1beta1/events.pb.go @@ -0,0 +1,2233 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/marketplace/v1beta1/events.proto + +package v1beta1 + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// EventSell is an event emitted when a sell order is created. +type EventSell struct { + // order_id is the unique ID of sell order. + OrderId uint64 `protobuf:"varint,1,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"` + // batch_denom is the credit batch being sold. + BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + // quantity is the quantity of credits being sold. + Quantity string `protobuf:"bytes,3,opt,name=quantity,proto3" json:"quantity,omitempty"` + // ask_price is the price the seller is asking for each unit of the + // batch_denom. Each credit unit of the batch will be sold for at least the + // ask_price or more. + AskPrice *types.Coin `protobuf:"bytes,4,opt,name=ask_price,json=askPrice,proto3" json:"ask_price,omitempty"` + // disable_auto_retire disables auto-retirement of credits which allows a + // buyer to disable auto-retirement in their buy order enabling them to + // resell the credits to another buyer. + DisableAutoRetire bool `protobuf:"varint,5,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // expiration is an optional timestamp when the sell order expires. When the + // expiration time is reached, the sell order is removed from state. + Expiration *time.Time `protobuf:"bytes,6,opt,name=expiration,proto3,stdtime" json:"expiration,omitempty"` +} + +func (m *EventSell) Reset() { *m = EventSell{} } +func (m *EventSell) String() string { return proto.CompactTextString(m) } +func (*EventSell) ProtoMessage() {} +func (*EventSell) Descriptor() ([]byte, []int) { + return fileDescriptor_c64cc204b7516f6a, []int{0} +} +func (m *EventSell) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventSell) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventSell.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 *EventSell) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventSell.Merge(m, src) +} +func (m *EventSell) XXX_Size() int { + return m.Size() +} +func (m *EventSell) XXX_DiscardUnknown() { + xxx_messageInfo_EventSell.DiscardUnknown(m) +} + +var xxx_messageInfo_EventSell proto.InternalMessageInfo + +func (m *EventSell) GetOrderId() uint64 { + if m != nil { + return m.OrderId + } + return 0 +} + +func (m *EventSell) GetBatchDenom() string { + if m != nil { + return m.BatchDenom + } + return "" +} + +func (m *EventSell) GetQuantity() string { + if m != nil { + return m.Quantity + } + return "" +} + +func (m *EventSell) GetAskPrice() *types.Coin { + if m != nil { + return m.AskPrice + } + return nil +} + +func (m *EventSell) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *EventSell) GetExpiration() *time.Time { + if m != nil { + return m.Expiration + } + return nil +} + +// EventUpdateSellOrder is an event emitted when a sell order is updated. +type EventUpdateSellOrder struct { + // owner is the owner of the sell orders. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // sell_order_id is the ID of an existing sell order. + SellOrderId uint64 `protobuf:"varint,2,opt,name=sell_order_id,json=sellOrderId,proto3" json:"sell_order_id,omitempty"` + // batch_denom is the credit batch being sold. + BatchDenom string `protobuf:"bytes,3,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + // new_quantity is the updated quantity of credits available to sell, if it + // is set to zero then the order is cancelled. + NewQuantity string `protobuf:"bytes,4,opt,name=new_quantity,json=newQuantity,proto3" json:"new_quantity,omitempty"` + // new_ask_price is the new ask price for this sell order + NewAskPrice *types.Coin `protobuf:"bytes,5,opt,name=new_ask_price,json=newAskPrice,proto3" json:"new_ask_price,omitempty"` + // disable_auto_retire updates the disable_auto_retire field in the sell order. + DisableAutoRetire bool `protobuf:"varint,6,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // new_expiration is an optional timestamp when the sell order expires. When the + // expiration time is reached, the sell order is removed from state. + NewExpiration *time.Time `protobuf:"bytes,7,opt,name=new_expiration,json=newExpiration,proto3,stdtime" json:"new_expiration,omitempty"` +} + +func (m *EventUpdateSellOrder) Reset() { *m = EventUpdateSellOrder{} } +func (m *EventUpdateSellOrder) String() string { return proto.CompactTextString(m) } +func (*EventUpdateSellOrder) ProtoMessage() {} +func (*EventUpdateSellOrder) Descriptor() ([]byte, []int) { + return fileDescriptor_c64cc204b7516f6a, []int{1} +} +func (m *EventUpdateSellOrder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventUpdateSellOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventUpdateSellOrder.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 *EventUpdateSellOrder) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventUpdateSellOrder.Merge(m, src) +} +func (m *EventUpdateSellOrder) XXX_Size() int { + return m.Size() +} +func (m *EventUpdateSellOrder) XXX_DiscardUnknown() { + xxx_messageInfo_EventUpdateSellOrder.DiscardUnknown(m) +} + +var xxx_messageInfo_EventUpdateSellOrder proto.InternalMessageInfo + +func (m *EventUpdateSellOrder) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *EventUpdateSellOrder) GetSellOrderId() uint64 { + if m != nil { + return m.SellOrderId + } + return 0 +} + +func (m *EventUpdateSellOrder) GetBatchDenom() string { + if m != nil { + return m.BatchDenom + } + return "" +} + +func (m *EventUpdateSellOrder) GetNewQuantity() string { + if m != nil { + return m.NewQuantity + } + return "" +} + +func (m *EventUpdateSellOrder) GetNewAskPrice() *types.Coin { + if m != nil { + return m.NewAskPrice + } + return nil +} + +func (m *EventUpdateSellOrder) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *EventUpdateSellOrder) GetNewExpiration() *time.Time { + if m != nil { + return m.NewExpiration + } + return nil +} + +// EventBuyOrderCreated is an event emitted when a buy order is created. +type EventBuyOrderCreated struct { + // buy_order_id is the unique ID of buy order. + BuyOrderId uint64 `protobuf:"varint,1,opt,name=buy_order_id,json=buyOrderId,proto3" json:"buy_order_id,omitempty"` + // sell_order_id is the sell order ID against which the buyer is trying to buy. + SellOrderId uint64 `protobuf:"varint,2,opt,name=sell_order_id,json=sellOrderId,proto3" json:"sell_order_id,omitempty"` + // quantity is the quantity of credits to buy. If the quantity of credits + // available is less than this amount the order will be partially filled + // unless disable_partial_fill is true. + Quantity string `protobuf:"bytes,3,opt,name=quantity,proto3" json:"quantity,omitempty"` + // bid price is the bid price for this buy order. A credit unit will be + // settled at a purchase price that is no more than the bid price. The + // buy order will fail if the buyer does not have enough funds available + // to complete the purchase. + BidPrice *types.Coin `protobuf:"bytes,4,opt,name=bid_price,json=bidPrice,proto3" json:"bid_price,omitempty"` + // disable_auto_retire allows auto-retirement to be disabled. If it is set to true + // the credits will not auto-retire and can be resold assuming that the + // corresponding sell order has auto-retirement disabled. If the sell order + // hasn't disabled auto-retirement and the buy order tries to disable it, + // that buy order will fail. + DisableAutoRetire bool `protobuf:"varint,5,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // disable_partial_fill disables the default behavior of partially filling + // buy orders if the requested quantity is not available. + DisablePartialFill bool `protobuf:"varint,6,opt,name=disable_partial_fill,json=disablePartialFill,proto3" json:"disable_partial_fill,omitempty"` + // retirement_location is the optional retirement location for the credits + // which will be used only if disable_auto_retire is false. + RetirementLocation string `protobuf:"bytes,7,opt,name=retirement_location,json=retirementLocation,proto3" json:"retirement_location,omitempty"` + // expiration is the optional timestamp when the buy order expires. When the + // expiration time is reached, the buy order is removed from state. + Expiration *time.Time `protobuf:"bytes,8,opt,name=expiration,proto3,stdtime" json:"expiration,omitempty"` +} + +func (m *EventBuyOrderCreated) Reset() { *m = EventBuyOrderCreated{} } +func (m *EventBuyOrderCreated) String() string { return proto.CompactTextString(m) } +func (*EventBuyOrderCreated) ProtoMessage() {} +func (*EventBuyOrderCreated) Descriptor() ([]byte, []int) { + return fileDescriptor_c64cc204b7516f6a, []int{2} +} +func (m *EventBuyOrderCreated) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBuyOrderCreated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBuyOrderCreated.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 *EventBuyOrderCreated) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBuyOrderCreated.Merge(m, src) +} +func (m *EventBuyOrderCreated) XXX_Size() int { + return m.Size() +} +func (m *EventBuyOrderCreated) XXX_DiscardUnknown() { + xxx_messageInfo_EventBuyOrderCreated.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBuyOrderCreated proto.InternalMessageInfo + +func (m *EventBuyOrderCreated) GetBuyOrderId() uint64 { + if m != nil { + return m.BuyOrderId + } + return 0 +} + +func (m *EventBuyOrderCreated) GetSellOrderId() uint64 { + if m != nil { + return m.SellOrderId + } + return 0 +} + +func (m *EventBuyOrderCreated) GetQuantity() string { + if m != nil { + return m.Quantity + } + return "" +} + +func (m *EventBuyOrderCreated) GetBidPrice() *types.Coin { + if m != nil { + return m.BidPrice + } + return nil +} + +func (m *EventBuyOrderCreated) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *EventBuyOrderCreated) GetDisablePartialFill() bool { + if m != nil { + return m.DisablePartialFill + } + return false +} + +func (m *EventBuyOrderCreated) GetRetirementLocation() string { + if m != nil { + return m.RetirementLocation + } + return "" +} + +func (m *EventBuyOrderCreated) GetExpiration() *time.Time { + if m != nil { + return m.Expiration + } + return nil +} + +// EventBuyOrderFilled is an event emitted when a buy order is filled. +type EventBuyOrderFilled struct { + // buy_order_id is the unique ID of the buy order. + BuyOrderId uint64 `protobuf:"varint,1,opt,name=buy_order_id,json=buyOrderId,proto3" json:"buy_order_id,omitempty"` + // sell_order_id is the unique ID of the sell order. + SellOrderId uint64 `protobuf:"varint,2,opt,name=sell_order_id,json=sellOrderId,proto3" json:"sell_order_id,omitempty"` + // batch_denom is the credit batch ID of the purchased credits. + BatchDenom string `protobuf:"bytes,3,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + // quantity is the quantity of the purchased credits. + Quantity string `protobuf:"bytes,4,opt,name=quantity,proto3" json:"quantity,omitempty"` + // total_price is the total price for the purchased credits. + TotalPrice *types.Coin `protobuf:"bytes,5,opt,name=total_price,json=totalPrice,proto3" json:"total_price,omitempty"` +} + +func (m *EventBuyOrderFilled) Reset() { *m = EventBuyOrderFilled{} } +func (m *EventBuyOrderFilled) String() string { return proto.CompactTextString(m) } +func (*EventBuyOrderFilled) ProtoMessage() {} +func (*EventBuyOrderFilled) Descriptor() ([]byte, []int) { + return fileDescriptor_c64cc204b7516f6a, []int{3} +} +func (m *EventBuyOrderFilled) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBuyOrderFilled) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBuyOrderFilled.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 *EventBuyOrderFilled) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBuyOrderFilled.Merge(m, src) +} +func (m *EventBuyOrderFilled) XXX_Size() int { + return m.Size() +} +func (m *EventBuyOrderFilled) XXX_DiscardUnknown() { + xxx_messageInfo_EventBuyOrderFilled.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBuyOrderFilled proto.InternalMessageInfo + +func (m *EventBuyOrderFilled) GetBuyOrderId() uint64 { + if m != nil { + return m.BuyOrderId + } + return 0 +} + +func (m *EventBuyOrderFilled) GetSellOrderId() uint64 { + if m != nil { + return m.SellOrderId + } + return 0 +} + +func (m *EventBuyOrderFilled) GetBatchDenom() string { + if m != nil { + return m.BatchDenom + } + return "" +} + +func (m *EventBuyOrderFilled) GetQuantity() string { + if m != nil { + return m.Quantity + } + return "" +} + +func (m *EventBuyOrderFilled) GetTotalPrice() *types.Coin { + if m != nil { + return m.TotalPrice + } + return nil +} + +// EventAllowAskDenom is an event emitted when an ask denom is added. +type EventAllowAskDenom 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 *EventAllowAskDenom) Reset() { *m = EventAllowAskDenom{} } +func (m *EventAllowAskDenom) String() string { return proto.CompactTextString(m) } +func (*EventAllowAskDenom) ProtoMessage() {} +func (*EventAllowAskDenom) Descriptor() ([]byte, []int) { + return fileDescriptor_c64cc204b7516f6a, []int{4} +} +func (m *EventAllowAskDenom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventAllowAskDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventAllowAskDenom.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 *EventAllowAskDenom) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventAllowAskDenom.Merge(m, src) +} +func (m *EventAllowAskDenom) XXX_Size() int { + return m.Size() +} +func (m *EventAllowAskDenom) XXX_DiscardUnknown() { + xxx_messageInfo_EventAllowAskDenom.DiscardUnknown(m) +} + +var xxx_messageInfo_EventAllowAskDenom proto.InternalMessageInfo + +func (m *EventAllowAskDenom) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *EventAllowAskDenom) GetDisplayDenom() string { + if m != nil { + return m.DisplayDenom + } + return "" +} + +func (m *EventAllowAskDenom) GetExponent() uint32 { + if m != nil { + return m.Exponent + } + return 0 +} + +func init() { + proto.RegisterType((*EventSell)(nil), "regen.ecocredit.marketplace.v1beta1.EventSell") + proto.RegisterType((*EventUpdateSellOrder)(nil), "regen.ecocredit.marketplace.v1beta1.EventUpdateSellOrder") + proto.RegisterType((*EventBuyOrderCreated)(nil), "regen.ecocredit.marketplace.v1beta1.EventBuyOrderCreated") + proto.RegisterType((*EventBuyOrderFilled)(nil), "regen.ecocredit.marketplace.v1beta1.EventBuyOrderFilled") + proto.RegisterType((*EventAllowAskDenom)(nil), "regen.ecocredit.marketplace.v1beta1.EventAllowAskDenom") +} + +func init() { + proto.RegisterFile("regen/ecocredit/marketplace/v1beta1/events.proto", fileDescriptor_c64cc204b7516f6a) +} + +var fileDescriptor_c64cc204b7516f6a = []byte{ + // 675 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xbf, 0x6e, 0xdb, 0x3a, + 0x14, 0xc6, 0x23, 0xc7, 0x4e, 0x6c, 0x3a, 0xbe, 0xc0, 0x65, 0x3c, 0x38, 0x1e, 0x14, 0x5f, 0x67, + 0xf1, 0x72, 0xa5, 0xe4, 0x5e, 0xa0, 0x43, 0x81, 0x02, 0x4d, 0xd2, 0xb4, 0x08, 0x50, 0xa0, 0xa9, + 0xda, 0x2e, 0x5d, 0x04, 0x4a, 0x3a, 0x51, 0x08, 0x53, 0xa4, 0x4a, 0x51, 0x71, 0xfc, 0x00, 0x1d, + 0x0b, 0xe4, 0xb1, 0x3a, 0x74, 0xc8, 0xd0, 0xa1, 0x5b, 0x8b, 0xe4, 0x45, 0x0a, 0x52, 0xf2, 0x9f, + 0x24, 0x68, 0x6d, 0x04, 0xdd, 0x7c, 0x78, 0xce, 0x47, 0x1e, 0xfe, 0xce, 0x67, 0x0a, 0xed, 0x4a, + 0x88, 0x81, 0xbb, 0x10, 0x8a, 0x50, 0x42, 0x44, 0x95, 0x9b, 0x10, 0x39, 0x04, 0x95, 0x32, 0x12, + 0x82, 0x7b, 0xbe, 0x17, 0x80, 0x22, 0x7b, 0x2e, 0x9c, 0x03, 0x57, 0x99, 0x93, 0x4a, 0xa1, 0x04, + 0xde, 0x31, 0x0a, 0x67, 0xaa, 0x70, 0xe6, 0x14, 0x4e, 0xa9, 0xe8, 0xb6, 0x63, 0x11, 0x0b, 0x53, + 0xef, 0xea, 0x5f, 0x85, 0xb4, 0x6b, 0x87, 0x22, 0x4b, 0x44, 0xe6, 0x06, 0x24, 0x9b, 0x6d, 0x1e, + 0x0a, 0xca, 0xcb, 0xfc, 0x76, 0x2c, 0x44, 0xcc, 0xc0, 0x35, 0x51, 0x90, 0x9f, 0xba, 0x8a, 0x26, + 0x90, 0x29, 0x92, 0xa4, 0x45, 0x41, 0xff, 0x53, 0x05, 0x35, 0x8e, 0x74, 0x33, 0x6f, 0x80, 0x31, + 0xbc, 0x85, 0xea, 0x42, 0x46, 0x20, 0x7d, 0x1a, 0x75, 0xac, 0x9e, 0x35, 0xa8, 0x7a, 0xeb, 0x26, + 0x3e, 0x8e, 0xf0, 0x36, 0x6a, 0x06, 0x44, 0x85, 0x67, 0x7e, 0x04, 0x5c, 0x24, 0x9d, 0x4a, 0xcf, + 0x1a, 0x34, 0x3c, 0x64, 0x96, 0x9e, 0xe9, 0x15, 0xdc, 0x45, 0xf5, 0x0f, 0x39, 0xe1, 0x8a, 0xaa, + 0x71, 0x67, 0xd5, 0x64, 0xa7, 0x31, 0x7e, 0x84, 0x1a, 0x24, 0x1b, 0xfa, 0xa9, 0xa4, 0x21, 0x74, + 0xaa, 0x3d, 0x6b, 0xd0, 0xfc, 0x6f, 0xcb, 0x29, 0x5a, 0x77, 0x74, 0xeb, 0x93, 0x5b, 0x3a, 0x87, + 0x82, 0x72, 0xaf, 0x4e, 0xb2, 0xe1, 0x89, 0x2e, 0xc5, 0x0e, 0xda, 0x8c, 0x68, 0x46, 0x02, 0x06, + 0x3e, 0xc9, 0x95, 0xf0, 0x25, 0x28, 0x2a, 0xa1, 0x53, 0xeb, 0x59, 0x83, 0xba, 0xf7, 0x77, 0x99, + 0xda, 0xcf, 0x95, 0xf0, 0x4c, 0x02, 0x3f, 0x45, 0x08, 0x2e, 0x52, 0x2a, 0x89, 0xa2, 0x82, 0x77, + 0xd6, 0xcc, 0x41, 0x5d, 0xa7, 0x60, 0xe0, 0x4c, 0x18, 0x38, 0x6f, 0x27, 0x0c, 0x0e, 0xaa, 0x97, + 0xdf, 0xb7, 0x2d, 0x6f, 0x4e, 0xd3, 0xff, 0x52, 0x41, 0x6d, 0xc3, 0xe3, 0x5d, 0x1a, 0x11, 0x05, + 0x9a, 0xca, 0x2b, 0x4d, 0x00, 0xb7, 0x51, 0x4d, 0x8c, 0x38, 0x48, 0xc3, 0xa5, 0xe1, 0x15, 0x01, + 0xee, 0xa3, 0x56, 0x06, 0x8c, 0xf9, 0x53, 0x6a, 0x15, 0x43, 0xad, 0x99, 0x4d, 0x74, 0xf7, 0xc9, + 0xad, 0xde, 0x23, 0xf7, 0x0f, 0xda, 0xe0, 0x30, 0xf2, 0xa7, 0xf4, 0xaa, 0xa6, 0xa2, 0xc9, 0x61, + 0xf4, 0x7a, 0x02, 0xf0, 0x09, 0x6a, 0xe9, 0x92, 0x19, 0xc4, 0xda, 0x22, 0x88, 0x5a, 0xbe, 0xbf, + 0x80, 0xe3, 0xda, 0xaf, 0x38, 0xbe, 0x40, 0x7f, 0xe9, 0xe3, 0xe6, 0x58, 0xae, 0x2f, 0xc9, 0x52, + 0xb7, 0x79, 0x34, 0xc3, 0xf9, 0x71, 0xb5, 0xc4, 0x79, 0x90, 0x8f, 0x0d, 0x8f, 0x43, 0x09, 0x44, + 0x41, 0x84, 0x7b, 0x68, 0x23, 0xc8, 0xc7, 0xfe, 0x1d, 0xb7, 0xa1, 0xa0, 0x2c, 0x3b, 0x8e, 0x96, + 0x42, 0xbb, 0xc0, 0x73, 0x01, 0x8d, 0x96, 0xf6, 0x5c, 0x40, 0xa3, 0x87, 0x79, 0x6e, 0x17, 0xb5, + 0x27, 0xf5, 0x29, 0x91, 0x8a, 0x12, 0xe6, 0x9f, 0x52, 0xc6, 0x4a, 0xb8, 0xb8, 0xcc, 0x9d, 0x14, + 0xa9, 0xe7, 0x94, 0x31, 0xec, 0xa2, 0xcd, 0x62, 0xd3, 0x04, 0xb8, 0xf2, 0x99, 0x08, 0x67, 0x88, + 0x1b, 0x1e, 0x9e, 0xa5, 0x5e, 0x96, 0x99, 0x3b, 0xb6, 0xae, 0x3f, 0xc0, 0xd6, 0x5f, 0x2d, 0xb4, + 0x79, 0x6b, 0x0e, 0xba, 0x91, 0x3f, 0x36, 0x86, 0x85, 0x0e, 0x9f, 0x9f, 0x53, 0xf5, 0xce, 0x9c, + 0x1e, 0xa3, 0xa6, 0x12, 0x8a, 0xb0, 0x65, 0x8d, 0x8d, 0x4c, 0xb5, 0x99, 0x55, 0x7f, 0x88, 0xb0, + 0xb9, 0xd5, 0x3e, 0x63, 0x42, 0xbb, 0xbd, 0x38, 0xad, 0x8d, 0x6a, 0x45, 0x23, 0xe5, 0x5f, 0xd5, + 0x04, 0x78, 0x07, 0xb5, 0x22, 0x9a, 0xa5, 0x8c, 0x8c, 0x6f, 0x3d, 0x61, 0x1b, 0xe5, 0xe2, 0xb4, + 0x51, 0xb8, 0x48, 0x05, 0x07, 0xae, 0xcc, 0x35, 0x5a, 0xde, 0x34, 0x3e, 0xf0, 0x3f, 0x5f, 0xdb, + 0xd6, 0xd5, 0xb5, 0x6d, 0xfd, 0xb8, 0xb6, 0xad, 0xcb, 0x1b, 0x7b, 0xe5, 0xea, 0xc6, 0x5e, 0xf9, + 0x76, 0x63, 0xaf, 0xbc, 0x3f, 0x8a, 0xa9, 0x3a, 0xcb, 0x03, 0x27, 0x14, 0x89, 0x6b, 0xde, 0xf2, + 0x7f, 0x39, 0xa8, 0x91, 0x90, 0xc3, 0x32, 0x62, 0x10, 0xc5, 0x20, 0xdd, 0x8b, 0xdf, 0x7f, 0x14, + 0x82, 0x35, 0x33, 0xca, 0xff, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x66, 0xf1, 0x27, 0x8e, 0x42, + 0x06, 0x00, 0x00, +} + +func (m *EventSell) 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 *EventSell) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventSell) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expiration != nil { + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Expiration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Expiration):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintEvents(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x32 + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.AskPrice != nil { + { + size, err := m.AskPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.Quantity) > 0 { + i -= len(m.Quantity) + copy(dAtA[i:], m.Quantity) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Quantity))) + i-- + dAtA[i] = 0x1a + } + if len(m.BatchDenom) > 0 { + i -= len(m.BatchDenom) + copy(dAtA[i:], m.BatchDenom) + i = encodeVarintEvents(dAtA, i, uint64(len(m.BatchDenom))) + i-- + dAtA[i] = 0x12 + } + if m.OrderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.OrderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventUpdateSellOrder) 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 *EventUpdateSellOrder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventUpdateSellOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NewExpiration != nil { + n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.NewExpiration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.NewExpiration):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintEvents(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x3a + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.NewAskPrice != nil { + { + size, err := m.NewAskPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.NewQuantity) > 0 { + i -= len(m.NewQuantity) + copy(dAtA[i:], m.NewQuantity) + i = encodeVarintEvents(dAtA, i, uint64(len(m.NewQuantity))) + i-- + dAtA[i] = 0x22 + } + if len(m.BatchDenom) > 0 { + i -= len(m.BatchDenom) + copy(dAtA[i:], m.BatchDenom) + i = encodeVarintEvents(dAtA, i, uint64(len(m.BatchDenom))) + i-- + dAtA[i] = 0x1a + } + if m.SellOrderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.SellOrderId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventBuyOrderCreated) 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 *EventBuyOrderCreated) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBuyOrderCreated) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expiration != nil { + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Expiration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Expiration):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintEvents(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x42 + } + if len(m.RetirementLocation) > 0 { + i -= len(m.RetirementLocation) + copy(dAtA[i:], m.RetirementLocation) + i = encodeVarintEvents(dAtA, i, uint64(len(m.RetirementLocation))) + i-- + dAtA[i] = 0x3a + } + if m.DisablePartialFill { + i-- + if m.DisablePartialFill { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.BidPrice != nil { + { + size, err := m.BidPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.Quantity) > 0 { + i -= len(m.Quantity) + copy(dAtA[i:], m.Quantity) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Quantity))) + i-- + dAtA[i] = 0x1a + } + if m.SellOrderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.SellOrderId)) + i-- + dAtA[i] = 0x10 + } + if m.BuyOrderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.BuyOrderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventBuyOrderFilled) 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 *EventBuyOrderFilled) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBuyOrderFilled) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TotalPrice != nil { + { + size, err := m.TotalPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.Quantity) > 0 { + i -= len(m.Quantity) + copy(dAtA[i:], m.Quantity) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Quantity))) + i-- + dAtA[i] = 0x22 + } + if len(m.BatchDenom) > 0 { + i -= len(m.BatchDenom) + copy(dAtA[i:], m.BatchDenom) + i = encodeVarintEvents(dAtA, i, uint64(len(m.BatchDenom))) + i-- + dAtA[i] = 0x1a + } + if m.SellOrderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.SellOrderId)) + i-- + dAtA[i] = 0x10 + } + if m.BuyOrderId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.BuyOrderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *EventAllowAskDenom) 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 *EventAllowAskDenom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventAllowAskDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Exponent != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x18 + } + if len(m.DisplayDenom) > 0 { + i -= len(m.DisplayDenom) + copy(dAtA[i:], m.DisplayDenom) + i = encodeVarintEvents(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 = encodeVarintEvents(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventSell) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OrderId != 0 { + n += 1 + sovEvents(uint64(m.OrderId)) + } + l = len(m.BatchDenom) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Quantity) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.AskPrice != nil { + l = m.AskPrice.Size() + n += 1 + l + sovEvents(uint64(l)) + } + if m.DisableAutoRetire { + n += 2 + } + if m.Expiration != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.Expiration) + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventUpdateSellOrder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.SellOrderId != 0 { + n += 1 + sovEvents(uint64(m.SellOrderId)) + } + l = len(m.BatchDenom) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.NewQuantity) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.NewAskPrice != nil { + l = m.NewAskPrice.Size() + n += 1 + l + sovEvents(uint64(l)) + } + if m.DisableAutoRetire { + n += 2 + } + if m.NewExpiration != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.NewExpiration) + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventBuyOrderCreated) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BuyOrderId != 0 { + n += 1 + sovEvents(uint64(m.BuyOrderId)) + } + if m.SellOrderId != 0 { + n += 1 + sovEvents(uint64(m.SellOrderId)) + } + l = len(m.Quantity) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.BidPrice != nil { + l = m.BidPrice.Size() + n += 1 + l + sovEvents(uint64(l)) + } + if m.DisableAutoRetire { + n += 2 + } + if m.DisablePartialFill { + n += 2 + } + l = len(m.RetirementLocation) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.Expiration != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.Expiration) + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventBuyOrderFilled) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BuyOrderId != 0 { + n += 1 + sovEvents(uint64(m.BuyOrderId)) + } + if m.SellOrderId != 0 { + n += 1 + sovEvents(uint64(m.SellOrderId)) + } + l = len(m.BatchDenom) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.Quantity) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.TotalPrice != nil { + l = m.TotalPrice.Size() + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventAllowAskDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.DisplayDenom) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovEvents(uint64(m.Exponent)) + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventSell) 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: EventSell: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventSell: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderId", wireType) + } + m.OrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", 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.BatchDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", 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.Quantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AskPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AskPrice == nil { + m.AskPrice = &types.Coin{} + } + if err := m.AskPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Expiration == nil { + m.Expiration = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.Expiration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventUpdateSellOrder) 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: EventUpdateSellOrder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventUpdateSellOrder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrderId", wireType) + } + m.SellOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SellOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", 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.BatchDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewQuantity", 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.NewQuantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewAskPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NewAskPrice == nil { + m.NewAskPrice = &types.Coin{} + } + if err := m.NewAskPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewExpiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NewExpiration == nil { + m.NewExpiration = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.NewExpiration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBuyOrderCreated) 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: EventBuyOrderCreated: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBuyOrderCreated: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BuyOrderId", wireType) + } + m.BuyOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BuyOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrderId", wireType) + } + m.SellOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SellOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", 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.Quantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BidPrice == nil { + m.BidPrice = &types.Coin{} + } + if err := m.BidPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisablePartialFill", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisablePartialFill = bool(v != 0) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetirementLocation", 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.RetirementLocation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Expiration == nil { + m.Expiration = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.Expiration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBuyOrderFilled) 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: EventBuyOrderFilled: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBuyOrderFilled: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BuyOrderId", wireType) + } + m.BuyOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BuyOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrderId", wireType) + } + m.SellOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SellOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", 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.BatchDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", 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.Quantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TotalPrice == nil { + m.TotalPrice = &types.Coin{} + } + if err := m.TotalPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventAllowAskDenom) 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: EventAllowAskDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventAllowAskDenom: 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 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.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 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.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 ErrIntOverflowEvents + } + 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 := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthEvents + } + if (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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/marketplace/v1beta1/query.pb.go b/x/ecocredit/marketplace/v1beta1/query.pb.go new file mode 100644 index 0000000000..62b7a5f641 --- /dev/null +++ b/x/ecocredit/marketplace/v1beta1/query.pb.go @@ -0,0 +1,3975 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/marketplace/v1beta1/query.proto + +package v1beta1 + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QuerySellOrderRequest is the Query/SellOrder request type. +type QuerySellOrderRequest struct { + // sell_order_id is the id of the requested sell order. + SellOrderId uint64 `protobuf:"varint,1,opt,name=sell_order_id,json=sellOrderId,proto3" json:"sell_order_id,omitempty"` +} + +func (m *QuerySellOrderRequest) Reset() { *m = QuerySellOrderRequest{} } +func (m *QuerySellOrderRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySellOrderRequest) ProtoMessage() {} +func (*QuerySellOrderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{0} +} +func (m *QuerySellOrderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySellOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySellOrderRequest.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 *QuerySellOrderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySellOrderRequest.Merge(m, src) +} +func (m *QuerySellOrderRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySellOrderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySellOrderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySellOrderRequest proto.InternalMessageInfo + +func (m *QuerySellOrderRequest) GetSellOrderId() uint64 { + if m != nil { + return m.SellOrderId + } + return 0 +} + +// QuerySellOrderResponse is the Query/SellOrder response type. +type QuerySellOrderResponse struct { + // sell_order contains all information related to a sell order. + SellOrder *SellOrder `protobuf:"bytes,1,opt,name=sell_order,json=sellOrder,proto3" json:"sell_order,omitempty"` +} + +func (m *QuerySellOrderResponse) Reset() { *m = QuerySellOrderResponse{} } +func (m *QuerySellOrderResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySellOrderResponse) ProtoMessage() {} +func (*QuerySellOrderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{1} +} +func (m *QuerySellOrderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySellOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySellOrderResponse.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 *QuerySellOrderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySellOrderResponse.Merge(m, src) +} +func (m *QuerySellOrderResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySellOrderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySellOrderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySellOrderResponse proto.InternalMessageInfo + +func (m *QuerySellOrderResponse) GetSellOrder() *SellOrder { + if m != nil { + return m.SellOrder + } + return nil +} + +// QuerySellOrdersRequest is the Query/SellOrders request type. +type QuerySellOrdersRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySellOrdersRequest) Reset() { *m = QuerySellOrdersRequest{} } +func (m *QuerySellOrdersRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySellOrdersRequest) ProtoMessage() {} +func (*QuerySellOrdersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{2} +} +func (m *QuerySellOrdersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySellOrdersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySellOrdersRequest.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 *QuerySellOrdersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySellOrdersRequest.Merge(m, src) +} +func (m *QuerySellOrdersRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySellOrdersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySellOrdersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySellOrdersRequest proto.InternalMessageInfo + +func (m *QuerySellOrdersRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QuerySellOrdersResponse is the Query/SellOrders response type. +type QuerySellOrdersResponse struct { + // sell_orders is a list of sell orders. + SellOrders []*SellOrder `protobuf:"bytes,1,rep,name=sell_orders,json=sellOrders,proto3" json:"sell_orders,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySellOrdersResponse) Reset() { *m = QuerySellOrdersResponse{} } +func (m *QuerySellOrdersResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySellOrdersResponse) ProtoMessage() {} +func (*QuerySellOrdersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{3} +} +func (m *QuerySellOrdersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySellOrdersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySellOrdersResponse.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 *QuerySellOrdersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySellOrdersResponse.Merge(m, src) +} +func (m *QuerySellOrdersResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySellOrdersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySellOrdersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySellOrdersResponse proto.InternalMessageInfo + +func (m *QuerySellOrdersResponse) GetSellOrders() []*SellOrder { + if m != nil { + return m.SellOrders + } + return nil +} + +func (m *QuerySellOrdersResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QuerySellOrdersByDenomRequest is the Query/SellOrdersByDenom request type. +type QuerySellOrdersByBatchDenomRequest struct { + // batch_denom is an ecocredit denom + BatchDenom string `protobuf:"bytes,1,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySellOrdersByBatchDenomRequest) Reset() { *m = QuerySellOrdersByBatchDenomRequest{} } +func (m *QuerySellOrdersByBatchDenomRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySellOrdersByBatchDenomRequest) ProtoMessage() {} +func (*QuerySellOrdersByBatchDenomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{4} +} +func (m *QuerySellOrdersByBatchDenomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySellOrdersByBatchDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySellOrdersByBatchDenomRequest.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 *QuerySellOrdersByBatchDenomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySellOrdersByBatchDenomRequest.Merge(m, src) +} +func (m *QuerySellOrdersByBatchDenomRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySellOrdersByBatchDenomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySellOrdersByBatchDenomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySellOrdersByBatchDenomRequest proto.InternalMessageInfo + +func (m *QuerySellOrdersByBatchDenomRequest) GetBatchDenom() string { + if m != nil { + return m.BatchDenom + } + return "" +} + +func (m *QuerySellOrdersByBatchDenomRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QuerySellOrdersByDenomResponse is the Query/SellOrdersByDenom response type. +type QuerySellOrdersByBatchDenomResponse struct { + // sell_orders is a list of sell orders. + SellOrders []*SellOrder `protobuf:"bytes,1,rep,name=sell_orders,json=sellOrders,proto3" json:"sell_orders,omitempty"` + // pagination defines an optional pagination for the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySellOrdersByBatchDenomResponse) Reset() { *m = QuerySellOrdersByBatchDenomResponse{} } +func (m *QuerySellOrdersByBatchDenomResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySellOrdersByBatchDenomResponse) ProtoMessage() {} +func (*QuerySellOrdersByBatchDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{5} +} +func (m *QuerySellOrdersByBatchDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySellOrdersByBatchDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySellOrdersByBatchDenomResponse.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 *QuerySellOrdersByBatchDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySellOrdersByBatchDenomResponse.Merge(m, src) +} +func (m *QuerySellOrdersByBatchDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySellOrdersByBatchDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySellOrdersByBatchDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySellOrdersByBatchDenomResponse proto.InternalMessageInfo + +func (m *QuerySellOrdersByBatchDenomResponse) GetSellOrders() []*SellOrder { + if m != nil { + return m.SellOrders + } + return nil +} + +func (m *QuerySellOrdersByBatchDenomResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QuerySellOrdersByAddressRequest is the Query/SellOrdersByAddress request type. +type QuerySellOrdersByAddressRequest struct { + // address is the creator of the sell order + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySellOrdersByAddressRequest) Reset() { *m = QuerySellOrdersByAddressRequest{} } +func (m *QuerySellOrdersByAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QuerySellOrdersByAddressRequest) ProtoMessage() {} +func (*QuerySellOrdersByAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{6} +} +func (m *QuerySellOrdersByAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySellOrdersByAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySellOrdersByAddressRequest.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 *QuerySellOrdersByAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySellOrdersByAddressRequest.Merge(m, src) +} +func (m *QuerySellOrdersByAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QuerySellOrdersByAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySellOrdersByAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySellOrdersByAddressRequest proto.InternalMessageInfo + +func (m *QuerySellOrdersByAddressRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *QuerySellOrdersByAddressRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QuerySellOrdersByAddressResponse is the Query/SellOrdersByAddressResponse response type. +type QuerySellOrdersByAddressResponse struct { + // sell_orders is a list of sell orders. + SellOrders []*SellOrder `protobuf:"bytes,1,rep,name=sell_orders,json=sellOrders,proto3" json:"sell_orders,omitempty"` + // pagination defines an optional pagination for the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QuerySellOrdersByAddressResponse) Reset() { *m = QuerySellOrdersByAddressResponse{} } +func (m *QuerySellOrdersByAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QuerySellOrdersByAddressResponse) ProtoMessage() {} +func (*QuerySellOrdersByAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{7} +} +func (m *QuerySellOrdersByAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QuerySellOrdersByAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QuerySellOrdersByAddressResponse.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 *QuerySellOrdersByAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QuerySellOrdersByAddressResponse.Merge(m, src) +} +func (m *QuerySellOrdersByAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QuerySellOrdersByAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QuerySellOrdersByAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QuerySellOrdersByAddressResponse proto.InternalMessageInfo + +func (m *QuerySellOrdersByAddressResponse) GetSellOrders() []*SellOrder { + if m != nil { + return m.SellOrders + } + return nil +} + +func (m *QuerySellOrdersByAddressResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBuyOrderRequest is the Query/BuyOrder request type. +type QueryBuyOrderRequest struct { + // buy_order_id is the id of the buy order. + BuyOrderId uint64 `protobuf:"varint,1,opt,name=buy_order_id,json=buyOrderId,proto3" json:"buy_order_id,omitempty"` +} + +func (m *QueryBuyOrderRequest) Reset() { *m = QueryBuyOrderRequest{} } +func (m *QueryBuyOrderRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBuyOrderRequest) ProtoMessage() {} +func (*QueryBuyOrderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{8} +} +func (m *QueryBuyOrderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBuyOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuyOrderRequest.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 *QueryBuyOrderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuyOrderRequest.Merge(m, src) +} +func (m *QueryBuyOrderRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBuyOrderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuyOrderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuyOrderRequest proto.InternalMessageInfo + +func (m *QueryBuyOrderRequest) GetBuyOrderId() uint64 { + if m != nil { + return m.BuyOrderId + } + return 0 +} + +// QueryBuyOrderResponse is the Query/BuyOrder response type. +type QueryBuyOrderResponse struct { + // buy_order contains all information related to a buy order. + BuyOrder *BuyOrder `protobuf:"bytes,1,opt,name=buy_order,json=buyOrder,proto3" json:"buy_order,omitempty"` +} + +func (m *QueryBuyOrderResponse) Reset() { *m = QueryBuyOrderResponse{} } +func (m *QueryBuyOrderResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBuyOrderResponse) ProtoMessage() {} +func (*QueryBuyOrderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{9} +} +func (m *QueryBuyOrderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBuyOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuyOrderResponse.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 *QueryBuyOrderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuyOrderResponse.Merge(m, src) +} +func (m *QueryBuyOrderResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBuyOrderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuyOrderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuyOrderResponse proto.InternalMessageInfo + +func (m *QueryBuyOrderResponse) GetBuyOrder() *BuyOrder { + if m != nil { + return m.BuyOrder + } + return nil +} + +// QueryBuyOrdersRequest is the Query/BuyOrders request type. +type QueryBuyOrdersRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBuyOrdersRequest) Reset() { *m = QueryBuyOrdersRequest{} } +func (m *QueryBuyOrdersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBuyOrdersRequest) ProtoMessage() {} +func (*QueryBuyOrdersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{10} +} +func (m *QueryBuyOrdersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBuyOrdersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuyOrdersRequest.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 *QueryBuyOrdersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuyOrdersRequest.Merge(m, src) +} +func (m *QueryBuyOrdersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBuyOrdersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuyOrdersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuyOrdersRequest proto.InternalMessageInfo + +func (m *QueryBuyOrdersRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBuyOrdersResponse is the Query/BuyOrders response type. +type QueryBuyOrdersResponse struct { + // buy_orders is a list of buy orders. + BuyOrders []*BuyOrder `protobuf:"bytes,1,rep,name=buy_orders,json=buyOrders,proto3" json:"buy_orders,omitempty"` + // pagination defines an optional pagination for the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBuyOrdersResponse) Reset() { *m = QueryBuyOrdersResponse{} } +func (m *QueryBuyOrdersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBuyOrdersResponse) ProtoMessage() {} +func (*QueryBuyOrdersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{11} +} +func (m *QueryBuyOrdersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBuyOrdersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuyOrdersResponse.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 *QueryBuyOrdersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuyOrdersResponse.Merge(m, src) +} +func (m *QueryBuyOrdersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBuyOrdersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuyOrdersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuyOrdersResponse proto.InternalMessageInfo + +func (m *QueryBuyOrdersResponse) GetBuyOrders() []*BuyOrder { + if m != nil { + return m.BuyOrders + } + return nil +} + +func (m *QueryBuyOrdersResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBuyOrdersByAddressRequest is the Query/BuyOrdersByAddress request type +type QueryBuyOrdersByAddressRequest struct { + // address of the buy order creator + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBuyOrdersByAddressRequest) Reset() { *m = QueryBuyOrdersByAddressRequest{} } +func (m *QueryBuyOrdersByAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBuyOrdersByAddressRequest) ProtoMessage() {} +func (*QueryBuyOrdersByAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{12} +} +func (m *QueryBuyOrdersByAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBuyOrdersByAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuyOrdersByAddressRequest.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 *QueryBuyOrdersByAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuyOrdersByAddressRequest.Merge(m, src) +} +func (m *QueryBuyOrdersByAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBuyOrdersByAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuyOrdersByAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuyOrdersByAddressRequest proto.InternalMessageInfo + +func (m *QueryBuyOrdersByAddressRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *QueryBuyOrdersByAddressRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBuyOrdersByAddressResponse is the Query/BuyOrdersByAddress response type. +type QueryBuyOrdersByAddressResponse struct { + // buy_orders is a list of buy orders. + BuyOrders []*BuyOrder `protobuf:"bytes,1,rep,name=buy_orders,json=buyOrders,proto3" json:"buy_orders,omitempty"` + // pagination defines an optional pagination for the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBuyOrdersByAddressResponse) Reset() { *m = QueryBuyOrdersByAddressResponse{} } +func (m *QueryBuyOrdersByAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBuyOrdersByAddressResponse) ProtoMessage() {} +func (*QueryBuyOrdersByAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{13} +} +func (m *QueryBuyOrdersByAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBuyOrdersByAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBuyOrdersByAddressResponse.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 *QueryBuyOrdersByAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBuyOrdersByAddressResponse.Merge(m, src) +} +func (m *QueryBuyOrdersByAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBuyOrdersByAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBuyOrdersByAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBuyOrdersByAddressResponse proto.InternalMessageInfo + +func (m *QueryBuyOrdersByAddressResponse) GetBuyOrders() []*BuyOrder { + if m != nil { + return m.BuyOrders + } + return nil +} + +func (m *QueryBuyOrdersByAddressResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAllowedDenomsRequest is the Query/AllowedDenoms request type. +type QueryAllowedDenomsRequest struct { + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllowedDenomsRequest) Reset() { *m = QueryAllowedDenomsRequest{} } +func (m *QueryAllowedDenomsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllowedDenomsRequest) ProtoMessage() {} +func (*QueryAllowedDenomsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{14} +} +func (m *QueryAllowedDenomsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllowedDenomsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllowedDenomsRequest.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 *QueryAllowedDenomsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllowedDenomsRequest.Merge(m, src) +} +func (m *QueryAllowedDenomsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllowedDenomsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllowedDenomsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllowedDenomsRequest proto.InternalMessageInfo + +func (m *QueryAllowedDenomsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryAllowedDenomsResponse is the Query/AllowedDenoms response type. +type QueryAllowedDenomsResponse struct { + // allowed_denoms is a list of coin denoms allowed to use in the ask price of sell orders. + AllowedDenoms []*AllowedDenom `protobuf:"bytes,1,rep,name=allowed_denoms,json=allowedDenoms,proto3" json:"allowed_denoms,omitempty"` + // pagination defines an optional pagination for the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllowedDenomsResponse) Reset() { *m = QueryAllowedDenomsResponse{} } +func (m *QueryAllowedDenomsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllowedDenomsResponse) ProtoMessage() {} +func (*QueryAllowedDenomsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d68580ac6d625703, []int{15} +} +func (m *QueryAllowedDenomsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllowedDenomsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllowedDenomsResponse.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 *QueryAllowedDenomsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllowedDenomsResponse.Merge(m, src) +} +func (m *QueryAllowedDenomsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllowedDenomsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllowedDenomsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllowedDenomsResponse proto.InternalMessageInfo + +func (m *QueryAllowedDenomsResponse) GetAllowedDenoms() []*AllowedDenom { + if m != nil { + return m.AllowedDenoms + } + return nil +} + +func (m *QueryAllowedDenomsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +func init() { + proto.RegisterType((*QuerySellOrderRequest)(nil), "regen.ecocredit.marketplace.v1beta1.QuerySellOrderRequest") + proto.RegisterType((*QuerySellOrderResponse)(nil), "regen.ecocredit.marketplace.v1beta1.QuerySellOrderResponse") + proto.RegisterType((*QuerySellOrdersRequest)(nil), "regen.ecocredit.marketplace.v1beta1.QuerySellOrdersRequest") + proto.RegisterType((*QuerySellOrdersResponse)(nil), "regen.ecocredit.marketplace.v1beta1.QuerySellOrdersResponse") + proto.RegisterType((*QuerySellOrdersByBatchDenomRequest)(nil), "regen.ecocredit.marketplace.v1beta1.QuerySellOrdersByBatchDenomRequest") + proto.RegisterType((*QuerySellOrdersByBatchDenomResponse)(nil), "regen.ecocredit.marketplace.v1beta1.QuerySellOrdersByBatchDenomResponse") + proto.RegisterType((*QuerySellOrdersByAddressRequest)(nil), "regen.ecocredit.marketplace.v1beta1.QuerySellOrdersByAddressRequest") + proto.RegisterType((*QuerySellOrdersByAddressResponse)(nil), "regen.ecocredit.marketplace.v1beta1.QuerySellOrdersByAddressResponse") + proto.RegisterType((*QueryBuyOrderRequest)(nil), "regen.ecocredit.marketplace.v1beta1.QueryBuyOrderRequest") + proto.RegisterType((*QueryBuyOrderResponse)(nil), "regen.ecocredit.marketplace.v1beta1.QueryBuyOrderResponse") + proto.RegisterType((*QueryBuyOrdersRequest)(nil), "regen.ecocredit.marketplace.v1beta1.QueryBuyOrdersRequest") + proto.RegisterType((*QueryBuyOrdersResponse)(nil), "regen.ecocredit.marketplace.v1beta1.QueryBuyOrdersResponse") + proto.RegisterType((*QueryBuyOrdersByAddressRequest)(nil), "regen.ecocredit.marketplace.v1beta1.QueryBuyOrdersByAddressRequest") + proto.RegisterType((*QueryBuyOrdersByAddressResponse)(nil), "regen.ecocredit.marketplace.v1beta1.QueryBuyOrdersByAddressResponse") + proto.RegisterType((*QueryAllowedDenomsRequest)(nil), "regen.ecocredit.marketplace.v1beta1.QueryAllowedDenomsRequest") + proto.RegisterType((*QueryAllowedDenomsResponse)(nil), "regen.ecocredit.marketplace.v1beta1.QueryAllowedDenomsResponse") +} + +func init() { + proto.RegisterFile("regen/ecocredit/marketplace/v1beta1/query.proto", fileDescriptor_d68580ac6d625703) +} + +var fileDescriptor_d68580ac6d625703 = []byte{ + // 886 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x6f, 0x13, 0x47, + 0x14, 0xce, 0xa4, 0xbf, 0xe2, 0xe7, 0xba, 0x87, 0x69, 0x9b, 0xa6, 0xab, 0xca, 0xb1, 0x36, 0x6d, + 0x52, 0x55, 0xf5, 0xae, 0x9c, 0x4a, 0x6d, 0x7e, 0x54, 0x49, 0xe3, 0x26, 0x84, 0x20, 0x50, 0xc0, + 0x5c, 0x10, 0x17, 0x33, 0xbb, 0x3b, 0xda, 0x58, 0x59, 0xef, 0x3a, 0x3b, 0xeb, 0x04, 0x2b, 0xf2, + 0x25, 0x9c, 0x91, 0x90, 0xf8, 0x43, 0x90, 0x40, 0x42, 0x1c, 0x10, 0x11, 0x17, 0xc4, 0x31, 0x12, + 0x17, 0x6e, 0xa0, 0x98, 0x3f, 0x81, 0x3f, 0x00, 0x79, 0x76, 0x76, 0xbd, 0xfe, 0x91, 0xb0, 0x6c, + 0x2c, 0x91, 0x5b, 0x3c, 0x99, 0xef, 0xbd, 0xef, 0xfb, 0x66, 0xe6, 0xbd, 0xb7, 0xa0, 0xba, 0xd4, + 0xa4, 0xb6, 0x4a, 0x75, 0x47, 0x77, 0xa9, 0x51, 0xf1, 0xd4, 0x2a, 0x71, 0xb7, 0xa9, 0x57, 0xb3, + 0x88, 0x4e, 0xd5, 0xdd, 0x82, 0x46, 0x3d, 0x52, 0x50, 0x77, 0xea, 0xd4, 0x6d, 0x28, 0x35, 0xd7, + 0xf1, 0x1c, 0x3c, 0xc5, 0x01, 0x4a, 0x08, 0x50, 0x22, 0x00, 0x45, 0x00, 0xa4, 0x5f, 0x4c, 0xc7, + 0x31, 0x2d, 0xaa, 0x92, 0x5a, 0x45, 0x25, 0xb6, 0xed, 0x78, 0xc4, 0xab, 0x38, 0x36, 0xf3, 0x43, + 0x48, 0xb1, 0x72, 0x32, 0x8f, 0x78, 0x54, 0x00, 0xfe, 0xd0, 0x1d, 0x56, 0x75, 0x98, 0xaa, 0x11, + 0x46, 0x7d, 0x32, 0xe1, 0xb6, 0x1a, 0x31, 0x2b, 0x36, 0x8f, 0xee, 0xef, 0x95, 0x17, 0xe1, 0xc7, + 0x6b, 0xed, 0x1d, 0xd7, 0xa9, 0x65, 0x6d, 0xba, 0x06, 0x75, 0x4b, 0x74, 0xa7, 0x4e, 0x99, 0x87, + 0x65, 0xc8, 0x30, 0x6a, 0x59, 0x65, 0xa7, 0xbd, 0x58, 0xae, 0x18, 0x13, 0x28, 0x87, 0x7e, 0xff, + 0xb2, 0x94, 0x66, 0xc1, 0xc6, 0x0d, 0x43, 0x36, 0x61, 0xbc, 0x17, 0xcc, 0x6a, 0x8e, 0xcd, 0x28, + 0xbe, 0x02, 0xd0, 0x41, 0x73, 0x68, 0x7a, 0x56, 0x51, 0x62, 0x78, 0xa1, 0x74, 0x62, 0xa5, 0xc2, + 0x54, 0xf2, 0xad, 0xde, 0x44, 0x2c, 0xa0, 0x79, 0x01, 0xa0, 0xa3, 0x49, 0x24, 0x9a, 0x56, 0x7c, + 0x03, 0x94, 0xb6, 0x01, 0x8a, 0x7f, 0x1a, 0x41, 0xf8, 0xab, 0xc4, 0xa4, 0x02, 0x5b, 0x8a, 0x20, + 0xe5, 0x47, 0x08, 0x7e, 0xea, 0x4b, 0x21, 0xc4, 0x6c, 0x42, 0xba, 0x23, 0x86, 0x4d, 0xa0, 0xdc, + 0x17, 0x09, 0xd4, 0x40, 0xa8, 0x86, 0xe1, 0xf5, 0x2e, 0xd2, 0xa3, 0x9c, 0xf4, 0xcc, 0x47, 0x49, + 0xfb, 0x6c, 0xba, 0x58, 0xdf, 0x45, 0x20, 0xf7, 0xb0, 0x2e, 0x36, 0x8a, 0xc4, 0xd3, 0xb7, 0x56, + 0xa9, 0xed, 0x54, 0x03, 0x93, 0x26, 0x21, 0xad, 0xb5, 0x17, 0xcb, 0x46, 0x7b, 0x95, 0xbb, 0x94, + 0x2a, 0x81, 0x16, 0xee, 0xeb, 0x71, 0x71, 0x34, 0xb1, 0x8b, 0x87, 0x08, 0xa6, 0x4e, 0xe5, 0x73, + 0xee, 0x1d, 0xbd, 0x83, 0x60, 0xb2, 0x4f, 0xc1, 0x8a, 0x61, 0xb8, 0x94, 0x85, 0x77, 0x6e, 0x02, + 0xbe, 0x21, 0xfe, 0x8a, 0xb0, 0x32, 0xf8, 0x39, 0x34, 0x1f, 0x9f, 0x22, 0xc8, 0x9d, 0xcc, 0xe2, + 0xdc, 0x9b, 0x38, 0x07, 0x3f, 0x70, 0xf6, 0xc5, 0x7a, 0xa3, 0xab, 0xa6, 0xe4, 0xe0, 0x5b, 0xad, + 0xde, 0xe8, 0x2d, 0x29, 0xa0, 0x89, 0x6d, 0x1b, 0x86, 0xac, 0x8b, 0x72, 0xd4, 0x41, 0x0a, 0xb1, + 0x97, 0x20, 0x15, 0x42, 0xc5, 0x33, 0xcf, 0xc7, 0x92, 0x1a, 0x46, 0x1a, 0x0b, 0xd2, 0xc8, 0xe5, + 0x9e, 0x24, 0x43, 0x2f, 0x26, 0x0f, 0x90, 0xa8, 0x57, 0x91, 0x0c, 0x42, 0xc7, 0x65, 0x80, 0x50, + 0x47, 0x70, 0x66, 0x9f, 0x28, 0x24, 0x15, 0x08, 0x19, 0xe2, 0x89, 0x1d, 0x20, 0xc8, 0x76, 0x33, + 0xfe, 0x0c, 0xb7, 0xfe, 0x49, 0xf0, 0xf6, 0x06, 0x91, 0x38, 0xdf, 0xfe, 0xe9, 0xf0, 0x33, 0x67, + 0xbe, 0x62, 0x59, 0xce, 0x1e, 0x35, 0x78, 0xb5, 0x1b, 0xfa, 0xb5, 0x3a, 0x44, 0x20, 0x0d, 0xca, + 0x22, 0xac, 0xb9, 0x01, 0xdf, 0x11, 0xff, 0x1f, 0x7e, 0x9d, 0x0f, 0xec, 0x29, 0xc4, 0xb2, 0x27, + 0x1a, 0xb3, 0x94, 0x21, 0xd1, 0x0c, 0x43, 0xb3, 0x69, 0xf6, 0x20, 0x03, 0x5f, 0x71, 0x05, 0xf8, + 0x05, 0x82, 0x54, 0x58, 0x85, 0xf0, 0x42, 0x2c, 0x8a, 0x03, 0x07, 0x15, 0x69, 0x31, 0x11, 0xd6, + 0x27, 0x27, 0xff, 0x77, 0xf0, 0xea, 0xdd, 0xfd, 0xd1, 0x05, 0x3c, 0xd7, 0x37, 0x64, 0xed, 0x16, + 0x88, 0x55, 0xdb, 0x6a, 0x4f, 0x56, 0xd4, 0xb2, 0xf2, 0xfe, 0x7d, 0x53, 0x2b, 0x86, 0xba, 0xdf, + 0x35, 0x15, 0x35, 0xf1, 0x63, 0x04, 0xd0, 0xa9, 0xd2, 0x38, 0x09, 0x9b, 0xe0, 0xa2, 0x48, 0xff, + 0x26, 0x03, 0x0b, 0x2d, 0x79, 0xae, 0x65, 0x06, 0xff, 0x16, 0x4b, 0x0b, 0x7e, 0x8f, 0x60, 0x7c, + 0x70, 0x9b, 0xc6, 0xeb, 0x49, 0x78, 0x0c, 0x18, 0x3c, 0xa4, 0x8b, 0x67, 0x0f, 0x24, 0xc4, 0xad, + 0x73, 0x71, 0x2b, 0x78, 0x39, 0xde, 0x41, 0xf1, 0xd9, 0x26, 0xcf, 0x9f, 0x81, 0xba, 0x1f, 0x99, + 0x7d, 0x9a, 0xb8, 0x85, 0xe0, 0xfb, 0x01, 0x5d, 0x15, 0xaf, 0x26, 0xa3, 0xda, 0x5d, 0x24, 0xa5, + 0xb5, 0x33, 0x46, 0x11, 0x6a, 0x97, 0xb9, 0xda, 0x79, 0xfc, 0x4f, 0x3c, 0xb5, 0xa2, 0x10, 0xab, + 0xfb, 0xe2, 0x8f, 0x26, 0x7e, 0x8e, 0x60, 0x2c, 0x28, 0x78, 0x78, 0x3e, 0x3e, 0xa9, 0x9e, 0x8e, + 0x2d, 0x2d, 0x24, 0x81, 0x0a, 0x11, 0x4b, 0x5c, 0xc4, 0x1c, 0xfe, 0xfb, 0x64, 0x11, 0x5a, 0xbd, + 0x11, 0x7d, 0x5a, 0xd1, 0xe1, 0xa0, 0x89, 0x1f, 0x22, 0x48, 0x85, 0x9d, 0x00, 0x27, 0x60, 0xc2, + 0x12, 0x94, 0x88, 0xbe, 0x8e, 0x2d, 0xff, 0xc9, 0x65, 0x4c, 0xe3, 0x5f, 0xe3, 0xc8, 0xc0, 0x6f, + 0x10, 0xe0, 0xfe, 0xf6, 0x85, 0xff, 0x4f, 0xc0, 0xa0, 0xef, 0x72, 0xad, 0x9e, 0x2d, 0x48, 0xa2, + 0x63, 0xe9, 0xbf, 0x5a, 0xcf, 0x10, 0x64, 0xba, 0x1a, 0x10, 0x5e, 0x8a, 0xcf, 0x6b, 0x50, 0x7f, + 0x94, 0x96, 0x13, 0xe3, 0xe3, 0x1f, 0x11, 0x61, 0xdb, 0x7e, 0x39, 0x60, 0xc5, 0xf2, 0xcb, 0xe3, + 0x2c, 0x3a, 0x3a, 0xce, 0xa2, 0xb7, 0xc7, 0x59, 0x74, 0xaf, 0x95, 0x1d, 0x39, 0x6a, 0x65, 0x47, + 0x5e, 0xb7, 0xb2, 0x23, 0x37, 0xd7, 0xcc, 0x8a, 0xb7, 0x55, 0xd7, 0x14, 0xdd, 0xa9, 0xfa, 0x91, + 0xf2, 0x36, 0xf5, 0xf6, 0x1c, 0x77, 0x5b, 0xfc, 0xb2, 0xa8, 0x61, 0x52, 0x57, 0xbd, 0x7d, 0xfa, + 0xb7, 0xb8, 0xf6, 0x35, 0xff, 0xb4, 0xfe, 0xeb, 0x43, 0x00, 0x00, 0x00, 0xff, 0xff, 0x72, 0xd8, + 0x19, 0x4f, 0x2d, 0x10, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // SellOrder queries a sell order by its ID + SellOrder(ctx context.Context, in *QuerySellOrderRequest, opts ...grpc.CallOption) (*QuerySellOrderResponse, error) + // SellOrders queries a paginated list of all sell orders + SellOrders(ctx context.Context, in *QuerySellOrdersRequest, opts ...grpc.CallOption) (*QuerySellOrdersResponse, error) + // SellOrdersByDenom queries a paginated list of all sell orders of a specific ecocredit denom + SellOrdersByBatchDenom(ctx context.Context, in *QuerySellOrdersByBatchDenomRequest, opts ...grpc.CallOption) (*QuerySellOrdersByBatchDenomResponse, error) + // SellOrdersByAddress queries a paginated list of all sell orders from a specific address + SellOrdersByAddress(ctx context.Context, in *QuerySellOrdersByAddressRequest, opts ...grpc.CallOption) (*QuerySellOrdersByAddressResponse, error) + // BuyOrder queries a buy order by its id + BuyOrder(ctx context.Context, in *QueryBuyOrderRequest, opts ...grpc.CallOption) (*QueryBuyOrderResponse, error) + // BuyOrders queries a paginated list of all buy orders + BuyOrders(ctx context.Context, in *QueryBuyOrdersRequest, opts ...grpc.CallOption) (*QueryBuyOrdersResponse, error) + // BuyOrdersByAddress queries a paginated list of buy orders by creator address + BuyOrdersByAddress(ctx context.Context, in *QueryBuyOrdersByAddressRequest, opts ...grpc.CallOption) (*QueryBuyOrdersByAddressResponse, error) + // AllowedDenoms queries all denoms allowed to be set in the AskPrice of a sell order + AllowedDenoms(ctx context.Context, in *QueryAllowedDenomsRequest, opts ...grpc.CallOption) (*QueryAllowedDenomsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) SellOrder(ctx context.Context, in *QuerySellOrderRequest, opts ...grpc.CallOption) (*QuerySellOrderResponse, error) { + out := new(QuerySellOrderResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Query/SellOrder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SellOrders(ctx context.Context, in *QuerySellOrdersRequest, opts ...grpc.CallOption) (*QuerySellOrdersResponse, error) { + out := new(QuerySellOrdersResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Query/SellOrders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SellOrdersByBatchDenom(ctx context.Context, in *QuerySellOrdersByBatchDenomRequest, opts ...grpc.CallOption) (*QuerySellOrdersByBatchDenomResponse, error) { + out := new(QuerySellOrdersByBatchDenomResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Query/SellOrdersByBatchDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) SellOrdersByAddress(ctx context.Context, in *QuerySellOrdersByAddressRequest, opts ...grpc.CallOption) (*QuerySellOrdersByAddressResponse, error) { + out := new(QuerySellOrdersByAddressResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Query/SellOrdersByAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BuyOrder(ctx context.Context, in *QueryBuyOrderRequest, opts ...grpc.CallOption) (*QueryBuyOrderResponse, error) { + out := new(QueryBuyOrderResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Query/BuyOrder", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BuyOrders(ctx context.Context, in *QueryBuyOrdersRequest, opts ...grpc.CallOption) (*QueryBuyOrdersResponse, error) { + out := new(QueryBuyOrdersResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Query/BuyOrders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) BuyOrdersByAddress(ctx context.Context, in *QueryBuyOrdersByAddressRequest, opts ...grpc.CallOption) (*QueryBuyOrdersByAddressResponse, error) { + out := new(QueryBuyOrdersByAddressResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Query/BuyOrdersByAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) AllowedDenoms(ctx context.Context, in *QueryAllowedDenomsRequest, opts ...grpc.CallOption) (*QueryAllowedDenomsResponse, error) { + out := new(QueryAllowedDenomsResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Query/AllowedDenoms", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // SellOrder queries a sell order by its ID + SellOrder(context.Context, *QuerySellOrderRequest) (*QuerySellOrderResponse, error) + // SellOrders queries a paginated list of all sell orders + SellOrders(context.Context, *QuerySellOrdersRequest) (*QuerySellOrdersResponse, error) + // SellOrdersByDenom queries a paginated list of all sell orders of a specific ecocredit denom + SellOrdersByBatchDenom(context.Context, *QuerySellOrdersByBatchDenomRequest) (*QuerySellOrdersByBatchDenomResponse, error) + // SellOrdersByAddress queries a paginated list of all sell orders from a specific address + SellOrdersByAddress(context.Context, *QuerySellOrdersByAddressRequest) (*QuerySellOrdersByAddressResponse, error) + // BuyOrder queries a buy order by its id + BuyOrder(context.Context, *QueryBuyOrderRequest) (*QueryBuyOrderResponse, error) + // BuyOrders queries a paginated list of all buy orders + BuyOrders(context.Context, *QueryBuyOrdersRequest) (*QueryBuyOrdersResponse, error) + // BuyOrdersByAddress queries a paginated list of buy orders by creator address + BuyOrdersByAddress(context.Context, *QueryBuyOrdersByAddressRequest) (*QueryBuyOrdersByAddressResponse, error) + // AllowedDenoms queries all denoms allowed to be set in the AskPrice of a sell order + AllowedDenoms(context.Context, *QueryAllowedDenomsRequest) (*QueryAllowedDenomsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) SellOrder(ctx context.Context, req *QuerySellOrderRequest) (*QuerySellOrderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SellOrder not implemented") +} +func (*UnimplementedQueryServer) SellOrders(ctx context.Context, req *QuerySellOrdersRequest) (*QuerySellOrdersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SellOrders not implemented") +} +func (*UnimplementedQueryServer) SellOrdersByBatchDenom(ctx context.Context, req *QuerySellOrdersByBatchDenomRequest) (*QuerySellOrdersByBatchDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SellOrdersByBatchDenom not implemented") +} +func (*UnimplementedQueryServer) SellOrdersByAddress(ctx context.Context, req *QuerySellOrdersByAddressRequest) (*QuerySellOrdersByAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SellOrdersByAddress not implemented") +} +func (*UnimplementedQueryServer) BuyOrder(ctx context.Context, req *QueryBuyOrderRequest) (*QueryBuyOrderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BuyOrder not implemented") +} +func (*UnimplementedQueryServer) BuyOrders(ctx context.Context, req *QueryBuyOrdersRequest) (*QueryBuyOrdersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BuyOrders not implemented") +} +func (*UnimplementedQueryServer) BuyOrdersByAddress(ctx context.Context, req *QueryBuyOrdersByAddressRequest) (*QueryBuyOrdersByAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BuyOrdersByAddress not implemented") +} +func (*UnimplementedQueryServer) AllowedDenoms(ctx context.Context, req *QueryAllowedDenomsRequest) (*QueryAllowedDenomsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllowedDenoms not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_SellOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySellOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SellOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Query/SellOrder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SellOrder(ctx, req.(*QuerySellOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SellOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySellOrdersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SellOrders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Query/SellOrders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SellOrders(ctx, req.(*QuerySellOrdersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SellOrdersByBatchDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySellOrdersByBatchDenomRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SellOrdersByBatchDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Query/SellOrdersByBatchDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SellOrdersByBatchDenom(ctx, req.(*QuerySellOrdersByBatchDenomRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_SellOrdersByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QuerySellOrdersByAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).SellOrdersByAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Query/SellOrdersByAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).SellOrdersByAddress(ctx, req.(*QuerySellOrdersByAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BuyOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBuyOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BuyOrder(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Query/BuyOrder", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BuyOrder(ctx, req.(*QueryBuyOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BuyOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBuyOrdersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BuyOrders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Query/BuyOrders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BuyOrders(ctx, req.(*QueryBuyOrdersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_BuyOrdersByAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBuyOrdersByAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BuyOrdersByAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Query/BuyOrdersByAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BuyOrdersByAddress(ctx, req.(*QueryBuyOrdersByAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_AllowedDenoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllowedDenomsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).AllowedDenoms(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Query/AllowedDenoms", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).AllowedDenoms(ctx, req.(*QueryAllowedDenomsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "regen.ecocredit.marketplace.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SellOrder", + Handler: _Query_SellOrder_Handler, + }, + { + MethodName: "SellOrders", + Handler: _Query_SellOrders_Handler, + }, + { + MethodName: "SellOrdersByBatchDenom", + Handler: _Query_SellOrdersByBatchDenom_Handler, + }, + { + MethodName: "SellOrdersByAddress", + Handler: _Query_SellOrdersByAddress_Handler, + }, + { + MethodName: "BuyOrder", + Handler: _Query_BuyOrder_Handler, + }, + { + MethodName: "BuyOrders", + Handler: _Query_BuyOrders_Handler, + }, + { + MethodName: "BuyOrdersByAddress", + Handler: _Query_BuyOrdersByAddress_Handler, + }, + { + MethodName: "AllowedDenoms", + Handler: _Query_AllowedDenoms_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "regen/ecocredit/marketplace/v1beta1/query.proto", +} + +func (m *QuerySellOrderRequest) 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 *QuerySellOrderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySellOrderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SellOrderId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.SellOrderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QuerySellOrderResponse) 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 *QuerySellOrderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySellOrderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SellOrder != nil { + { + size, err := m.SellOrder.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySellOrdersRequest) 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 *QuerySellOrdersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySellOrdersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySellOrdersResponse) 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 *QuerySellOrdersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySellOrdersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.SellOrders) > 0 { + for iNdEx := len(m.SellOrders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SellOrders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QuerySellOrdersByBatchDenomRequest) 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 *QuerySellOrdersByBatchDenomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySellOrdersByBatchDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.BatchDenom) > 0 { + i -= len(m.BatchDenom) + copy(dAtA[i:], m.BatchDenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BatchDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySellOrdersByBatchDenomResponse) 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 *QuerySellOrdersByBatchDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySellOrdersByBatchDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.SellOrders) > 0 { + for iNdEx := len(m.SellOrders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SellOrders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QuerySellOrdersByAddressRequest) 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 *QuerySellOrdersByAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySellOrdersByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QuerySellOrdersByAddressResponse) 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 *QuerySellOrdersByAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QuerySellOrdersByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.SellOrders) > 0 { + for iNdEx := len(m.SellOrders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SellOrders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryBuyOrderRequest) 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 *QueryBuyOrderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuyOrderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BuyOrderId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.BuyOrderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryBuyOrderResponse) 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 *QueryBuyOrderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuyOrderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BuyOrder != nil { + { + size, err := m.BuyOrder.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBuyOrdersRequest) 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 *QueryBuyOrdersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuyOrdersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBuyOrdersResponse) 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 *QueryBuyOrdersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuyOrdersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.BuyOrders) > 0 { + for iNdEx := len(m.BuyOrders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BuyOrders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryBuyOrdersByAddressRequest) 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 *QueryBuyOrdersByAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuyOrdersByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBuyOrdersByAddressResponse) 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 *QueryBuyOrdersByAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBuyOrdersByAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.BuyOrders) > 0 { + for iNdEx := len(m.BuyOrders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BuyOrders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryAllowedDenomsRequest) 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 *QueryAllowedDenomsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllowedDenomsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryAllowedDenomsResponse) 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 *QueryAllowedDenomsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllowedDenomsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.AllowedDenoms) > 0 { + for iNdEx := len(m.AllowedDenoms) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AllowedDenoms[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QuerySellOrderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SellOrderId != 0 { + n += 1 + sovQuery(uint64(m.SellOrderId)) + } + return n +} + +func (m *QuerySellOrderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SellOrder != nil { + l = m.SellOrder.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySellOrdersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySellOrdersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SellOrders) > 0 { + for _, e := range m.SellOrders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySellOrdersByBatchDenomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BatchDenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySellOrdersByBatchDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SellOrders) > 0 { + for _, e := range m.SellOrders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySellOrdersByAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QuerySellOrdersByAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SellOrders) > 0 { + for _, e := range m.SellOrders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBuyOrderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BuyOrderId != 0 { + n += 1 + sovQuery(uint64(m.BuyOrderId)) + } + return n +} + +func (m *QueryBuyOrderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BuyOrder != nil { + l = m.BuyOrder.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBuyOrdersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBuyOrdersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BuyOrders) > 0 { + for _, e := range m.BuyOrders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBuyOrdersByAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBuyOrdersByAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BuyOrders) > 0 { + for _, e := range m.BuyOrders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllowedDenomsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryAllowedDenomsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.AllowedDenoms) > 0 { + for _, e := range m.AllowedDenoms { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QuerySellOrderRequest) 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 ErrIntOverflowQuery + } + 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: QuerySellOrderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySellOrderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrderId", wireType) + } + m.SellOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SellOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySellOrderResponse) 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 ErrIntOverflowQuery + } + 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: QuerySellOrderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySellOrderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrder", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SellOrder == nil { + m.SellOrder = &SellOrder{} + } + if err := m.SellOrder.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySellOrdersRequest) 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 ErrIntOverflowQuery + } + 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: QuerySellOrdersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySellOrdersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySellOrdersResponse) 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 ErrIntOverflowQuery + } + 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: QuerySellOrdersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySellOrdersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SellOrders = append(m.SellOrders, &SellOrder{}) + if err := m.SellOrders[len(m.SellOrders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySellOrdersByBatchDenomRequest) 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 ErrIntOverflowQuery + } + 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: QuerySellOrdersByBatchDenomRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySellOrdersByBatchDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BatchDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySellOrdersByBatchDenomResponse) 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 ErrIntOverflowQuery + } + 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: QuerySellOrdersByBatchDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySellOrdersByBatchDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SellOrders = append(m.SellOrders, &SellOrder{}) + if err := m.SellOrders[len(m.SellOrders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySellOrdersByAddressRequest) 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 ErrIntOverflowQuery + } + 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: QuerySellOrdersByAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySellOrdersByAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QuerySellOrdersByAddressResponse) 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 ErrIntOverflowQuery + } + 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: QuerySellOrdersByAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QuerySellOrdersByAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SellOrders = append(m.SellOrders, &SellOrder{}) + if err := m.SellOrders[len(m.SellOrders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBuyOrderRequest) 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 ErrIntOverflowQuery + } + 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: QueryBuyOrderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuyOrderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BuyOrderId", wireType) + } + m.BuyOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BuyOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBuyOrderResponse) 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 ErrIntOverflowQuery + } + 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: QueryBuyOrderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuyOrderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BuyOrder", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BuyOrder == nil { + m.BuyOrder = &BuyOrder{} + } + if err := m.BuyOrder.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBuyOrdersRequest) 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 ErrIntOverflowQuery + } + 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: QueryBuyOrdersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuyOrdersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBuyOrdersResponse) 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 ErrIntOverflowQuery + } + 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: QueryBuyOrdersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuyOrdersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BuyOrders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BuyOrders = append(m.BuyOrders, &BuyOrder{}) + if err := m.BuyOrders[len(m.BuyOrders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBuyOrdersByAddressRequest) 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 ErrIntOverflowQuery + } + 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: QueryBuyOrdersByAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuyOrdersByAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBuyOrdersByAddressResponse) 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 ErrIntOverflowQuery + } + 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: QueryBuyOrdersByAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBuyOrdersByAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BuyOrders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BuyOrders = append(m.BuyOrders, &BuyOrder{}) + if err := m.BuyOrders[len(m.BuyOrders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllowedDenomsRequest) 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 ErrIntOverflowQuery + } + 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: QueryAllowedDenomsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllowedDenomsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllowedDenomsResponse) 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 ErrIntOverflowQuery + } + 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: QueryAllowedDenomsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllowedDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedDenoms", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllowedDenoms = append(m.AllowedDenoms, &AllowedDenom{}) + if err := m.AllowedDenoms[len(m.AllowedDenoms)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/marketplace/v1beta1/query.pb.gw.go b/x/ecocredit/marketplace/v1beta1/query.pb.gw.go new file mode 100644 index 0000000000..09f8d09dd1 --- /dev/null +++ b/x/ecocredit/marketplace/v1beta1/query.pb.gw.go @@ -0,0 +1,896 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: regen/ecocredit/marketplace/v1beta1/query.proto + +/* +Package v1beta1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package v1beta1 + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_SellOrder_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySellOrderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["sell_order_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sell_order_id") + } + + protoReq.SellOrderId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sell_order_id", err) + } + + msg, err := client.SellOrder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SellOrder_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySellOrderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["sell_order_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "sell_order_id") + } + + protoReq.SellOrderId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "sell_order_id", err) + } + + msg, err := server.SellOrder(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_SellOrders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_SellOrders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySellOrdersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SellOrders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SellOrders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SellOrders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySellOrdersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SellOrders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SellOrders(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_SellOrdersByBatchDenom_0 = &utilities.DoubleArray{Encoding: map[string]int{"batch_denom": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_SellOrdersByBatchDenom_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySellOrdersByBatchDenomRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["batch_denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "batch_denom") + } + + protoReq.BatchDenom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "batch_denom", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SellOrdersByBatchDenom_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SellOrdersByBatchDenom(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SellOrdersByBatchDenom_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySellOrdersByBatchDenomRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["batch_denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "batch_denom") + } + + protoReq.BatchDenom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "batch_denom", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SellOrdersByBatchDenom_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SellOrdersByBatchDenom(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_SellOrdersByAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_SellOrdersByAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySellOrdersByAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SellOrdersByAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SellOrdersByAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_SellOrdersByAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QuerySellOrdersByAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_SellOrdersByAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SellOrdersByAddress(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_BuyOrder_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuyOrderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["buy_order_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "buy_order_id") + } + + protoReq.BuyOrderId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "buy_order_id", err) + } + + msg, err := client.BuyOrder(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BuyOrder_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuyOrderRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["buy_order_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "buy_order_id") + } + + protoReq.BuyOrderId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "buy_order_id", err) + } + + msg, err := server.BuyOrder(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_BuyOrders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_BuyOrders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuyOrdersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BuyOrders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.BuyOrders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BuyOrders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuyOrdersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BuyOrders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.BuyOrders(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_BuyOrdersByAddress_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_BuyOrdersByAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuyOrdersByAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BuyOrdersByAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.BuyOrdersByAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BuyOrdersByAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBuyOrdersByAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_BuyOrdersByAddress_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.BuyOrdersByAddress(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_AllowedDenoms_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_AllowedDenoms_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllowedDenomsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllowedDenoms_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AllowedDenoms(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_AllowedDenoms_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllowedDenomsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_AllowedDenoms_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AllowedDenoms(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_SellOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SellOrder_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SellOrder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SellOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SellOrders_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SellOrders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SellOrdersByBatchDenom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SellOrdersByBatchDenom_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SellOrdersByBatchDenom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SellOrdersByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_SellOrdersByAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SellOrdersByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BuyOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BuyOrder_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BuyOrder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BuyOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BuyOrders_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BuyOrders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BuyOrdersByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_BuyOrdersByAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BuyOrdersByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllowedDenoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_AllowedDenoms_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllowedDenoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_SellOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SellOrder_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SellOrder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SellOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SellOrders_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SellOrders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SellOrdersByBatchDenom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SellOrdersByBatchDenom_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SellOrdersByBatchDenom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_SellOrdersByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_SellOrdersByAddress_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_SellOrdersByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BuyOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BuyOrder_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BuyOrder_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BuyOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BuyOrders_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BuyOrders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_BuyOrdersByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_BuyOrdersByAddress_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_BuyOrdersByAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_AllowedDenoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_AllowedDenoms_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_AllowedDenoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_SellOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"regen", "ecocredit", "v1alpha1", "sell-orders", "id", "sell_order_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SellOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"regen", "ecocredit", "v1alpha1", "sell-orders"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SellOrdersByBatchDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"regen", "ecocredit", "v1alpha1", "sell-orders", "batch-denom", "batch_denom"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_SellOrdersByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 4}, []string{"regen", "ecocredit", "v1alpha1", "sell-orders", "address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BuyOrder_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"regen", "ecocredit", "v1alpha1", "buy-orders", "id", "buy_order_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BuyOrders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"regen", "ecocredit", "v1alpha1", "buy-orders"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_BuyOrdersByAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 4}, []string{"regen", "ecocredit", "v1alpha1", "buy-orders", "address"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_AllowedDenoms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"regen", "ecocredit", "v1alpha1", "ask-denoms"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_SellOrder_0 = runtime.ForwardResponseMessage + + forward_Query_SellOrders_0 = runtime.ForwardResponseMessage + + forward_Query_SellOrdersByBatchDenom_0 = runtime.ForwardResponseMessage + + forward_Query_SellOrdersByAddress_0 = runtime.ForwardResponseMessage + + forward_Query_BuyOrder_0 = runtime.ForwardResponseMessage + + forward_Query_BuyOrders_0 = runtime.ForwardResponseMessage + + forward_Query_BuyOrdersByAddress_0 = runtime.ForwardResponseMessage + + forward_Query_AllowedDenoms_0 = runtime.ForwardResponseMessage +) diff --git a/x/ecocredit/marketplace/v1beta1/state.pb.go b/x/ecocredit/marketplace/v1beta1/state.pb.go new file mode 100644 index 0000000000..789d5474e5 --- /dev/null +++ b/x/ecocredit/marketplace/v1beta1/state.pb.go @@ -0,0 +1,2232 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/marketplace/v1beta1/state.proto + +package v1beta1 + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/api/cosmos/orm/v1alpha1" + proto "github.com/gogo/protobuf/proto" + types "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// SellOrder represents the information for a sell order. +type SellOrder struct { + // id is the unique ID of sell order. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // seller is the bytes address of the owner of the credits being sold. + Seller []byte `protobuf:"bytes,2,opt,name=seller,proto3" json:"seller,omitempty"` + // batch_id is ID of the credit batch being sold. + BatchId uint64 `protobuf:"varint,3,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + // quantity is the decimal quantity of credits being sold. + Quantity string `protobuf:"bytes,4,opt,name=quantity,proto3" json:"quantity,omitempty"` + // market_id is the market in which this sell order exists and specifies + // the bank_denom that ask_price corresponds to. + MarketId uint64 `protobuf:"varint,5,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + // ask_price is the integer price (encoded as a string) the seller is asking + // for each unit of the batch_denom. Each credit unit of the batch will be + // sold for at least the ask_price or more. + AskPrice string `protobuf:"bytes,6,opt,name=ask_price,json=askPrice,proto3" json:"ask_price,omitempty"` + // disable_auto_retire disables auto-retirement of credits which allows a + // buyer to disable auto-retirement in their buy order enabling them to + // resell the credits to another buyer. + DisableAutoRetire bool `protobuf:"varint,7,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // expiration is an optional timestamp when the sell order expires. When the + // expiration time is reached, the sell order is removed from state. + Expiration *types.Timestamp `protobuf:"bytes,9,opt,name=expiration,proto3" json:"expiration,omitempty"` + // maker indicates that this is a maker order, meaning that when it hit + // the order book, there were no matching buy orders. + Maker bool `protobuf:"varint,10,opt,name=maker,proto3" json:"maker,omitempty"` +} + +func (m *SellOrder) Reset() { *m = SellOrder{} } +func (m *SellOrder) String() string { return proto.CompactTextString(m) } +func (*SellOrder) ProtoMessage() {} +func (*SellOrder) Descriptor() ([]byte, []int) { + return fileDescriptor_eb96826ffd3cfdd5, []int{0} +} +func (m *SellOrder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SellOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SellOrder.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 *SellOrder) XXX_Merge(src proto.Message) { + xxx_messageInfo_SellOrder.Merge(m, src) +} +func (m *SellOrder) XXX_Size() int { + return m.Size() +} +func (m *SellOrder) XXX_DiscardUnknown() { + xxx_messageInfo_SellOrder.DiscardUnknown(m) +} + +var xxx_messageInfo_SellOrder proto.InternalMessageInfo + +func (m *SellOrder) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *SellOrder) GetSeller() []byte { + if m != nil { + return m.Seller + } + return nil +} + +func (m *SellOrder) GetBatchId() uint64 { + if m != nil { + return m.BatchId + } + return 0 +} + +func (m *SellOrder) GetQuantity() string { + if m != nil { + return m.Quantity + } + return "" +} + +func (m *SellOrder) GetMarketId() uint64 { + if m != nil { + return m.MarketId + } + return 0 +} + +func (m *SellOrder) GetAskPrice() string { + if m != nil { + return m.AskPrice + } + return "" +} + +func (m *SellOrder) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *SellOrder) GetExpiration() *types.Timestamp { + if m != nil { + return m.Expiration + } + return nil +} + +func (m *SellOrder) GetMaker() bool { + if m != nil { + return m.Maker + } + return false +} + +// BuyOrder represents the information for a buy order. +type BuyOrder struct { + // id is the unique ID of buy order. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // buyer is the bytes address of the account that created the buy order + Buyer []byte `protobuf:"bytes,2,opt,name=buyer,proto3" json:"buyer,omitempty"` + // selection is the buy order selection. + Selection *BuyOrder_Selection `protobuf:"bytes,3,opt,name=selection,proto3" json:"selection,omitempty"` + // quantity is the decimal quantity of credits to buy. If the quantity of credits + // available is less than this amount the order will be partially filled + // unless disable_partial_fill is true. + Quantity string `protobuf:"bytes,4,opt,name=quantity,proto3" json:"quantity,omitempty"` + // market_id is the market in which this sell order exists and specifies + // the bank_denom that ask_price corresponds to. + MarketId uint64 `protobuf:"varint,5,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + // bid price is the integer bid price for this buy order. A credit unit will be + // settled at a purchase price that is no more than the bid price. The + // buy order will fail if the buyer does not have enough funds available + // to complete the purchase. + BidPrice string `protobuf:"bytes,6,opt,name=bid_price,json=bidPrice,proto3" json:"bid_price,omitempty"` + // disable_auto_retire allows auto-retirement to be disabled. If it is set to true + // the credits will not auto-retire and can be resold assuming that the + // corresponding sell order has auto-retirement disabled. If the sell order + // hasn't disabled auto-retirement and the buy order tries to disable it, + // that buy order will fail. + DisableAutoRetire bool `protobuf:"varint,7,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // disable_partial_fill disables the default behavior of partially filling + // buy orders if the requested quantity is not available. + DisablePartialFill bool `protobuf:"varint,8,opt,name=disable_partial_fill,json=disablePartialFill,proto3" json:"disable_partial_fill,omitempty"` + // expiration is the optional timestamp when the buy order expires. When the + // expiration time is reached, the buy order is removed from state. + Expiration *types.Timestamp `protobuf:"bytes,9,opt,name=expiration,proto3" json:"expiration,omitempty"` + // maker indicates that this is a maker order, meaning that when it hit + // the order book, there were no matching sell orders. + Maker bool `protobuf:"varint,10,opt,name=maker,proto3" json:"maker,omitempty"` +} + +func (m *BuyOrder) Reset() { *m = BuyOrder{} } +func (m *BuyOrder) String() string { return proto.CompactTextString(m) } +func (*BuyOrder) ProtoMessage() {} +func (*BuyOrder) Descriptor() ([]byte, []int) { + return fileDescriptor_eb96826ffd3cfdd5, []int{1} +} +func (m *BuyOrder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BuyOrder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BuyOrder.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 *BuyOrder) XXX_Merge(src proto.Message) { + xxx_messageInfo_BuyOrder.Merge(m, src) +} +func (m *BuyOrder) XXX_Size() int { + return m.Size() +} +func (m *BuyOrder) XXX_DiscardUnknown() { + xxx_messageInfo_BuyOrder.DiscardUnknown(m) +} + +var xxx_messageInfo_BuyOrder proto.InternalMessageInfo + +func (m *BuyOrder) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *BuyOrder) GetBuyer() []byte { + if m != nil { + return m.Buyer + } + return nil +} + +func (m *BuyOrder) GetSelection() *BuyOrder_Selection { + if m != nil { + return m.Selection + } + return nil +} + +func (m *BuyOrder) GetQuantity() string { + if m != nil { + return m.Quantity + } + return "" +} + +func (m *BuyOrder) GetMarketId() uint64 { + if m != nil { + return m.MarketId + } + return 0 +} + +func (m *BuyOrder) GetBidPrice() string { + if m != nil { + return m.BidPrice + } + return "" +} + +func (m *BuyOrder) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *BuyOrder) GetDisablePartialFill() bool { + if m != nil { + return m.DisablePartialFill + } + return false +} + +func (m *BuyOrder) GetExpiration() *types.Timestamp { + if m != nil { + return m.Expiration + } + return nil +} + +func (m *BuyOrder) GetMaker() bool { + if m != nil { + return m.Maker + } + return false +} + +// Selection defines a buy order selection. +type BuyOrder_Selection struct { + // sum defines the type of selection. + // + // Types that are valid to be assigned to Sum: + // *BuyOrder_Selection_SellOrderId + // *BuyOrder_Selection_Filter + Sum isBuyOrder_Selection_Sum `protobuf_oneof:"sum"` +} + +func (m *BuyOrder_Selection) Reset() { *m = BuyOrder_Selection{} } +func (m *BuyOrder_Selection) String() string { return proto.CompactTextString(m) } +func (*BuyOrder_Selection) ProtoMessage() {} +func (*BuyOrder_Selection) Descriptor() ([]byte, []int) { + return fileDescriptor_eb96826ffd3cfdd5, []int{1, 0} +} +func (m *BuyOrder_Selection) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BuyOrder_Selection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BuyOrder_Selection.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 *BuyOrder_Selection) XXX_Merge(src proto.Message) { + xxx_messageInfo_BuyOrder_Selection.Merge(m, src) +} +func (m *BuyOrder_Selection) XXX_Size() int { + return m.Size() +} +func (m *BuyOrder_Selection) XXX_DiscardUnknown() { + xxx_messageInfo_BuyOrder_Selection.DiscardUnknown(m) +} + +var xxx_messageInfo_BuyOrder_Selection proto.InternalMessageInfo + +type isBuyOrder_Selection_Sum interface { + isBuyOrder_Selection_Sum() + MarshalTo([]byte) (int, error) + Size() int +} + +type BuyOrder_Selection_SellOrderId struct { + SellOrderId uint64 `protobuf:"varint,1,opt,name=sell_order_id,json=sellOrderId,proto3,oneof" json:"sell_order_id,omitempty"` +} +type BuyOrder_Selection_Filter struct { + Filter *Filter `protobuf:"bytes,2,opt,name=filter,proto3,oneof" json:"filter,omitempty"` +} + +func (*BuyOrder_Selection_SellOrderId) isBuyOrder_Selection_Sum() {} +func (*BuyOrder_Selection_Filter) isBuyOrder_Selection_Sum() {} + +func (m *BuyOrder_Selection) GetSum() isBuyOrder_Selection_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *BuyOrder_Selection) GetSellOrderId() uint64 { + if x, ok := m.GetSum().(*BuyOrder_Selection_SellOrderId); ok { + return x.SellOrderId + } + return 0 +} + +func (m *BuyOrder_Selection) GetFilter() *Filter { + if x, ok := m.GetSum().(*BuyOrder_Selection_Filter); ok { + return x.Filter + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*BuyOrder_Selection) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*BuyOrder_Selection_SellOrderId)(nil), + (*BuyOrder_Selection_Filter)(nil), + } +} + +// AllowedDenom represents the information for an allowed ask/bid denom. +type AllowedDenom struct { + // denom is the bank denom to allow (ex. ibc/GLKHDSG423SGS) + BankDenom string `protobuf:"bytes,1,opt,name=bank_denom,json=bankDenom,proto3" json:"bank_denom,omitempty"` + // display_denom is the denom to display to the user and is informational. + // Because the denom is likely an IBC denom, this should be chosen by + // governance to represent the consensus trusted name of the denom. + DisplayDenom string `protobuf:"bytes,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 *AllowedDenom) Reset() { *m = AllowedDenom{} } +func (m *AllowedDenom) String() string { return proto.CompactTextString(m) } +func (*AllowedDenom) ProtoMessage() {} +func (*AllowedDenom) Descriptor() ([]byte, []int) { + return fileDescriptor_eb96826ffd3cfdd5, []int{2} +} +func (m *AllowedDenom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AllowedDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AllowedDenom.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 *AllowedDenom) XXX_Merge(src proto.Message) { + xxx_messageInfo_AllowedDenom.Merge(m, src) +} +func (m *AllowedDenom) XXX_Size() int { + return m.Size() +} +func (m *AllowedDenom) XXX_DiscardUnknown() { + xxx_messageInfo_AllowedDenom.DiscardUnknown(m) +} + +var xxx_messageInfo_AllowedDenom proto.InternalMessageInfo + +func (m *AllowedDenom) GetBankDenom() string { + if m != nil { + return m.BankDenom + } + return "" +} + +func (m *AllowedDenom) GetDisplayDenom() string { + if m != nil { + return m.DisplayDenom + } + return "" +} + +func (m *AllowedDenom) GetExponent() uint32 { + if m != nil { + return m.Exponent + } + return 0 +} + +// Market describes a distinctly processed market between a credit type and +// allowed bank denom. Each market has its own precision in the order book +// and is processed independently of other markets. Governance must enable +// markets one by one. Every additional enabled market potentially adds more +// processing overhead to the blockchain and potentially weakens liquidity in +// competing markets. For instance, enabling side by side USD/Carbon and +// EUR/Carbon markets may have the end result that each market individually has +// less liquidity and longer settlement times. Such decisions should be taken +// with care. +type Market struct { + // id is the unique ID of the market. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // credit_type is the abbreviation of the credit type. + CreditType string `protobuf:"bytes,2,opt,name=credit_type,json=creditType,proto3" json:"credit_type,omitempty"` + // bank_denom is an allowed bank denom. + BankDenom string `protobuf:"bytes,3,opt,name=bank_denom,json=bankDenom,proto3" json:"bank_denom,omitempty"` + // precision_modifier is an optional modifier used to convert arbitrary + // precision integer bank amounts to uint32 values used for sorting in the + // order book. Given an arbitrary precision integer x, its uint32 conversion + // will be x / 10^precision_modifier using round half away from zero + // rounding. + // + // uint32 values range from 0 to 4,294,967,295. + // This allows for a full 9 digits of precision. In most real world markets + // this amount of precision is sufficient and most common downside - + // that some orders with very miniscule price differences may be ordered + // equivalently (because of rounding) - is acceptable. + // Note that this rounding will not affect settlement price which will + // always be done exactly. + // + // Given a USD stable coin with 6 decimal digits, a precision_modifier + // of 0 is probably acceptable as long as credits are always less than + // $4,294/unit. With precision down to $0.001 (a precision_modifier of 3 + // in this case), prices can rise up to $4,294,000/unit. Either scenario + // is probably quite acceptable given that carbon prices are unlikely to + // rise above $1000/ton any time in the near future. + // + // If credit prices, exceed the maximum range of uint32 with this + // precision_modifier, orders with high prices will fail and governance + // will need to adjust precision_modifier to allow for higher prices in + // exchange for less precision at the lower end. + PrecisionModifier uint32 `protobuf:"varint,4,opt,name=precision_modifier,json=precisionModifier,proto3" json:"precision_modifier,omitempty"` +} + +func (m *Market) Reset() { *m = Market{} } +func (m *Market) String() string { return proto.CompactTextString(m) } +func (*Market) ProtoMessage() {} +func (*Market) Descriptor() ([]byte, []int) { + return fileDescriptor_eb96826ffd3cfdd5, []int{3} +} +func (m *Market) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Market) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Market.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 *Market) XXX_Merge(src proto.Message) { + xxx_messageInfo_Market.Merge(m, src) +} +func (m *Market) XXX_Size() int { + return m.Size() +} +func (m *Market) XXX_DiscardUnknown() { + xxx_messageInfo_Market.DiscardUnknown(m) +} + +var xxx_messageInfo_Market proto.InternalMessageInfo + +func (m *Market) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *Market) GetCreditType() string { + if m != nil { + return m.CreditType + } + return "" +} + +func (m *Market) GetBankDenom() string { + if m != nil { + return m.BankDenom + } + return "" +} + +func (m *Market) GetPrecisionModifier() uint32 { + if m != nil { + return m.PrecisionModifier + } + return 0 +} + +func init() { + proto.RegisterType((*SellOrder)(nil), "regen.ecocredit.marketplace.v1beta1.SellOrder") + proto.RegisterType((*BuyOrder)(nil), "regen.ecocredit.marketplace.v1beta1.BuyOrder") + proto.RegisterType((*BuyOrder_Selection)(nil), "regen.ecocredit.marketplace.v1beta1.BuyOrder.Selection") + proto.RegisterType((*AllowedDenom)(nil), "regen.ecocredit.marketplace.v1beta1.AllowedDenom") + proto.RegisterType((*Market)(nil), "regen.ecocredit.marketplace.v1beta1.Market") +} + +func init() { + proto.RegisterFile("regen/ecocredit/marketplace/v1beta1/state.proto", fileDescriptor_eb96826ffd3cfdd5) +} + +var fileDescriptor_eb96826ffd3cfdd5 = []byte{ + // 751 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0xaf, 0xdb, 0x44, + 0x14, 0xcd, 0x38, 0x1f, 0x8d, 0x27, 0x49, 0x95, 0x4e, 0x9f, 0x2a, 0x13, 0x68, 0x1a, 0xa5, 0x20, + 0x45, 0x2a, 0xb5, 0x49, 0x41, 0x42, 0xca, 0xae, 0x4f, 0xb4, 0xea, 0x5b, 0x54, 0x54, 0x6e, 0xd9, + 0xb0, 0xb1, 0xc6, 0x9e, 0x9b, 0xbc, 0x51, 0xc6, 0x1e, 0x33, 0x1e, 0xb7, 0x2f, 0x2b, 0xfe, 0x01, + 0x62, 0x8f, 0xc4, 0xdf, 0x60, 0xc9, 0x96, 0x65, 0x25, 0x36, 0x2c, 0x51, 0xde, 0x3f, 0xe0, 0x17, + 0x20, 0x8f, 0x3f, 0x5e, 0x08, 0x08, 0x3d, 0x41, 0x97, 0x67, 0xee, 0x3d, 0x73, 0x8f, 0xcf, 0x3d, + 0x1e, 0xec, 0x29, 0xd8, 0x40, 0xe2, 0x41, 0x24, 0x23, 0x05, 0x8c, 0x6b, 0x2f, 0xa6, 0x6a, 0x0b, + 0x3a, 0x15, 0x34, 0x02, 0xef, 0xf5, 0x32, 0x04, 0x4d, 0x97, 0x5e, 0xa6, 0xa9, 0x06, 0x37, 0x55, + 0x52, 0x4b, 0x72, 0xdf, 0x10, 0xdc, 0x86, 0xe0, 0x1e, 0x10, 0xdc, 0x8a, 0x30, 0xb9, 0xb7, 0x91, + 0x72, 0x23, 0xc0, 0x33, 0x94, 0x30, 0x5f, 0x7b, 0x9a, 0xc7, 0x90, 0x69, 0x1a, 0xa7, 0xe5, 0x2d, + 0x93, 0xbb, 0x91, 0xcc, 0x62, 0x99, 0x79, 0x52, 0xc5, 0xde, 0xeb, 0x25, 0x15, 0xe9, 0x39, 0x5d, + 0x16, 0xa0, 0x2a, 0x5f, 0x4b, 0x95, 0xde, 0xa5, 0x90, 0x95, 0x84, 0xf9, 0xde, 0xc2, 0xf6, 0x4b, + 0x10, 0xe2, 0x4b, 0xc5, 0x40, 0x91, 0x9b, 0xd8, 0xe2, 0xcc, 0x41, 0x33, 0xb4, 0xe8, 0xf8, 0x16, + 0x67, 0xe4, 0x0e, 0xee, 0x65, 0x20, 0x04, 0x28, 0xc7, 0x9a, 0xa1, 0xc5, 0xd0, 0xaf, 0x10, 0x79, + 0x0f, 0xf7, 0x43, 0xaa, 0xa3, 0xf3, 0x80, 0x33, 0xa7, 0x6d, 0xba, 0x6f, 0x18, 0x7c, 0xc6, 0xc8, + 0x04, 0xf7, 0xbf, 0xc9, 0x69, 0xa2, 0xb9, 0xde, 0x39, 0x9d, 0x19, 0x5a, 0xd8, 0x7e, 0x83, 0xc9, + 0xfb, 0xd8, 0x2e, 0xf5, 0x14, 0xbc, 0xae, 0xe1, 0xf5, 0xcb, 0x83, 0x33, 0x56, 0x14, 0x69, 0xb6, + 0x0d, 0x52, 0xc5, 0x23, 0x70, 0x7a, 0x25, 0x93, 0x66, 0xdb, 0x17, 0x05, 0x26, 0x2e, 0xbe, 0xcd, + 0x78, 0x46, 0x43, 0x01, 0x01, 0xcd, 0xb5, 0x0c, 0x14, 0x68, 0xae, 0xc0, 0xb9, 0x31, 0x43, 0x8b, + 0xbe, 0x7f, 0xab, 0x2a, 0x3d, 0xce, 0xb5, 0xf4, 0x4d, 0x81, 0xac, 0x30, 0x86, 0x8b, 0x94, 0x2b, + 0xaa, 0xb9, 0x4c, 0x1c, 0x7b, 0x86, 0x16, 0x83, 0x47, 0x13, 0xb7, 0x34, 0xd7, 0xad, 0xcd, 0x75, + 0x5f, 0xd5, 0xe6, 0xfa, 0x07, 0xdd, 0xe4, 0x04, 0x77, 0x63, 0xba, 0x05, 0xe5, 0x60, 0x73, 0x7b, + 0x09, 0x56, 0xab, 0x3f, 0x7e, 0xfc, 0xf5, 0xbb, 0xf6, 0x67, 0xb8, 0x57, 0x58, 0x34, 0x46, 0x64, + 0x78, 0x65, 0xc1, 0x18, 0x11, 0x5c, 0x1b, 0x35, 0xb6, 0xc8, 0xcd, 0xc3, 0xd9, 0xe3, 0xb6, 0x83, + 0xe6, 0x3f, 0x77, 0x70, 0xff, 0x34, 0xdf, 0xfd, 0xb3, 0xc7, 0x27, 0xb8, 0x1b, 0xe6, 0xbb, 0xc6, + 0xe2, 0x12, 0x90, 0xaf, 0xb0, 0x9d, 0x81, 0x80, 0xc8, 0xe8, 0x6f, 0x1b, 0xfd, 0x9f, 0xbb, 0xd7, + 0x48, 0x90, 0x5b, 0xcf, 0x71, 0x5f, 0xd6, 0x74, 0xff, 0xea, 0xa6, 0xff, 0xb5, 0x9d, 0x90, 0xb3, + 0xbf, 0x6e, 0x27, 0xe4, 0xec, 0xbf, 0x6d, 0xe7, 0x13, 0x7c, 0x52, 0xf7, 0xa7, 0x54, 0x69, 0x4e, + 0x45, 0xb0, 0xe6, 0x42, 0x38, 0x7d, 0x43, 0x20, 0x55, 0xed, 0x45, 0x59, 0x7a, 0xca, 0x85, 0x78, + 0xf7, 0xfb, 0x9c, 0x7c, 0x6b, 0x72, 0x5f, 0xd9, 0xf2, 0x21, 0x1e, 0x15, 0xeb, 0x0b, 0x64, 0xe1, + 0x5c, 0x50, 0xaf, 0xe7, 0x59, 0xcb, 0x1f, 0x64, 0xf5, 0xbf, 0x71, 0xc6, 0xc8, 0x13, 0xdc, 0x5b, + 0x73, 0xa1, 0xab, 0x55, 0x0d, 0x1e, 0x3d, 0xb8, 0xd6, 0x42, 0x9e, 0x1a, 0xca, 0xb3, 0x96, 0x5f, + 0x91, 0x4f, 0xbb, 0xb8, 0x9d, 0xe5, 0xf1, 0xea, 0x81, 0x09, 0xd4, 0x47, 0x4d, 0xa0, 0xec, 0x2a, + 0x07, 0x63, 0x74, 0x94, 0x20, 0xcb, 0xb1, 0xe6, 0x3f, 0x20, 0x3c, 0x7c, 0x2c, 0x84, 0x7c, 0x03, + 0xec, 0x0b, 0x48, 0x64, 0x4c, 0xee, 0x62, 0x1c, 0xd2, 0x64, 0x1b, 0xb0, 0x02, 0x19, 0xb9, 0xb6, + 0x6f, 0x17, 0x27, 0x65, 0xf9, 0x3e, 0x1e, 0x31, 0x9e, 0xa5, 0x82, 0xee, 0xaa, 0x0e, 0xcb, 0x74, + 0x0c, 0xab, 0xc3, 0xb2, 0x69, 0x82, 0xfb, 0x70, 0x91, 0xca, 0x04, 0x12, 0x6d, 0x22, 0x36, 0xf2, + 0x1b, 0xdc, 0xa8, 0x1b, 0x1e, 0xce, 0x21, 0xb7, 0x8f, 0xae, 0x1d, 0x23, 0x07, 0x39, 0xed, 0xf9, + 0x4f, 0x08, 0xf7, 0x9e, 0x9b, 0x4f, 0xff, 0x5b, 0xba, 0xef, 0xe1, 0x41, 0xe9, 0x4d, 0x50, 0xbc, + 0x3a, 0x95, 0x0c, 0x5c, 0x1e, 0xbd, 0xda, 0xa5, 0x70, 0xf4, 0x21, 0xed, 0xe3, 0x0f, 0x79, 0x88, + 0x49, 0xaa, 0x20, 0xe2, 0x19, 0x97, 0x49, 0x10, 0x4b, 0xc6, 0xd7, 0x1c, 0x94, 0x89, 0xee, 0xc8, + 0xbf, 0xd5, 0x54, 0x9e, 0x57, 0x85, 0x95, 0x6b, 0x64, 0x2f, 0x1a, 0x53, 0x3f, 0xc0, 0x77, 0x0e, + 0xc6, 0x7f, 0x7c, 0x35, 0xc9, 0x28, 0xef, 0x9c, 0x06, 0xbf, 0xec, 0xa7, 0xe8, 0xed, 0x7e, 0x8a, + 0x7e, 0xdf, 0x4f, 0xd1, 0xf7, 0x97, 0xd3, 0xd6, 0xdb, 0xcb, 0x69, 0xeb, 0xb7, 0xcb, 0x69, 0xeb, + 0xeb, 0x27, 0x1b, 0xae, 0xcf, 0xf3, 0xd0, 0x8d, 0x64, 0x5c, 0x3e, 0xaa, 0x0f, 0x13, 0xd0, 0x6f, + 0xa4, 0xda, 0x56, 0x48, 0x00, 0xdb, 0x80, 0xf2, 0x2e, 0xfe, 0xfd, 0xad, 0x0d, 0x7b, 0x26, 0x9c, + 0x9f, 0xfe, 0x19, 0x00, 0x00, 0xff, 0xff, 0x62, 0x62, 0x31, 0x4c, 0x2f, 0x06, 0x00, 0x00, +} + +func (m *SellOrder) 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 *SellOrder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SellOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Maker { + i-- + if m.Maker { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + if m.Expiration != nil { + { + size, err := m.Expiration.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if len(m.AskPrice) > 0 { + i -= len(m.AskPrice) + copy(dAtA[i:], m.AskPrice) + i = encodeVarintState(dAtA, i, uint64(len(m.AskPrice))) + i-- + dAtA[i] = 0x32 + } + if m.MarketId != 0 { + i = encodeVarintState(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x28 + } + if len(m.Quantity) > 0 { + i -= len(m.Quantity) + copy(dAtA[i:], m.Quantity) + i = encodeVarintState(dAtA, i, uint64(len(m.Quantity))) + i-- + dAtA[i] = 0x22 + } + if m.BatchId != 0 { + i = encodeVarintState(dAtA, i, uint64(m.BatchId)) + i-- + dAtA[i] = 0x18 + } + if len(m.Seller) > 0 { + i -= len(m.Seller) + copy(dAtA[i:], m.Seller) + i = encodeVarintState(dAtA, i, uint64(len(m.Seller))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintState(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BuyOrder) 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 *BuyOrder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BuyOrder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Maker { + i-- + if m.Maker { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x50 + } + if m.Expiration != nil { + { + size, err := m.Expiration.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + if m.DisablePartialFill { + i-- + if m.DisablePartialFill { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if len(m.BidPrice) > 0 { + i -= len(m.BidPrice) + copy(dAtA[i:], m.BidPrice) + i = encodeVarintState(dAtA, i, uint64(len(m.BidPrice))) + i-- + dAtA[i] = 0x32 + } + if m.MarketId != 0 { + i = encodeVarintState(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x28 + } + if len(m.Quantity) > 0 { + i -= len(m.Quantity) + copy(dAtA[i:], m.Quantity) + i = encodeVarintState(dAtA, i, uint64(len(m.Quantity))) + i-- + dAtA[i] = 0x22 + } + if m.Selection != nil { + { + size, err := m.Selection.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Buyer) > 0 { + i -= len(m.Buyer) + copy(dAtA[i:], m.Buyer) + i = encodeVarintState(dAtA, i, uint64(len(m.Buyer))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintState(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *BuyOrder_Selection) 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 *BuyOrder_Selection) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BuyOrder_Selection) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Sum != nil { + { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *BuyOrder_Selection_SellOrderId) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BuyOrder_Selection_SellOrderId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i = encodeVarintState(dAtA, i, uint64(m.SellOrderId)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} +func (m *BuyOrder_Selection_Filter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BuyOrder_Selection_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Filter != nil { + { + size, err := m.Filter.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *AllowedDenom) 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 *AllowedDenom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AllowedDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Exponent != 0 { + i = encodeVarintState(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x18 + } + if len(m.DisplayDenom) > 0 { + i -= len(m.DisplayDenom) + copy(dAtA[i:], m.DisplayDenom) + i = encodeVarintState(dAtA, i, uint64(len(m.DisplayDenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.BankDenom) > 0 { + i -= len(m.BankDenom) + copy(dAtA[i:], m.BankDenom) + i = encodeVarintState(dAtA, i, uint64(len(m.BankDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Market) 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 *Market) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Market) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PrecisionModifier != 0 { + i = encodeVarintState(dAtA, i, uint64(m.PrecisionModifier)) + i-- + dAtA[i] = 0x20 + } + if len(m.BankDenom) > 0 { + i -= len(m.BankDenom) + copy(dAtA[i:], m.BankDenom) + i = encodeVarintState(dAtA, i, uint64(len(m.BankDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.CreditType) > 0 { + i -= len(m.CreditType) + copy(dAtA[i:], m.CreditType) + i = encodeVarintState(dAtA, i, uint64(len(m.CreditType))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintState(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintState(dAtA []byte, offset int, v uint64) int { + offset -= sovState(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *SellOrder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovState(uint64(m.Id)) + } + l = len(m.Seller) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.BatchId != 0 { + n += 1 + sovState(uint64(m.BatchId)) + } + l = len(m.Quantity) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.MarketId != 0 { + n += 1 + sovState(uint64(m.MarketId)) + } + l = len(m.AskPrice) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.DisableAutoRetire { + n += 2 + } + if m.Expiration != nil { + l = m.Expiration.Size() + n += 1 + l + sovState(uint64(l)) + } + if m.Maker { + n += 2 + } + return n +} + +func (m *BuyOrder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovState(uint64(m.Id)) + } + l = len(m.Buyer) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.Selection != nil { + l = m.Selection.Size() + n += 1 + l + sovState(uint64(l)) + } + l = len(m.Quantity) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.MarketId != 0 { + n += 1 + sovState(uint64(m.MarketId)) + } + l = len(m.BidPrice) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.DisableAutoRetire { + n += 2 + } + if m.DisablePartialFill { + n += 2 + } + if m.Expiration != nil { + l = m.Expiration.Size() + n += 1 + l + sovState(uint64(l)) + } + if m.Maker { + n += 2 + } + return n +} + +func (m *BuyOrder_Selection) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *BuyOrder_Selection_SellOrderId) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovState(uint64(m.SellOrderId)) + return n +} +func (m *BuyOrder_Selection_Filter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Filter != nil { + l = m.Filter.Size() + n += 1 + l + sovState(uint64(l)) + } + return n +} +func (m *AllowedDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BankDenom) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + l = len(m.DisplayDenom) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovState(uint64(m.Exponent)) + } + return n +} + +func (m *Market) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovState(uint64(m.Id)) + } + l = len(m.CreditType) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + l = len(m.BankDenom) + if l > 0 { + n += 1 + l + sovState(uint64(l)) + } + if m.PrecisionModifier != 0 { + n += 1 + sovState(uint64(m.PrecisionModifier)) + } + return n +} + +func sovState(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozState(x uint64) (n int) { + return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *SellOrder) 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 ErrIntOverflowState + } + 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: SellOrder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SellOrder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Seller", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Seller = append(m.Seller[:0], dAtA[iNdEx:postIndex]...) + if m.Seller == nil { + m.Seller = []byte{} + } + iNdEx = postIndex + case 3: + 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 ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BatchId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Quantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AskPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AskPrice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Expiration == nil { + m.Expiration = &types.Timestamp{} + } + if err := m.Expiration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Maker", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Maker = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BuyOrder) 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 ErrIntOverflowState + } + 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: BuyOrder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BuyOrder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Buyer", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Buyer = append(m.Buyer[:0], dAtA[iNdEx:postIndex]...) + if m.Buyer == nil { + m.Buyer = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selection", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Selection == nil { + m.Selection = &BuyOrder_Selection{} + } + if err := m.Selection.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Quantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BidPrice = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisablePartialFill", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisablePartialFill = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Expiration == nil { + m.Expiration = &types.Timestamp{} + } + if err := m.Expiration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Maker", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Maker = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BuyOrder_Selection) 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 ErrIntOverflowState + } + 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: Selection: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Selection: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrderId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sum = &BuyOrder_Selection_SellOrderId{v} + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Filter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &BuyOrder_Selection_Filter{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AllowedDenom) 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 ErrIntOverflowState + } + 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: AllowedDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AllowedDenom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BankDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BankDenom = 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 ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + 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 ErrIntOverflowState + } + 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 := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Market) 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 ErrIntOverflowState + } + 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: Market: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Market: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreditType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CreditType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BankDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + 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 ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BankDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PrecisionModifier", wireType) + } + m.PrecisionModifier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PrecisionModifier |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipState(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthState + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipState(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowState + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthState + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupState + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthState + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowState = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/marketplace/v1beta1/tx.pb.go b/x/ecocredit/marketplace/v1beta1/tx.pb.go new file mode 100644 index 0000000000..6f7ef9666f --- /dev/null +++ b/x/ecocredit/marketplace/v1beta1/tx.pb.go @@ -0,0 +1,3716 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/marketplace/v1beta1/tx.proto + +package v1beta1 + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgSell is the Msg/Sell request type. +type MsgSell struct { + // owner is the address of the owner of the credits being sold. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // orders are the sell orders being created. + Orders []*MsgSell_Order `protobuf:"bytes,2,rep,name=orders,proto3" json:"orders,omitempty"` +} + +func (m *MsgSell) Reset() { *m = MsgSell{} } +func (m *MsgSell) String() string { return proto.CompactTextString(m) } +func (*MsgSell) ProtoMessage() {} +func (*MsgSell) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{0} +} +func (m *MsgSell) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSell) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSell.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 *MsgSell) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSell.Merge(m, src) +} +func (m *MsgSell) XXX_Size() int { + return m.Size() +} +func (m *MsgSell) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSell.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSell proto.InternalMessageInfo + +func (m *MsgSell) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *MsgSell) GetOrders() []*MsgSell_Order { + if m != nil { + return m.Orders + } + return nil +} + +// Order is the content of a new sell order. +type MsgSell_Order struct { + // batch_denom is the credit batch being sold. + BatchDenom string `protobuf:"bytes,1,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + // quantity is the quantity of credits being sold from this batch. If it is + // less then the balance of credits the owner has available at the time this + // sell order is matched, the quantity will be adjusted downwards to the + // owner's balance. However, if the balance of credits is less than this + // quantity at the time the sell order is created, the operation will fail. + Quantity string `protobuf:"bytes,2,opt,name=quantity,proto3" json:"quantity,omitempty"` + // ask_price is the price the seller is asking for each unit of the + // batch_denom. Each credit unit of the batch will be sold for at least the + // ask_price or more. + AskPrice *types.Coin `protobuf:"bytes,3,opt,name=ask_price,json=askPrice,proto3" json:"ask_price,omitempty"` + // disable_auto_retire disables auto-retirement of credits which allows a + // buyer to disable auto-retirement in their buy order enabling them to + // resell the credits to another buyer. + DisableAutoRetire bool `protobuf:"varint,4,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // expiration is an optional timestamp when the sell order expires. When the + // expiration time is reached, the sell order is removed from state. + Expiration *time.Time `protobuf:"bytes,5,opt,name=expiration,proto3,stdtime" json:"expiration,omitempty"` +} + +func (m *MsgSell_Order) Reset() { *m = MsgSell_Order{} } +func (m *MsgSell_Order) String() string { return proto.CompactTextString(m) } +func (*MsgSell_Order) ProtoMessage() {} +func (*MsgSell_Order) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{0, 0} +} +func (m *MsgSell_Order) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSell_Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSell_Order.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 *MsgSell_Order) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSell_Order.Merge(m, src) +} +func (m *MsgSell_Order) XXX_Size() int { + return m.Size() +} +func (m *MsgSell_Order) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSell_Order.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSell_Order proto.InternalMessageInfo + +func (m *MsgSell_Order) GetBatchDenom() string { + if m != nil { + return m.BatchDenom + } + return "" +} + +func (m *MsgSell_Order) GetQuantity() string { + if m != nil { + return m.Quantity + } + return "" +} + +func (m *MsgSell_Order) GetAskPrice() *types.Coin { + if m != nil { + return m.AskPrice + } + return nil +} + +func (m *MsgSell_Order) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *MsgSell_Order) GetExpiration() *time.Time { + if m != nil { + return m.Expiration + } + return nil +} + +// MsgSellResponse is the Msg/Sell response type. +type MsgSellResponse struct { + // sell_order_ids are the sell order IDs of the newly created sell orders. + SellOrderIds []uint64 `protobuf:"varint,1,rep,packed,name=sell_order_ids,json=sellOrderIds,proto3" json:"sell_order_ids,omitempty"` +} + +func (m *MsgSellResponse) Reset() { *m = MsgSellResponse{} } +func (m *MsgSellResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSellResponse) ProtoMessage() {} +func (*MsgSellResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{1} +} +func (m *MsgSellResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSellResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSellResponse.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 *MsgSellResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSellResponse.Merge(m, src) +} +func (m *MsgSellResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSellResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSellResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSellResponse proto.InternalMessageInfo + +func (m *MsgSellResponse) GetSellOrderIds() []uint64 { + if m != nil { + return m.SellOrderIds + } + return nil +} + +// MsgUpdateSellOrders is the Msg/UpdateSellOrders request type. +type MsgUpdateSellOrders struct { + // owner is the owner of the sell orders. + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + // updates are updates to existing sell orders. + Updates []*MsgUpdateSellOrders_Update `protobuf:"bytes,2,rep,name=updates,proto3" json:"updates,omitempty"` +} + +func (m *MsgUpdateSellOrders) Reset() { *m = MsgUpdateSellOrders{} } +func (m *MsgUpdateSellOrders) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateSellOrders) ProtoMessage() {} +func (*MsgUpdateSellOrders) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{2} +} +func (m *MsgUpdateSellOrders) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateSellOrders) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateSellOrders.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 *MsgUpdateSellOrders) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateSellOrders.Merge(m, src) +} +func (m *MsgUpdateSellOrders) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateSellOrders) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateSellOrders.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateSellOrders proto.InternalMessageInfo + +func (m *MsgUpdateSellOrders) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *MsgUpdateSellOrders) GetUpdates() []*MsgUpdateSellOrders_Update { + if m != nil { + return m.Updates + } + return nil +} + +// Update is an update to an existing sell order. +type MsgUpdateSellOrders_Update struct { + // sell_order_id is the ID of an existing sell order. + SellOrderId uint64 `protobuf:"varint,1,opt,name=sell_order_id,json=sellOrderId,proto3" json:"sell_order_id,omitempty"` + // new_quantity is the updated quantity of credits available to sell, if it + // is set to zero then the order is cancelled. + NewQuantity string `protobuf:"bytes,2,opt,name=new_quantity,json=newQuantity,proto3" json:"new_quantity,omitempty"` + // new_ask_price is the new ask price for this sell order + NewAskPrice *types.Coin `protobuf:"bytes,3,opt,name=new_ask_price,json=newAskPrice,proto3" json:"new_ask_price,omitempty"` + // disable_auto_retire updates the disable_auto_retire field in the sell order. + DisableAutoRetire bool `protobuf:"varint,4,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // new_expiration is an optional timestamp when the sell order expires. When the + // expiration time is reached, the sell order is removed from state. + NewExpiration *time.Time `protobuf:"bytes,5,opt,name=new_expiration,json=newExpiration,proto3,stdtime" json:"new_expiration,omitempty"` +} + +func (m *MsgUpdateSellOrders_Update) Reset() { *m = MsgUpdateSellOrders_Update{} } +func (m *MsgUpdateSellOrders_Update) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateSellOrders_Update) ProtoMessage() {} +func (*MsgUpdateSellOrders_Update) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{2, 0} +} +func (m *MsgUpdateSellOrders_Update) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateSellOrders_Update) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateSellOrders_Update.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 *MsgUpdateSellOrders_Update) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateSellOrders_Update.Merge(m, src) +} +func (m *MsgUpdateSellOrders_Update) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateSellOrders_Update) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateSellOrders_Update.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateSellOrders_Update proto.InternalMessageInfo + +func (m *MsgUpdateSellOrders_Update) GetSellOrderId() uint64 { + if m != nil { + return m.SellOrderId + } + return 0 +} + +func (m *MsgUpdateSellOrders_Update) GetNewQuantity() string { + if m != nil { + return m.NewQuantity + } + return "" +} + +func (m *MsgUpdateSellOrders_Update) GetNewAskPrice() *types.Coin { + if m != nil { + return m.NewAskPrice + } + return nil +} + +func (m *MsgUpdateSellOrders_Update) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *MsgUpdateSellOrders_Update) GetNewExpiration() *time.Time { + if m != nil { + return m.NewExpiration + } + return nil +} + +// MsgUpdateSellOrdersResponse is the Msg/UpdateSellOrders response type. +type MsgUpdateSellOrdersResponse struct { +} + +func (m *MsgUpdateSellOrdersResponse) Reset() { *m = MsgUpdateSellOrdersResponse{} } +func (m *MsgUpdateSellOrdersResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateSellOrdersResponse) ProtoMessage() {} +func (*MsgUpdateSellOrdersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{3} +} +func (m *MsgUpdateSellOrdersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateSellOrdersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateSellOrdersResponse.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 *MsgUpdateSellOrdersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateSellOrdersResponse.Merge(m, src) +} +func (m *MsgUpdateSellOrdersResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateSellOrdersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateSellOrdersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateSellOrdersResponse proto.InternalMessageInfo + +// MsgBuy is the Msg/Buy request type. +type MsgBuy struct { + // buyer is the address of the credit buyer. + Buyer string `protobuf:"bytes,1,opt,name=buyer,proto3" json:"buyer,omitempty"` + // orders are the new buy orders. + Orders []*MsgBuy_Order `protobuf:"bytes,2,rep,name=orders,proto3" json:"orders,omitempty"` +} + +func (m *MsgBuy) Reset() { *m = MsgBuy{} } +func (m *MsgBuy) String() string { return proto.CompactTextString(m) } +func (*MsgBuy) ProtoMessage() {} +func (*MsgBuy) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{4} +} +func (m *MsgBuy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBuy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBuy.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 *MsgBuy) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBuy.Merge(m, src) +} +func (m *MsgBuy) XXX_Size() int { + return m.Size() +} +func (m *MsgBuy) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBuy.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBuy proto.InternalMessageInfo + +func (m *MsgBuy) GetBuyer() string { + if m != nil { + return m.Buyer + } + return "" +} + +func (m *MsgBuy) GetOrders() []*MsgBuy_Order { + if m != nil { + return m.Orders + } + return nil +} + +// Order is a buy order. +type MsgBuy_Order struct { + // selection is the buy order selection. + Selection *MsgBuy_Order_Selection `protobuf:"bytes,1,opt,name=selection,proto3" json:"selection,omitempty"` + // quantity is the quantity of credits to buy. If the quantity of credits + // available is less than this amount the order will be partially filled + // unless disable_partial_fill is true. + Quantity string `protobuf:"bytes,2,opt,name=quantity,proto3" json:"quantity,omitempty"` + // bid price is the bid price for this buy order. A credit unit will be + // settled at a purchase price that is no more than the bid price. The + // buy order will fail if the buyer does not have enough funds available + // to complete the purchase. + BidPrice *types.Coin `protobuf:"bytes,3,opt,name=bid_price,json=bidPrice,proto3" json:"bid_price,omitempty"` + // disable_auto_retire allows auto-retirement to be disabled. If it is set to true + // the credits will not auto-retire and can be resold assuming that the + // corresponding sell order has auto-retirement disabled. If the sell order + // hasn't disabled auto-retirement and the buy order tries to disable it, + // that buy order will fail. + DisableAutoRetire bool `protobuf:"varint,4,opt,name=disable_auto_retire,json=disableAutoRetire,proto3" json:"disable_auto_retire,omitempty"` + // disable_partial_fill disables the default behavior of partially filling + // buy orders if the requested quantity is not available. + DisablePartialFill bool `protobuf:"varint,5,opt,name=disable_partial_fill,json=disablePartialFill,proto3" json:"disable_partial_fill,omitempty"` + // retirement_location is the optional retirement location for the credits + // which will be used only if disable_auto_retire is false. + RetirementLocation string `protobuf:"bytes,6,opt,name=retirement_location,json=retirementLocation,proto3" json:"retirement_location,omitempty"` + // expiration is the optional timestamp when the buy order expires. When the + // expiration time is reached, the buy order is removed from state. + Expiration *time.Time `protobuf:"bytes,7,opt,name=expiration,proto3,stdtime" json:"expiration,omitempty"` +} + +func (m *MsgBuy_Order) Reset() { *m = MsgBuy_Order{} } +func (m *MsgBuy_Order) String() string { return proto.CompactTextString(m) } +func (*MsgBuy_Order) ProtoMessage() {} +func (*MsgBuy_Order) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{4, 0} +} +func (m *MsgBuy_Order) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBuy_Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBuy_Order.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 *MsgBuy_Order) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBuy_Order.Merge(m, src) +} +func (m *MsgBuy_Order) XXX_Size() int { + return m.Size() +} +func (m *MsgBuy_Order) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBuy_Order.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBuy_Order proto.InternalMessageInfo + +func (m *MsgBuy_Order) GetSelection() *MsgBuy_Order_Selection { + if m != nil { + return m.Selection + } + return nil +} + +func (m *MsgBuy_Order) GetQuantity() string { + if m != nil { + return m.Quantity + } + return "" +} + +func (m *MsgBuy_Order) GetBidPrice() *types.Coin { + if m != nil { + return m.BidPrice + } + return nil +} + +func (m *MsgBuy_Order) GetDisableAutoRetire() bool { + if m != nil { + return m.DisableAutoRetire + } + return false +} + +func (m *MsgBuy_Order) GetDisablePartialFill() bool { + if m != nil { + return m.DisablePartialFill + } + return false +} + +func (m *MsgBuy_Order) GetRetirementLocation() string { + if m != nil { + return m.RetirementLocation + } + return "" +} + +func (m *MsgBuy_Order) GetExpiration() *time.Time { + if m != nil { + return m.Expiration + } + return nil +} + +// Selection defines a buy order selection. +type MsgBuy_Order_Selection struct { + // sum defines the type of selection. + // + // Types that are valid to be assigned to Sum: + // *MsgBuy_Order_Selection_SellOrderId + // *MsgBuy_Order_Selection_Filter + Sum isMsgBuy_Order_Selection_Sum `protobuf_oneof:"sum"` +} + +func (m *MsgBuy_Order_Selection) Reset() { *m = MsgBuy_Order_Selection{} } +func (m *MsgBuy_Order_Selection) String() string { return proto.CompactTextString(m) } +func (*MsgBuy_Order_Selection) ProtoMessage() {} +func (*MsgBuy_Order_Selection) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{4, 0, 0} +} +func (m *MsgBuy_Order_Selection) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBuy_Order_Selection) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBuy_Order_Selection.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 *MsgBuy_Order_Selection) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBuy_Order_Selection.Merge(m, src) +} +func (m *MsgBuy_Order_Selection) XXX_Size() int { + return m.Size() +} +func (m *MsgBuy_Order_Selection) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBuy_Order_Selection.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBuy_Order_Selection proto.InternalMessageInfo + +type isMsgBuy_Order_Selection_Sum interface { + isMsgBuy_Order_Selection_Sum() + MarshalTo([]byte) (int, error) + Size() int +} + +type MsgBuy_Order_Selection_SellOrderId struct { + SellOrderId uint64 `protobuf:"varint,1,opt,name=sell_order_id,json=sellOrderId,proto3,oneof" json:"sell_order_id,omitempty"` +} +type MsgBuy_Order_Selection_Filter struct { + Filter *Filter `protobuf:"bytes,2,opt,name=filter,proto3,oneof" json:"filter,omitempty"` +} + +func (*MsgBuy_Order_Selection_SellOrderId) isMsgBuy_Order_Selection_Sum() {} +func (*MsgBuy_Order_Selection_Filter) isMsgBuy_Order_Selection_Sum() {} + +func (m *MsgBuy_Order_Selection) GetSum() isMsgBuy_Order_Selection_Sum { + if m != nil { + return m.Sum + } + return nil +} + +func (m *MsgBuy_Order_Selection) GetSellOrderId() uint64 { + if x, ok := m.GetSum().(*MsgBuy_Order_Selection_SellOrderId); ok { + return x.SellOrderId + } + return 0 +} + +func (m *MsgBuy_Order_Selection) GetFilter() *Filter { + if x, ok := m.GetSum().(*MsgBuy_Order_Selection_Filter); ok { + return x.Filter + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*MsgBuy_Order_Selection) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*MsgBuy_Order_Selection_SellOrderId)(nil), + (*MsgBuy_Order_Selection_Filter)(nil), + } +} + +// MsgBuyResponse is the Msg/Buy response type. +type MsgBuyResponse struct { + // buy_order_ids are the buy order IDs of the newly created buy orders. Buy + // orders may not settle instantaneously, but rather in batches at specified + // batch epoch times. + BuyOrderIds []uint64 `protobuf:"varint,1,rep,packed,name=buy_order_ids,json=buyOrderIds,proto3" json:"buy_order_ids,omitempty"` +} + +func (m *MsgBuyResponse) Reset() { *m = MsgBuyResponse{} } +func (m *MsgBuyResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBuyResponse) ProtoMessage() {} +func (*MsgBuyResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{5} +} +func (m *MsgBuyResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBuyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBuyResponse.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 *MsgBuyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBuyResponse.Merge(m, src) +} +func (m *MsgBuyResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBuyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBuyResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBuyResponse proto.InternalMessageInfo + +func (m *MsgBuyResponse) GetBuyOrderIds() []uint64 { + if m != nil { + return m.BuyOrderIds + } + return nil +} + +// MsgAllowAskDenom is the Msg/AllowAskDenom request type. +type MsgAllowAskDenom struct { + // root_address is the address of the governance account which can authorize ask denoms + RootAddress string `protobuf:"bytes,1,opt,name=root_address,json=rootAddress,proto3" json:"root_address,omitempty"` + // denom is the denom to allow (ex. ibc/GLKHDSG423SGS) + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty"` + // display_denom is the denom to display to the user and is informational + DisplayDenom string `protobuf:"bytes,3,opt,name=display_denom,json=displayDenom,proto3" json:"display_denom,omitempty"` + // exponent is the exponent that relates the denom to the display_denom and is + // informational + Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"` +} + +func (m *MsgAllowAskDenom) Reset() { *m = MsgAllowAskDenom{} } +func (m *MsgAllowAskDenom) String() string { return proto.CompactTextString(m) } +func (*MsgAllowAskDenom) ProtoMessage() {} +func (*MsgAllowAskDenom) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{6} +} +func (m *MsgAllowAskDenom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAllowAskDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAllowAskDenom.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 *MsgAllowAskDenom) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAllowAskDenom.Merge(m, src) +} +func (m *MsgAllowAskDenom) XXX_Size() int { + return m.Size() +} +func (m *MsgAllowAskDenom) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAllowAskDenom.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAllowAskDenom proto.InternalMessageInfo + +func (m *MsgAllowAskDenom) GetRootAddress() string { + if m != nil { + return m.RootAddress + } + return "" +} + +func (m *MsgAllowAskDenom) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *MsgAllowAskDenom) GetDisplayDenom() string { + if m != nil { + return m.DisplayDenom + } + return "" +} + +func (m *MsgAllowAskDenom) GetExponent() uint32 { + if m != nil { + return m.Exponent + } + return 0 +} + +// MsgAllowAskDenomResponse is the Msg/AllowAskDenom response type. +type MsgAllowAskDenomResponse struct { +} + +func (m *MsgAllowAskDenomResponse) Reset() { *m = MsgAllowAskDenomResponse{} } +func (m *MsgAllowAskDenomResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAllowAskDenomResponse) ProtoMessage() {} +func (*MsgAllowAskDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_35ceac134323d237, []int{7} +} +func (m *MsgAllowAskDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAllowAskDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAllowAskDenomResponse.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 *MsgAllowAskDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAllowAskDenomResponse.Merge(m, src) +} +func (m *MsgAllowAskDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAllowAskDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAllowAskDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAllowAskDenomResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSell)(nil), "regen.ecocredit.marketplace.v1beta1.MsgSell") + proto.RegisterType((*MsgSell_Order)(nil), "regen.ecocredit.marketplace.v1beta1.MsgSell.Order") + proto.RegisterType((*MsgSellResponse)(nil), "regen.ecocredit.marketplace.v1beta1.MsgSellResponse") + proto.RegisterType((*MsgUpdateSellOrders)(nil), "regen.ecocredit.marketplace.v1beta1.MsgUpdateSellOrders") + proto.RegisterType((*MsgUpdateSellOrders_Update)(nil), "regen.ecocredit.marketplace.v1beta1.MsgUpdateSellOrders.Update") + proto.RegisterType((*MsgUpdateSellOrdersResponse)(nil), "regen.ecocredit.marketplace.v1beta1.MsgUpdateSellOrdersResponse") + proto.RegisterType((*MsgBuy)(nil), "regen.ecocredit.marketplace.v1beta1.MsgBuy") + proto.RegisterType((*MsgBuy_Order)(nil), "regen.ecocredit.marketplace.v1beta1.MsgBuy.Order") + proto.RegisterType((*MsgBuy_Order_Selection)(nil), "regen.ecocredit.marketplace.v1beta1.MsgBuy.Order.Selection") + proto.RegisterType((*MsgBuyResponse)(nil), "regen.ecocredit.marketplace.v1beta1.MsgBuyResponse") + proto.RegisterType((*MsgAllowAskDenom)(nil), "regen.ecocredit.marketplace.v1beta1.MsgAllowAskDenom") + proto.RegisterType((*MsgAllowAskDenomResponse)(nil), "regen.ecocredit.marketplace.v1beta1.MsgAllowAskDenomResponse") +} + +func init() { + proto.RegisterFile("regen/ecocredit/marketplace/v1beta1/tx.proto", fileDescriptor_35ceac134323d237) +} + +var fileDescriptor_35ceac134323d237 = []byte{ + // 912 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcd, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0x66, 0x1d, 0x27, 0x79, 0x8e, 0x43, 0x99, 0xe4, 0x60, 0x16, 0xe1, 0xb8, 0x6e, 0x0f, + 0x96, 0x5a, 0x76, 0x89, 0x5b, 0x3e, 0x24, 0x54, 0xd1, 0x18, 0x52, 0x5a, 0x84, 0x45, 0xd9, 0xc0, + 0xa1, 0x5c, 0x56, 0xfb, 0xf1, 0xb2, 0x1d, 0x32, 0xde, 0x59, 0x76, 0x66, 0x49, 0x7c, 0xe2, 0x84, + 0xb8, 0x54, 0x28, 0x7f, 0x16, 0xc7, 0x1e, 0x39, 0x20, 0x81, 0x92, 0x3b, 0x17, 0x2e, 0x1c, 0xd1, + 0xce, 0x7e, 0x38, 0x71, 0x03, 0xd8, 0xbe, 0xf9, 0xbd, 0xf7, 0x7b, 0x6f, 0xde, 0xbc, 0xdf, 0xfc, + 0x9e, 0x17, 0xee, 0x26, 0x18, 0x62, 0x64, 0xa1, 0xcf, 0xfd, 0x04, 0x03, 0x2a, 0xad, 0xb1, 0x9b, + 0x1c, 0xa3, 0x8c, 0x99, 0xeb, 0xa3, 0xf5, 0xfd, 0x9e, 0x87, 0xd2, 0xdd, 0xb3, 0xe4, 0xa9, 0x19, + 0x27, 0x5c, 0x72, 0x72, 0x4b, 0xa1, 0xcd, 0x0a, 0x6d, 0x5e, 0x42, 0x9b, 0x05, 0xda, 0xd8, 0x09, + 0x79, 0xc8, 0x15, 0xde, 0xca, 0x7e, 0xe5, 0xa9, 0x46, 0xc7, 0xe7, 0x62, 0xcc, 0x85, 0xe5, 0xb9, + 0x62, 0x5a, 0xd8, 0xe7, 0x34, 0x2a, 0xe2, 0xbb, 0x21, 0xe7, 0x21, 0x43, 0x4b, 0x59, 0x5e, 0x7a, + 0x64, 0x49, 0x3a, 0x46, 0x21, 0xdd, 0x71, 0x5c, 0x00, 0xac, 0xb9, 0x3a, 0x9d, 0xc4, 0x28, 0xf2, + 0x84, 0xde, 0x6f, 0x2b, 0xb0, 0x36, 0x12, 0xe1, 0x21, 0x32, 0x46, 0x76, 0x60, 0x95, 0x9f, 0x44, + 0x98, 0xb4, 0xb5, 0xae, 0xd6, 0xdf, 0xb0, 0x73, 0x83, 0x7c, 0x06, 0x0d, 0x9e, 0x04, 0x98, 0x88, + 0xf6, 0x4a, 0x57, 0xef, 0x37, 0x07, 0x03, 0x73, 0x8e, 0xfb, 0x99, 0x45, 0x4d, 0xf3, 0x8b, 0x2c, + 0xd5, 0x2e, 0x2a, 0x18, 0x7f, 0x6a, 0xb0, 0xaa, 0x3c, 0x64, 0x17, 0x9a, 0x9e, 0x2b, 0xfd, 0xe7, + 0x4e, 0x80, 0x11, 0x1f, 0x17, 0x27, 0x82, 0x72, 0x7d, 0x92, 0x79, 0x88, 0x01, 0xeb, 0xdf, 0xa5, + 0x6e, 0x24, 0xa9, 0x9c, 0xb4, 0x57, 0x54, 0xb4, 0xb2, 0xc9, 0x7b, 0xb0, 0xe1, 0x8a, 0x63, 0x27, + 0x4e, 0xa8, 0x8f, 0x6d, 0xbd, 0xab, 0xf5, 0x9b, 0x83, 0x37, 0xcc, 0x7c, 0x74, 0x66, 0x36, 0xba, + 0xaa, 0x8b, 0x8f, 0x39, 0x8d, 0xec, 0x75, 0x57, 0x1c, 0x3f, 0xcd, 0xa0, 0xc4, 0x84, 0xed, 0x80, + 0x0a, 0xd7, 0x63, 0xe8, 0xb8, 0xa9, 0xe4, 0x4e, 0x82, 0x92, 0x26, 0xd8, 0xae, 0x77, 0xb5, 0xfe, + 0xba, 0xfd, 0x7a, 0x11, 0xda, 0x4f, 0x25, 0xb7, 0x55, 0x80, 0x3c, 0x04, 0xc0, 0xd3, 0x98, 0x26, + 0xae, 0xa4, 0x3c, 0x6a, 0xaf, 0xaa, 0x83, 0x0c, 0x33, 0xe7, 0xc0, 0x2c, 0x39, 0x30, 0xbf, 0x2a, + 0x39, 0x18, 0xd6, 0xcf, 0x7e, 0xdf, 0xd5, 0xec, 0x4b, 0x39, 0xbd, 0xf7, 0xe1, 0xb5, 0x62, 0x12, + 0x36, 0x8a, 0x98, 0x47, 0x02, 0xc9, 0x6d, 0xd8, 0x12, 0xc8, 0x98, 0xa3, 0x46, 0xe2, 0xd0, 0x40, + 0xb4, 0xb5, 0xae, 0xde, 0xaf, 0xdb, 0x9b, 0x99, 0x57, 0x0d, 0xe7, 0x49, 0x20, 0x7a, 0x67, 0x3a, + 0x6c, 0x8f, 0x44, 0xf8, 0x75, 0x1c, 0xb8, 0x12, 0x0f, 0xcb, 0x88, 0xf8, 0x17, 0x8e, 0x9e, 0xc1, + 0x5a, 0xaa, 0x90, 0x25, 0x49, 0x1f, 0xcd, 0x4b, 0xd2, 0xec, 0x01, 0x66, 0xee, 0xb0, 0xcb, 0x7a, + 0xc6, 0x4f, 0x2b, 0xd0, 0xc8, 0x7d, 0xa4, 0x07, 0xad, 0x2b, 0x9d, 0xab, 0x1e, 0xea, 0x76, 0xf3, + 0x52, 0xe3, 0xe4, 0x26, 0x6c, 0x46, 0x78, 0xe2, 0xcc, 0x50, 0xd7, 0x8c, 0xf0, 0xe4, 0xcb, 0x92, + 0xbd, 0x07, 0xd0, 0xca, 0x20, 0x0b, 0x30, 0x98, 0xa5, 0xef, 0x2f, 0x4b, 0xe2, 0xa7, 0xb0, 0x95, + 0x1d, 0xb7, 0x04, 0x91, 0x59, 0x9b, 0x07, 0x53, 0x2e, 0xdf, 0x82, 0x37, 0xaf, 0x19, 0x58, 0xc9, + 0x6b, 0xef, 0xef, 0x3a, 0x34, 0x46, 0x22, 0x1c, 0xa6, 0x93, 0x8c, 0x24, 0x2f, 0x9d, 0x4c, 0x49, + 0x52, 0x06, 0x79, 0x32, 0x23, 0xa4, 0xbd, 0x79, 0x39, 0x1a, 0xa6, 0x93, 0x19, 0x1d, 0xbd, 0xa8, + 0x97, 0x3a, 0x7a, 0x06, 0x1b, 0x02, 0x19, 0xfa, 0xea, 0x62, 0x9a, 0xba, 0xd8, 0x87, 0x0b, 0xd7, + 0x35, 0x0f, 0xcb, 0x12, 0xf6, 0xb4, 0xda, 0xff, 0x29, 0xd0, 0xa3, 0xc1, 0xdc, 0x0a, 0xf4, 0x68, + 0xb0, 0x1c, 0x79, 0xef, 0xc0, 0x4e, 0x89, 0x8f, 0xdd, 0x44, 0x52, 0x97, 0x39, 0x47, 0x94, 0x31, + 0x45, 0xe1, 0xba, 0x4d, 0x8a, 0xd8, 0xd3, 0x3c, 0xf4, 0x88, 0x32, 0x46, 0x2c, 0xd8, 0xce, 0x8b, + 0x8e, 0x31, 0x92, 0x0e, 0xe3, 0x7e, 0xce, 0x79, 0x43, 0x5d, 0x80, 0x4c, 0x43, 0x9f, 0x17, 0x91, + 0x19, 0x91, 0xaf, 0x2d, 0x2e, 0x72, 0xe3, 0x07, 0xd8, 0xa8, 0x06, 0x48, 0x6e, 0x5f, 0x2b, 0x92, + 0xc7, 0xb5, 0xab, 0x32, 0x39, 0x80, 0xc6, 0x11, 0x65, 0x12, 0x13, 0x35, 0xd9, 0xe6, 0xe0, 0xce, + 0x5c, 0x9c, 0x3d, 0x52, 0x29, 0x8f, 0x6b, 0x76, 0x91, 0x3c, 0x5c, 0x05, 0x5d, 0xa4, 0xe3, 0xde, + 0x7d, 0xd8, 0xca, 0xe9, 0xac, 0x96, 0x4c, 0x0f, 0x5a, 0x5e, 0x3a, 0x79, 0x65, 0xc7, 0x34, 0xbd, + 0x74, 0x52, 0xad, 0x98, 0x17, 0x1a, 0xdc, 0x18, 0x89, 0x70, 0x9f, 0x31, 0x9e, 0xa9, 0x2b, 0x5f, + 0xbb, 0x37, 0x61, 0x33, 0xe1, 0x5c, 0x3a, 0x6e, 0x10, 0x24, 0x28, 0x44, 0xf1, 0x82, 0x9b, 0x99, + 0x6f, 0x3f, 0x77, 0x65, 0xaf, 0x3b, 0x5f, 0xda, 0xf9, 0xa3, 0xc8, 0x0d, 0x72, 0x0b, 0x5a, 0x01, + 0x15, 0x31, 0x73, 0x27, 0xc5, 0x4a, 0xd7, 0x55, 0x74, 0xb3, 0x70, 0x56, 0x4b, 0x1d, 0x4f, 0x63, + 0x1e, 0x61, 0x24, 0x15, 0xe7, 0x2d, 0xbb, 0xb2, 0x7b, 0x06, 0xb4, 0x67, 0xbb, 0x29, 0xaf, 0x33, + 0xf8, 0x4b, 0x07, 0x7d, 0x24, 0x42, 0xf2, 0x2d, 0xd4, 0xd5, 0x3f, 0xd5, 0xdd, 0x45, 0xfe, 0x83, + 0x8c, 0xfb, 0x8b, 0xa0, 0xab, 0x11, 0xfe, 0xac, 0xc1, 0x8d, 0x57, 0xd6, 0xef, 0x07, 0xcb, 0xee, + 0x55, 0xe3, 0xe1, 0xb2, 0x99, 0x55, 0x43, 0x21, 0xe8, 0xd9, 0x72, 0xb9, 0xb3, 0x80, 0xbc, 0x8d, + 0x7b, 0x0b, 0x80, 0xab, 0x83, 0x7e, 0xd4, 0xa0, 0x75, 0xf5, 0x55, 0xbc, 0x3b, 0x6f, 0x99, 0x2b, + 0x69, 0xc6, 0x83, 0xa5, 0xd2, 0xca, 0x3e, 0x86, 0xce, 0x2f, 0xe7, 0x1d, 0xed, 0xe5, 0x79, 0x47, + 0xfb, 0xe3, 0xbc, 0xa3, 0x9d, 0x5d, 0x74, 0x6a, 0x2f, 0x2f, 0x3a, 0xb5, 0x5f, 0x2f, 0x3a, 0xb5, + 0x6f, 0x0e, 0x42, 0x2a, 0x9f, 0xa7, 0x9e, 0xe9, 0xf3, 0x71, 0xfe, 0xc5, 0xf3, 0x76, 0x84, 0xf2, + 0x84, 0x27, 0xc7, 0x85, 0xc5, 0x30, 0x08, 0x31, 0xb1, 0x4e, 0xff, 0xfb, 0x43, 0xc8, 0x6b, 0x28, + 0x79, 0xdf, 0xfb, 0x27, 0x00, 0x00, 0xff, 0xff, 0x2b, 0xb9, 0x50, 0xe3, 0xe0, 0x09, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // Sell creates new sell orders. + Sell(ctx context.Context, in *MsgSell, opts ...grpc.CallOption) (*MsgSellResponse, error) + // UpdateSellOrders updates existing sell orders. + UpdateSellOrders(ctx context.Context, in *MsgUpdateSellOrders, opts ...grpc.CallOption) (*MsgUpdateSellOrdersResponse, error) + // Buy creates credit buy orders. + Buy(ctx context.Context, in *MsgBuy, opts ...grpc.CallOption) (*MsgBuyResponse, error) + // AllowAskDenom is a governance operation which authorizes a new ask denom to be used in sell orders + AllowAskDenom(ctx context.Context, in *MsgAllowAskDenom, opts ...grpc.CallOption) (*MsgAllowAskDenomResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) Sell(ctx context.Context, in *MsgSell, opts ...grpc.CallOption) (*MsgSellResponse, error) { + out := new(MsgSellResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Msg/Sell", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateSellOrders(ctx context.Context, in *MsgUpdateSellOrders, opts ...grpc.CallOption) (*MsgUpdateSellOrdersResponse, error) { + out := new(MsgUpdateSellOrdersResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Msg/UpdateSellOrders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Buy(ctx context.Context, in *MsgBuy, opts ...grpc.CallOption) (*MsgBuyResponse, error) { + out := new(MsgBuyResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Msg/Buy", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) AllowAskDenom(ctx context.Context, in *MsgAllowAskDenom, opts ...grpc.CallOption) (*MsgAllowAskDenomResponse, error) { + out := new(MsgAllowAskDenomResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.marketplace.v1beta1.Msg/AllowAskDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // Sell creates new sell orders. + Sell(context.Context, *MsgSell) (*MsgSellResponse, error) + // UpdateSellOrders updates existing sell orders. + UpdateSellOrders(context.Context, *MsgUpdateSellOrders) (*MsgUpdateSellOrdersResponse, error) + // Buy creates credit buy orders. + Buy(context.Context, *MsgBuy) (*MsgBuyResponse, error) + // AllowAskDenom is a governance operation which authorizes a new ask denom to be used in sell orders + AllowAskDenom(context.Context, *MsgAllowAskDenom) (*MsgAllowAskDenomResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) Sell(ctx context.Context, req *MsgSell) (*MsgSellResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sell not implemented") +} +func (*UnimplementedMsgServer) UpdateSellOrders(ctx context.Context, req *MsgUpdateSellOrders) (*MsgUpdateSellOrdersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSellOrders not implemented") +} +func (*UnimplementedMsgServer) Buy(ctx context.Context, req *MsgBuy) (*MsgBuyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Buy not implemented") +} +func (*UnimplementedMsgServer) AllowAskDenom(ctx context.Context, req *MsgAllowAskDenom) (*MsgAllowAskDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AllowAskDenom not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_Sell_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSell) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Sell(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Msg/Sell", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Sell(ctx, req.(*MsgSell)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateSellOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateSellOrders) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateSellOrders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Msg/UpdateSellOrders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateSellOrders(ctx, req.(*MsgUpdateSellOrders)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Buy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBuy) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Buy(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Msg/Buy", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Buy(ctx, req.(*MsgBuy)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_AllowAskDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAllowAskDenom) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AllowAskDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.marketplace.v1beta1.Msg/AllowAskDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AllowAskDenom(ctx, req.(*MsgAllowAskDenom)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "regen.ecocredit.marketplace.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Sell", + Handler: _Msg_Sell_Handler, + }, + { + MethodName: "UpdateSellOrders", + Handler: _Msg_UpdateSellOrders_Handler, + }, + { + MethodName: "Buy", + Handler: _Msg_Buy_Handler, + }, + { + MethodName: "AllowAskDenom", + Handler: _Msg_AllowAskDenom_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "regen/ecocredit/marketplace/v1beta1/tx.proto", +} + +func (m *MsgSell) 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 *MsgSell) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSell) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Orders) > 0 { + for iNdEx := len(m.Orders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Orders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSell_Order) 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 *MsgSell_Order) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSell_Order) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expiration != nil { + n1, err1 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Expiration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Expiration):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintTx(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x2a + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.AskPrice != nil { + { + size, err := m.AskPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Quantity) > 0 { + i -= len(m.Quantity) + copy(dAtA[i:], m.Quantity) + i = encodeVarintTx(dAtA, i, uint64(len(m.Quantity))) + i-- + dAtA[i] = 0x12 + } + if len(m.BatchDenom) > 0 { + i -= len(m.BatchDenom) + copy(dAtA[i:], m.BatchDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.BatchDenom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSellResponse) 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 *MsgSellResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSellResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SellOrderIds) > 0 { + dAtA4 := make([]byte, len(m.SellOrderIds)*10) + var j3 int + for _, num := range m.SellOrderIds { + for num >= 1<<7 { + dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j3++ + } + dAtA4[j3] = uint8(num) + j3++ + } + i -= j3 + copy(dAtA[i:], dAtA4[:j3]) + i = encodeVarintTx(dAtA, i, uint64(j3)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateSellOrders) 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 *MsgUpdateSellOrders) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateSellOrders) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Updates) > 0 { + for iNdEx := len(m.Updates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Updates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintTx(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateSellOrders_Update) 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 *MsgUpdateSellOrders_Update) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateSellOrders_Update) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.NewExpiration != nil { + n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.NewExpiration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.NewExpiration):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintTx(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x2a + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.NewAskPrice != nil { + { + size, err := m.NewAskPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.NewQuantity) > 0 { + i -= len(m.NewQuantity) + copy(dAtA[i:], m.NewQuantity) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewQuantity))) + i-- + dAtA[i] = 0x12 + } + if m.SellOrderId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.SellOrderId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateSellOrdersResponse) 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 *MsgUpdateSellOrdersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateSellOrdersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgBuy) 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 *MsgBuy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Orders) > 0 { + for iNdEx := len(m.Orders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Orders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Buyer) > 0 { + i -= len(m.Buyer) + copy(dAtA[i:], m.Buyer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Buyer))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBuy_Order) 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 *MsgBuy_Order) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuy_Order) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expiration != nil { + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.Expiration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.Expiration):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintTx(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x3a + } + if len(m.RetirementLocation) > 0 { + i -= len(m.RetirementLocation) + copy(dAtA[i:], m.RetirementLocation) + i = encodeVarintTx(dAtA, i, uint64(len(m.RetirementLocation))) + i-- + dAtA[i] = 0x32 + } + if m.DisablePartialFill { + i-- + if m.DisablePartialFill { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.DisableAutoRetire { + i-- + if m.DisableAutoRetire { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.BidPrice != nil { + { + size, err := m.BidPrice.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.Quantity) > 0 { + i -= len(m.Quantity) + copy(dAtA[i:], m.Quantity) + i = encodeVarintTx(dAtA, i, uint64(len(m.Quantity))) + i-- + dAtA[i] = 0x12 + } + if m.Selection != nil { + { + size, err := m.Selection.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBuy_Order_Selection) 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 *MsgBuy_Order_Selection) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuy_Order_Selection) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Sum != nil { + { + size := m.Sum.Size() + i -= size + if _, err := m.Sum.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil +} + +func (m *MsgBuy_Order_Selection_SellOrderId) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuy_Order_Selection_SellOrderId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i = encodeVarintTx(dAtA, i, uint64(m.SellOrderId)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} +func (m *MsgBuy_Order_Selection_Filter) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuy_Order_Selection_Filter) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Filter != nil { + { + size, err := m.Filter.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *MsgBuyResponse) 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 *MsgBuyResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BuyOrderIds) > 0 { + dAtA12 := make([]byte, len(m.BuyOrderIds)*10) + var j11 int + for _, num := range m.BuyOrderIds { + for num >= 1<<7 { + dAtA12[j11] = uint8(uint64(num)&0x7f | 0x80) + num >>= 7 + j11++ + } + dAtA12[j11] = uint8(num) + j11++ + } + i -= j11 + copy(dAtA[i:], dAtA12[:j11]) + i = encodeVarintTx(dAtA, i, uint64(j11)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAllowAskDenom) 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 *MsgAllowAskDenom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAllowAskDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Exponent != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Exponent)) + i-- + dAtA[i] = 0x20 + } + if len(m.DisplayDenom) > 0 { + i -= len(m.DisplayDenom) + copy(dAtA[i:], m.DisplayDenom) + i = encodeVarintTx(dAtA, i, uint64(len(m.DisplayDenom))) + i-- + dAtA[i] = 0x1a + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 + } + if len(m.RootAddress) > 0 { + i -= len(m.RootAddress) + copy(dAtA[i:], m.RootAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.RootAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAllowAskDenomResponse) 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 *MsgAllowAskDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAllowAskDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSell) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Orders) > 0 { + for _, e := range m.Orders { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgSell_Order) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BatchDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Quantity) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.AskPrice != nil { + l = m.AskPrice.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.DisableAutoRetire { + n += 2 + } + if m.Expiration != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.Expiration) + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSellResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.SellOrderIds) > 0 { + l = 0 + for _, e := range m.SellOrderIds { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + return n +} + +func (m *MsgUpdateSellOrders) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Updates) > 0 { + for _, e := range m.Updates { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgUpdateSellOrders_Update) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SellOrderId != 0 { + n += 1 + sovTx(uint64(m.SellOrderId)) + } + l = len(m.NewQuantity) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.NewAskPrice != nil { + l = m.NewAskPrice.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.DisableAutoRetire { + n += 2 + } + if m.NewExpiration != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.NewExpiration) + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateSellOrdersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgBuy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Buyer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Orders) > 0 { + for _, e := range m.Orders { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgBuy_Order) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Selection != nil { + l = m.Selection.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Quantity) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.BidPrice != nil { + l = m.BidPrice.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.DisableAutoRetire { + n += 2 + } + if m.DisablePartialFill { + n += 2 + } + l = len(m.RetirementLocation) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Expiration != nil { + l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.Expiration) + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgBuy_Order_Selection) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sum != nil { + n += m.Sum.Size() + } + return n +} + +func (m *MsgBuy_Order_Selection_SellOrderId) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovTx(uint64(m.SellOrderId)) + return n +} +func (m *MsgBuy_Order_Selection_Filter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Filter != nil { + l = m.Filter.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} +func (m *MsgBuyResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BuyOrderIds) > 0 { + l = 0 + for _, e := range m.BuyOrderIds { + l += sovTx(uint64(e)) + } + n += 1 + sovTx(uint64(l)) + l + } + return n +} + +func (m *MsgAllowAskDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RootAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DisplayDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Exponent != 0 { + n += 1 + sovTx(uint64(m.Exponent)) + } + return n +} + +func (m *MsgAllowAskDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSell) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSell: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSell: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orders = append(m.Orders, &MsgSell_Order{}) + if err := m.Orders[len(m.Orders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSell_Order) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Order: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Order: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BatchDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Quantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AskPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AskPrice == nil { + m.AskPrice = &types.Coin{} + } + if err := m.AskPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Expiration == nil { + m.Expiration = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.Expiration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSellResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSellResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSellResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SellOrderIds = append(m.SellOrderIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.SellOrderIds) == 0 { + m.SellOrderIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.SellOrderIds = append(m.SellOrderIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrderIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateSellOrders) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateSellOrders: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateSellOrders: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Updates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Updates = append(m.Updates, &MsgUpdateSellOrders_Update{}) + if err := m.Updates[len(m.Updates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateSellOrders_Update) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Update: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Update: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrderId", wireType) + } + m.SellOrderId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SellOrderId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewQuantity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewQuantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewAskPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NewAskPrice == nil { + m.NewAskPrice = &types.Coin{} + } + if err := m.NewAskPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewExpiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NewExpiration == nil { + m.NewExpiration = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.NewExpiration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateSellOrdersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateSellOrdersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateSellOrdersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBuy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBuy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBuy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Buyer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Buyer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orders = append(m.Orders, &MsgBuy_Order{}) + if err := m.Orders[len(m.Orders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBuy_Order) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Order: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Order: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selection", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Selection == nil { + m.Selection = &MsgBuy_Order_Selection{} + } + if err := m.Selection.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quantity", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Quantity = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidPrice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BidPrice == nil { + m.BidPrice = &types.Coin{} + } + if err := m.BidPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisableAutoRetire", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableAutoRetire = bool(v != 0) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DisablePartialFill", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisablePartialFill = bool(v != 0) + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RetirementLocation", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RetirementLocation = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Expiration == nil { + m.Expiration = new(time.Time) + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.Expiration, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBuy_Order_Selection) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Selection: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Selection: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SellOrderId", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sum = &MsgBuy_Order_Selection_SellOrderId{v} + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + v := &Filter{} + if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Sum = &MsgBuy_Order_Selection_Filter{v} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBuyResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBuyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBuyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BuyOrderIds = append(m.BuyOrderIds, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.BuyOrderIds) == 0 { + m.BuyOrderIds = make([]uint64, 0, elementCount) + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BuyOrderIds = append(m.BuyOrderIds, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field BuyOrderIds", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAllowAskDenom) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAllowAskDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAllowAskDenom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RootAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RootAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisplayDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DisplayDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Exponent", wireType) + } + m.Exponent = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Exponent |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAllowAskDenomResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgAllowAskDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAllowAskDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/marketplace/v1beta1/types.pb.go b/x/ecocredit/marketplace/v1beta1/types.pb.go new file mode 100644 index 0000000000..42962088cc --- /dev/null +++ b/x/ecocredit/marketplace/v1beta1/types.pb.go @@ -0,0 +1,1549 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: regen/ecocredit/marketplace/v1beta1/types.proto + +package v1beta1 + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + types "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// 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) { + return fileDescriptor_cb996ab2d5b82893, []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 location 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_cb996ab2d5b82893, []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_cb996ab2d5b82893, []int{1} +} +func (m *ClassSelector) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClassSelector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClassSelector.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 *ClassSelector) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClassSelector.Merge(m, src) +} +func (m *ClassSelector) XXX_Size() int { + return m.Size() +} +func (m *ClassSelector) XXX_DiscardUnknown() { + xxx_messageInfo_ClassSelector.DiscardUnknown(m) +} + +var xxx_messageInfo_ClassSelector proto.InternalMessageInfo + +func (m *ClassSelector) GetClassId() uint64 { + if m != nil { + return m.ClassId + } + return 0 +} + +func (m *ClassSelector) GetProjectLocation() string { + if m != nil { + return m.ProjectLocation + } + 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_cb996ab2d5b82893, []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 { + if m != nil { + return m.MinStartDate + } + return nil +} + +func (m *ProjectSelector) GetMaxEndDate() *types.Timestamp { + if m != nil { + return m.MaxEndDate + } + 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_cb996ab2d5b82893, []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.v1beta1.Filter") + proto.RegisterType((*Filter_Criteria)(nil), "regen.ecocredit.marketplace.v1beta1.Filter.Criteria") + proto.RegisterType((*ClassSelector)(nil), "regen.ecocredit.marketplace.v1beta1.ClassSelector") + proto.RegisterType((*ProjectSelector)(nil), "regen.ecocredit.marketplace.v1beta1.ProjectSelector") + proto.RegisterType((*BatchSelector)(nil), "regen.ecocredit.marketplace.v1beta1.BatchSelector") +} + +func init() { + proto.RegisterFile("regen/ecocredit/marketplace/v1beta1/types.proto", fileDescriptor_cb996ab2d5b82893) +} + +var fileDescriptor_cb996ab2d5b82893 = []byte{ + // 466 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x41, 0x6f, 0xd3, 0x30, + 0x18, 0x86, 0x9b, 0x74, 0x1a, 0x9d, 0xb7, 0x6e, 0xc8, 0x27, 0xa8, 0x44, 0x40, 0xe5, 0x32, 0x90, + 0x70, 0xb4, 0xc2, 0x91, 0x03, 0xea, 0x36, 0x44, 0x25, 0x0e, 0xa8, 0xe3, 0x04, 0x87, 0xc8, 0xb1, + 0x3f, 0x32, 0xb3, 0x24, 0x8e, 0x9c, 0x6f, 0x50, 0xee, 0xfc, 0x00, 0x7e, 0x0a, 0x12, 0x7f, 0x82, + 0xe3, 0x2e, 0x48, 0x1c, 0x51, 0xfb, 0x47, 0x50, 0x9c, 0xa4, 0x49, 0x11, 0x82, 0x56, 0x3b, 0xfa, + 0x95, 0x9e, 0xd7, 0xef, 0xeb, 0xef, 0x33, 0xf1, 0x0d, 0x44, 0x90, 0xfa, 0x20, 0xb4, 0x30, 0x20, + 0x15, 0xfa, 0x09, 0x37, 0x17, 0x80, 0x59, 0xcc, 0x05, 0xf8, 0x1f, 0x8e, 0x42, 0x40, 0x7e, 0xe4, + 0xe3, 0xa7, 0x0c, 0x72, 0x96, 0x19, 0x8d, 0x9a, 0xde, 0xb7, 0x00, 0x5b, 0x02, 0xac, 0x05, 0xb0, + 0x0a, 0x18, 0xdc, 0x8d, 0xb4, 0x8e, 0x62, 0xf0, 0x2d, 0x12, 0x5e, 0xbe, 0xf3, 0x51, 0x25, 0x90, + 0x23, 0x4f, 0xb2, 0xd2, 0x65, 0xf8, 0xb9, 0x4b, 0xb6, 0x9f, 0xab, 0x18, 0xc1, 0xd0, 0x13, 0xe2, + 0x6a, 0x73, 0xcb, 0xb9, 0xd7, 0x3d, 0xdc, 0x1d, 0x3d, 0x61, 0x6b, 0xb8, 0xb3, 0x12, 0x64, 0xc7, + 0x46, 0x21, 0x18, 0xc5, 0xa7, 0xae, 0x36, 0x83, 0x6f, 0x2e, 0xe9, 0xd5, 0x02, 0x7d, 0x4b, 0xf6, + 0x45, 0xcc, 0xf3, 0x3c, 0xc8, 0x21, 0x06, 0x81, 0xd6, 0xde, 0x39, 0xdc, 0x1d, 0x8d, 0xd6, 0xb2, + 0x3f, 0x2e, 0xd0, 0xb3, 0x8a, 0x7c, 0xd1, 0x99, 0xf6, 0x45, 0x5b, 0xa0, 0x9c, 0xdc, 0xcc, 0x8c, + 0x7e, 0x0f, 0x02, 0x1b, 0x7b, 0xd7, 0xda, 0xaf, 0x97, 0xfe, 0x55, 0x09, 0xb7, 0x2e, 0x38, 0xc8, + 0x56, 0xa5, 0x22, 0x7f, 0xc8, 0x51, 0x9c, 0x37, 0x17, 0x74, 0x37, 0xc8, 0x3f, 0x2e, 0xd0, 0x76, + 0xfe, 0xb0, 0x2d, 0x8c, 0x09, 0xe9, 0xd5, 0xb6, 0xc3, 0x1f, 0x0e, 0xe9, 0xaf, 0xd4, 0xa5, 0xb7, + 0x49, 0xaf, 0x7c, 0x3a, 0x25, 0xed, 0xa3, 0x6d, 0x4d, 0x6f, 0xd8, 0xf3, 0x44, 0xd2, 0x07, 0x4d, + 0xf1, 0x58, 0x0b, 0x8e, 0x4a, 0xa7, 0xb6, 0xf8, 0xce, 0xb2, 0xc0, 0xcb, 0x4a, 0xa6, 0xcf, 0xc8, + 0x7e, 0xa2, 0xd2, 0x20, 0x47, 0x6e, 0x30, 0x90, 0x1c, 0xa1, 0x2a, 0x30, 0x60, 0xe5, 0x62, 0xb0, + 0x7a, 0x31, 0xd8, 0xeb, 0x7a, 0x31, 0xa6, 0x7b, 0x89, 0x4a, 0xcf, 0x0a, 0xe0, 0x84, 0x23, 0xd0, + 0xa7, 0x64, 0x2f, 0xe1, 0xb3, 0x00, 0x52, 0x59, 0xf2, 0x5b, 0xff, 0xe5, 0x49, 0xc2, 0x67, 0xa7, + 0xa9, 0x2c, 0xe8, 0xe1, 0x57, 0x87, 0x1c, 0xfc, 0xf1, 0xce, 0xf4, 0x0e, 0x21, 0x75, 0xfc, 0x65, + 0xb7, 0x9d, 0x4a, 0x99, 0xc8, 0xbf, 0x44, 0x76, 0xaf, 0x19, 0xb9, 0xbb, 0x51, 0xe4, 0x87, 0xa4, + 0xbf, 0x32, 0xb8, 0x62, 0x12, 0xe5, 0x12, 0x34, 0x93, 0xb0, 0xe7, 0x89, 0x1c, 0x07, 0xdf, 0xe7, + 0x9e, 0x73, 0x35, 0xf7, 0x9c, 0x5f, 0x73, 0xcf, 0xf9, 0xb2, 0xf0, 0x3a, 0x57, 0x0b, 0xaf, 0xf3, + 0x73, 0xe1, 0x75, 0xde, 0x9c, 0x46, 0x0a, 0xcf, 0x2f, 0x43, 0x26, 0x74, 0x52, 0xfe, 0xec, 0x47, + 0x29, 0xe0, 0x47, 0x6d, 0x2e, 0xaa, 0x53, 0x0c, 0x32, 0x02, 0xe3, 0xcf, 0xfe, 0xfd, 0xe1, 0xc3, + 0x6d, 0x1b, 0xf6, 0xf1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x45, 0xcd, 0x8e, 0xa0, 0x1e, 0x04, + 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) { + 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 *ClassSelector) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClassSelector) 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 { + { + size, err := m.MinStartDate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + 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 { + return ErrInvalidLengthTypes + } + if (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 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClassSelector) 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: ClassSelector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClassSelector: 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) + } + 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.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 + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (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) + } + 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 3: + 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 + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + 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 { + return ErrInvalidLengthTypes + } + if (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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTypes + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/ecocredit/query.pb.gw.go b/x/ecocredit/query.pb.gw.go index b1b7babca6..6bb461ebff 100644 --- a/x/ecocredit/query.pb.gw.go +++ b/x/ecocredit/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join var ( filter_Query_Classes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} @@ -1118,12 +1120,14 @@ func local_request_Query_BasketCredits_0(ctx context.Context, marshaler runtime. // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Classes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1131,6 +1135,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Classes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1144,6 +1149,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ClassInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1151,6 +1158,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ClassInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1164,6 +1172,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Projects_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1171,6 +1181,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Projects_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1184,6 +1195,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ProjectInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1191,6 +1204,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ProjectInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1204,6 +1218,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Batches_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1211,6 +1227,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Batches_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1224,6 +1241,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_BatchInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1231,6 +1250,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_BatchInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1244,6 +1264,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Balance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1251,6 +1273,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Balance_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1264,6 +1287,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Supply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1271,6 +1296,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Supply_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1284,6 +1310,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_CreditTypes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1291,6 +1319,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_CreditTypes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1304,6 +1333,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1311,6 +1342,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1324,6 +1356,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_SellOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1331,6 +1365,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_SellOrder_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1344,6 +1379,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_SellOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1351,6 +1388,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_SellOrders_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1364,6 +1402,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_SellOrdersByBatchDenom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1371,6 +1411,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_SellOrdersByBatchDenom_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1384,6 +1425,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_SellOrdersByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1391,6 +1434,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_SellOrdersByAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1404,6 +1448,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_BuyOrder_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1411,6 +1457,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_BuyOrder_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1424,6 +1471,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_BuyOrders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1431,6 +1480,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_BuyOrders_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1444,6 +1494,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_BuyOrdersByAddress_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1451,6 +1503,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_BuyOrdersByAddress_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1464,6 +1517,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_AllowedAskDenoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1471,6 +1526,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_AllowedAskDenoms_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1484,6 +1540,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Basket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1491,6 +1549,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Basket_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1504,6 +1563,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Baskets_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1511,6 +1572,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Baskets_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -1524,6 +1586,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_BasketCredits_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -1531,6 +1595,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_BasketCredits_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) diff --git a/x/ecocredit/server/core/denom.go b/x/ecocredit/server/core/denom.go new file mode 100644 index 0000000000..2886f4c202 --- /dev/null +++ b/x/ecocredit/server/core/denom.go @@ -0,0 +1,16 @@ +package core + +import ( + "fmt" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" +) + +// FormatClassID formats the ID to use for a new credit class, based on the credit type and +// sequence number. This format may evolve over time, but will maintain +// backwards compatibility. +// +// The initial version has format: +// +func FormatClassID(creditType v1beta1.CreditType, classSeqNo uint64) string { + return fmt.Sprintf("%s%02d", creditType.Abbreviation, classSeqNo) +} diff --git a/x/ecocredit/server/core/genesis.go b/x/ecocredit/server/core/genesis.go new file mode 100644 index 0000000000..0ce3977306 --- /dev/null +++ b/x/ecocredit/server/core/genesis.go @@ -0,0 +1,30 @@ +package core + +import ( + "encoding/json" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/orm/types/ormjson" + regentypes "github.com/regen-network/regen-ledger/types" + abci "github.com/tendermint/tendermint/abci/types" +) + +// InitGenesis performs genesis initialization for the ecocredit module. It +// returns no validator updates. +func (s serverImpl) InitGenesis(ctx regentypes.Context, cdc codec.Codec, data json.RawMessage) ([]abci.ValidatorUpdate, error) { + goCtx := ctx.Context.Context() + target, err := ormjson.NewRawMessageSource(data) + if err != nil { + return nil, err + } + return []abci.ValidatorUpdate{}, s.db.ImportJSON(goCtx, target) +} + +// ExportGenesis will dump the ecocredit module state into a serializable GenesisState. +func (s serverImpl) ExportGenesis(ctx regentypes.Context, cdc codec.Codec) (json.RawMessage, error) { + target := ormjson.NewRawMessageTarget() + err := s.db.ExportJSON(ctx.Context.Context(), target) + if err != nil { + return nil, err + } + return target.JSON() +} diff --git a/x/ecocredit/server/core/invariants.go b/x/ecocredit/server/core/invariants.go new file mode 100644 index 0000000000..f8e0a89c06 --- /dev/null +++ b/x/ecocredit/server/core/invariants.go @@ -0,0 +1,217 @@ +package core + +import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit" +) + +// RegisterInvariants registers the ecocredit module invariants. +func (s serverImpl) RegisterInvariants(ir sdk.InvariantRegistry) { + ir.RegisterRoute(ecocredit.ModuleName, "tradable-supply", s.tradableSupplyInvariant()) + ir.RegisterRoute(ecocredit.ModuleName, "retired-supply", s.retiredSupplyInvariant()) +} + +func (s serverImpl) tradableSupplyInvariant() sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + supplyStore := s.batchSupplyStore + batchStore := s.batchInfoStore + balanceStore := s.batchBalanceStore + return tradableSupplyInvariant(supplyStore, balanceStore, batchStore, ctx) + } +} + +func tradableSupplyInvariant(batchSupplyStore ecocreditv1beta1.BatchSupplyStore, balanceStore ecocreditv1beta1.BatchBalanceStore, batchInfoStore ecocreditv1beta1.BatchInfoStore, ctx sdk.Context) (string, bool) { + var ( + msg string + broken bool + ) + calTradableSupplies := make(map[string]math.Dec) + + err := iterateBalances(balanceStore, batchInfoStore, true, ctx, func(denom, supply string) bool { + balance, err := math.NewNonNegativeDecFromString(supply) + if err != nil { + broken = true + msg += fmt.Sprintf("error while parsing tradable balance %v", err) + } + if supply, ok := calTradableSupplies[denom]; ok { + supply, err := math.SafeAddBalance(supply, balance) + if err != nil { + broken = true + msg += fmt.Sprintf("error adding credit batch tradable supply %v", err) + } + calTradableSupplies[denom] = supply + } else { + calTradableSupplies[denom] = balance + } + + return false + }) + if err != nil { + msg = fmt.Sprintf("error querying credit balances tradable supply %v", err) + } + + if err := iterateSupplies(batchSupplyStore, batchInfoStore, true, ctx, func(denom string, s string) bool { + supply, err := math.NewNonNegativeDecFromString(s) + if err != nil { + broken = true + msg += fmt.Sprintf("error while parsing tradable supply for denom: %s", denom) + } + if s1, ok := calTradableSupplies[denom]; ok { + if supply.Cmp(s1) != 0 { + broken = true + msg += fmt.Sprintf("tradable supply is incorrect for %s credit batch, expected %v, got %v", denom, supply, s1) + } + } else { + broken = true + msg += fmt.Sprintf("tradable supply is not found for %s credit batch", denom) + } + return false + }); err != nil { + msg = fmt.Sprintf("error querying credit tradable supply %v", err) + } + + return msg, broken +} + +func (s serverImpl) retiredSupplyInvariant() sdk.Invariant { + return func(ctx sdk.Context) (string, bool) { + supplyStore := s.batchSupplyStore + balanceStore := s.batchBalanceStore + batchStore := s.batchInfoStore + return retiredSupplyInvariant(supplyStore, balanceStore, batchStore, ctx) + } +} + +func retiredSupplyInvariant(supplyStore ecocreditv1beta1.BatchSupplyStore, balanceStore ecocreditv1beta1.BatchBalanceStore, batchInfoStore ecocreditv1beta1.BatchInfoStore, ctx sdk.Context) (string, bool) { + var ( + msg string + broken bool + ) + calRetiredSupplies := make(map[string]math.Dec) + err := iterateBalances(balanceStore, batchInfoStore, false, ctx, func(denom, supply string) bool { + balance, err := math.NewNonNegativeDecFromString(supply) + if err != nil { + broken = true + msg += fmt.Sprintf("error while parsing retired balance %v", err) + } + if supply, ok := calRetiredSupplies[denom]; ok { + supply, err := math.SafeAddBalance(balance, supply) + if err != nil { + broken = true + msg += fmt.Sprintf("error adding credit batch retired supply %v", err) + } + calRetiredSupplies[denom] = supply + } else { + calRetiredSupplies[denom] = balance + } + return false + }) + if err != nil { + msg = fmt.Sprintf("error querying credit retired balances %v", err) + } + + if err := iterateSupplies(supplyStore, batchInfoStore, false, ctx, func(denom, s string) bool { + supply, err := math.NewNonNegativeDecFromString(s) + if err != nil { + broken = true + msg += fmt.Sprintf("error while parsing reired supply for denom: %s", denom) + } + if s1, ok := calRetiredSupplies[denom]; ok { + if supply.Cmp(s1) != 0 { + broken = true + msg += fmt.Sprintf("retired supply is incorrect for %s credit batch, expected %v, got %v", denom, supply, s1) + } + } else { + broken = true + msg += fmt.Sprintf("retired supply is not found for %s credit batch", denom) + } + + return false + }); err != nil { + msg = fmt.Sprintf("error querying credit retired supply %v", err) + } + + return msg, broken +} + +func iterateBalances(store ecocreditv1beta1.BatchBalanceStore, batchStore ecocreditv1beta1.BatchInfoStore, tradable bool, sdkCtx sdk.Context, cb func(denom, balance string) bool) error { + ctx := sdkCtx.Context() + it, err := store.List(ctx, &ecocreditv1beta1.BatchBalanceBatchIdAddressIndexKey{}) + if err != nil { + return err + } + // we cache denoms here so we don't have to ORM query each time + batchIdToDenom := make(map[uint64]string) + for it.Next() { + val, err := it.Value() + if err != nil { + return err + } + var batchDenom string + if d, ok := batchIdToDenom[val.BatchId]; ok { + batchDenom = d + } else { + batch, err := batchStore.Get(ctx, val.BatchId) + if err != nil { + return err + } + if batch == nil { + panic(fmt.Sprintf("batch was nil with batch id: %d and denom %s", val.BatchId, batchDenom)) + } + batchDenom = batch.BatchDenom + batchIdToDenom[val.BatchId] = batchDenom + } + + var balance string + if tradable { + balance = val.Tradable + } else { + balance = val.Retired + } + + if cb(batchDenom, balance) { + break + } + } + return nil +} + +func iterateSupplies(supplyStore ecocreditv1beta1.BatchSupplyStore, batchStore ecocreditv1beta1.BatchInfoStore, tradable bool, sdkCtx sdk.Context, cb func(denom, supply string) bool) error { + ctx := sdkCtx.Context() + it, err := supplyStore.List(ctx, &ecocreditv1beta1.BatchSupplyBatchIdIndexKey{}) + if err != nil { + return err + } + // we cache denoms here so we don't have to ORM query each time + batchIdToDenom := make(map[uint64]string) + for it.Next() { + val, err := it.Value() + if err != nil { + return err + } + var batchDenom string + if d, ok := batchIdToDenom[val.BatchId]; ok { + batchDenom = d + } else { + batch, err := batchStore.Get(ctx, val.BatchId) + if err != nil { + return err + } + batchDenom = batch.BatchDenom + batchIdToDenom[val.BatchId] = batchDenom + } + var supply string + if tradable { + supply = val.TradableAmount + } else { + supply = val.RetiredAmount + } + if cb(batchDenom, supply) { + break + } + } + return nil +} diff --git a/x/ecocredit/server/core/invariants_test.go b/x/ecocredit/server/core/invariants_test.go new file mode 100644 index 0000000000..561c6b85ed --- /dev/null +++ b/x/ecocredit/server/core/invariants_test.go @@ -0,0 +1,494 @@ +package core + +import ( + "context" + "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/orm/model/ormdb" + "github.com/cosmos/cosmos-sdk/orm/model/ormtable" + sdk "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/known/timestamppb" + "testing" +) + +func setupStore(t *testing.T) ormdb.ModuleDB { + interfaceRegistry := types.NewInterfaceRegistry() + ecocredit.RegisterTypes(interfaceRegistry) + db := dbm.NewMemDB() + + var moduleSchema = ormdb.ModuleSchema{ + FileDescriptors: map[uint32]protoreflect.FileDescriptor{ + 1: ecocreditv1beta1.File_regen_ecocredit_v1beta1_state_proto, + }, + } + backend := ormtable.NewBackend(ormtable.BackendOptions{ + CommitmentStore: db, + IndexStore: nil, + Hooks: nil, + }) + modDB, err := ormdb.NewModuleDB(moduleSchema, ormdb.ModuleDBOptions{ + TypeResolver: nil, + FileResolver: nil, + JSONValidator: nil, + GetBackend: func(ctx context.Context) (ormtable.Backend, error) { + return backend, nil + }, + GetReadBackend: func(ctx context.Context) (ormtable.ReadBackend, error) { + return backend, nil + }, + }) + require.NoError(t, err) + return modDB +} + +func TestTradableSupplyInvariants(t *testing.T) { + acc1 := sdk.AccAddress([]byte("account1")) + acc2 := sdk.AccAddress([]byte("account2")) + + testCases := []struct { + msg string + balances []*ecocredit.Balance + supply []*ecocredit.Supply + expBroken bool + }{ + { + "valid test case", + []*ecocredit.Balance{ + { + Address: acc1.String(), + BatchDenom: "1/2", + TradableBalance: "100", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + TradableBalance: "210", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + RetiredBalance: "210", + }, + }, + []*ecocredit.Supply{ + { + BatchDenom: "1/2", + TradableSupply: "310", + RetiredSupply: "210", + }, + }, + false, + }, + { + "valid test case multiple denom", + []*ecocredit.Balance{ + { + Address: acc1.String(), + BatchDenom: "1/2", + TradableBalance: "100.123", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + TradableBalance: "210.456", + }, + { + Address: acc2.String(), + BatchDenom: "3/4", + TradableBalance: "210.456", + }, + }, + []*ecocredit.Supply{ + { + BatchDenom: "1/2", + TradableSupply: "310.579", + RetiredSupply: "0", + }, + { + BatchDenom: "3/4", + TradableSupply: "210.456", + RetiredSupply: "0", + }, + }, + false, + }, + { + "fail with error tradable balance not found", + []*ecocredit.Balance{ + { + Address: acc1.String(), + BatchDenom: "1/2", + TradableBalance: "100.123", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + TradableBalance: "210.456", + }, + }, + []*ecocredit.Supply{ + { + BatchDenom: "1/2", + TradableSupply: "310.579", + RetiredSupply: "0", + }, + { + BatchDenom: "3/4", + TradableSupply: "1234", + RetiredSupply: "0", + }, + }, + true, + }, + { + "fail with error supply does not match", + []*ecocredit.Balance{ + { + Address: acc1.String(), + BatchDenom: "1/2", + TradableBalance: "100.123", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + TradableBalance: "210.456", + }, + { + BatchDenom: "3/4", + Address: acc2.String(), + TradableBalance: "1234", + }, + }, + []*ecocredit.Supply{ + { + BatchDenom: "1/2", + TradableSupply: "310.57", + RetiredSupply: "0", + }, + { + BatchDenom: "3/4", + TradableSupply: "1234", + RetiredSupply: "0", + }, + }, + true, + }, + } + + db := setupStore(t) + + ctx := sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger()) + supplyStore, err := ecocreditv1beta1.NewBatchSupplyStore(db) + require.NoError(t, err) + balanceStore, err := ecocreditv1beta1.NewBatchBalanceStore(db) + require.NoError(t, err) + batchInfoStore, err := ecocreditv1beta1.NewBatchInfoStore(db) + require.NoError(t, err) + + initBatchDenom(t, ctx.Context(), batchInfoStore, testCases) + + for _, tc := range testCases { + tc := tc + + t.Run(tc.msg, func(t *testing.T) { + + initBalances(t, ctx, balanceStore, batchInfoStore, tc.balances) + initSupply(t, ctx, supplyStore, batchInfoStore, tc.supply) + + msg, broken := tradableSupplyInvariant(supplyStore, balanceStore, batchInfoStore, ctx) + if tc.expBroken { + require.True(t, broken, msg) + } else { + require.False(t, broken, msg) + } + }) + } +} + +func initBatchDenom(t *testing.T, ctx context.Context, store ecocreditv1beta1.BatchInfoStore, testCases []struct { + msg string + balances []*ecocredit.Balance + supply []*ecocredit.Supply + expBroken bool +}) { + for _, tc := range testCases { + for _, b := range tc.balances { + has, err := store.HasByBatchDenom(ctx, b.BatchDenom) + require.NoError(t, err) + if !has { + err := store.Insert(ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: 0, + BatchDenom: b.BatchDenom, + Metadata: nil, + StartDate: timestamppb.Now(), + EndDate: timestamppb.Now(), + }) + require.NoError(t, err) + } + } + for _, s := range tc.supply { + has, err := store.HasByBatchDenom(ctx, s.BatchDenom) + require.NoError(t, err) + if !has { + err := store.Insert(ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: 0, + BatchDenom: s.BatchDenom, + Metadata: nil, + StartDate: timestamppb.Now(), + EndDate: timestamppb.Now(), + }) + require.NoError(t, err) + } + } + } +} + +func TestRetiredSupplyInvariants(t *testing.T) { + acc1 := sdk.AccAddress([]byte("account1")) + acc2 := sdk.AccAddress([]byte("account2")) + + testCases := []struct { + msg string + balances []*ecocredit.Balance + supply []*ecocredit.Supply + expBroken bool + }{ + { + "valid test case", + []*ecocredit.Balance{ + { + Address: acc1.String(), + BatchDenom: "1/2", + RetiredBalance: "100", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + RetiredBalance: "210", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + TradableBalance: "210", + }, + }, + []*ecocredit.Supply{ + { + BatchDenom: "1/2", + RetiredSupply: "310", + TradableSupply: "210", + }, + }, + false, + }, + { + "valid test case multiple denom", + []*ecocredit.Balance{ + { + Address: acc1.String(), + BatchDenom: "1/2", + RetiredBalance: "100.123", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + RetiredBalance: "210.456", + }, + { + Address: acc2.String(), + BatchDenom: "3/4", + RetiredBalance: "210.456", + }, + }, + []*ecocredit.Supply{ + { + BatchDenom: "1/2", + RetiredSupply: "310.579", + TradableSupply: "0", + }, + { + BatchDenom: "3/4", + RetiredSupply: "210.456", + TradableSupply: "0", + }, + }, + false, + }, + { + "fail with error retired balance not found", + []*ecocredit.Balance{ + { + Address: acc1.String(), + BatchDenom: "1/2", + RetiredBalance: "100.123", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + RetiredBalance: "210.456", + }, + }, + []*ecocredit.Supply{ + { + BatchDenom: "1/2", + RetiredSupply: "310.579", + TradableSupply: "0", + }, + { + BatchDenom: "3/4", + RetiredSupply: "1234", + TradableSupply: "0", + }, + }, + true, + }, + { + "fail with error retired supply does not match", + []*ecocredit.Balance{ + { + Address: acc1.String(), + BatchDenom: "1/2", + RetiredBalance: "100.123", + }, + { + Address: acc2.String(), + BatchDenom: "1/2", + RetiredBalance: "210.456", + }, + { + BatchDenom: "3/4", + Address: acc2.String(), + RetiredBalance: "1234", + }, + }, + []*ecocredit.Supply{ + { + BatchDenom: "1/2", + RetiredSupply: "310.57", + TradableSupply: "0", + }, + { + BatchDenom: "3/4", + RetiredSupply: "1234", + TradableSupply: "0", + }, + }, + true, + }, + } + ctx := sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger()) + db := setupStore(t) + supplyStore, err := ecocreditv1beta1.NewBatchSupplyStore(db) + require.NoError(t, err) + balanceStore, err := ecocreditv1beta1.NewBatchBalanceStore(db) + require.NoError(t, err) + batchInfoStore, err := ecocreditv1beta1.NewBatchInfoStore(db) + require.NoError(t, err) + initBatchDenom(t, ctx.Context(), batchInfoStore, testCases) + for _, tc := range testCases { + tc := tc + t.Run(tc.msg, func(t *testing.T) { + initBalances(t, ctx, balanceStore, batchInfoStore, tc.balances) + initSupply(t, ctx, supplyStore, batchInfoStore, tc.supply) + msg, broken := retiredSupplyInvariant(supplyStore, balanceStore, batchInfoStore, ctx) + if tc.expBroken { + require.True(t, broken, msg) + } else { + require.False(t, broken, msg) + } + }) + } +} + +func initBalances(t *testing.T, ctx sdk.Context, store ecocreditv1beta1.BatchBalanceStore, batchInfoStore ecocreditv1beta1.BatchInfoStore, balances []*ecocredit.Balance) { + for _, b := range balances { + addr, err := sdk.AccAddressFromBech32(b.Address) + require.NoError(t, err) + info, err := batchInfoStore.GetByBatchDenom(ctx.Context(), b.BatchDenom) + require.NoError(t, err) + id := info.Id + if b.TradableBalance == "" { + b.TradableBalance = "0" + } + if b.RetiredBalance == "" { + b.RetiredBalance = "0" + } + + trad, err := math.NewNonNegativeDecFromString(b.TradableBalance) + require.NoError(t, err) + ret, err := math.NewNonNegativeDecFromString(b.RetiredBalance) + require.NoError(t, err) + + bal, err := store.Get(ctx.Context(), addr, id) + if err == nil && bal != nil { + balTrad, err := math.NewNonNegativeDecFromString(bal.Tradable) + require.NoError(t, err) + balRet, err := math.NewNonNegativeDecFromString(bal.Retired) + require.NoError(t, err) + trad, err = balTrad.Add(trad) + require.NoError(t, err) + ret, err = balRet.Add(ret) + require.NoError(t, err) + err = store.Update(ctx.Context(), &ecocreditv1beta1.BatchBalance{ + Address: addr, + BatchId: id, + Tradable: trad.String(), + Retired: ret.String(), + }) + require.NoError(t, err) + } else { + err = store.Insert(ctx.Context(), &ecocreditv1beta1.BatchBalance{ + Address: addr, + BatchId: id, + Tradable: trad.String(), + Retired: ret.String(), + }) + require.NoError(t, err) + } + } +} + +func initSupply(t *testing.T, ctx sdk.Context, store ecocreditv1beta1.BatchSupplyStore, batchStore ecocreditv1beta1.BatchInfoStore, supply []*ecocredit.Supply) { + for _, s := range supply { + info, err := batchStore.GetByBatchDenom(ctx.Context(), s.BatchDenom) + require.NoError(t, err) + id := info.Id + trad, err := math.NewNonNegativeDecFromString(s.TradableSupply) + require.NoError(t, err) + ret, err := math.NewNonNegativeDecFromString(s.RetiredSupply) + require.NoError(t, err) + sup, err := store.Get(ctx.Context(), id) + if err == nil && sup != nil { + supplyTradable, err := math.NewNonNegativeDecFromString(sup.TradableAmount) + require.NoError(t, err) + supplyRetired, err := math.NewNonNegativeDecFromString(sup.RetiredAmount) + require.NoError(t, err) + trad, err = supplyTradable.Add(trad) + require.NoError(t, err) + ret, err = supplyRetired.Add(ret) + require.NoError(t, err) + err = store.Update(ctx.Context(), &ecocreditv1beta1.BatchSupply{ + BatchId: sup.BatchId, + TradableAmount: trad.String(), + RetiredAmount: ret.String(), + CancelledAmount: "", + }) + require.NoError(t, err) + } else { + err = store.Insert(ctx.Context(), &ecocreditv1beta1.BatchSupply{ + BatchId: id, + TradableAmount: trad.String(), + RetiredAmount: ret.String(), + CancelledAmount: "", + }) + require.NoError(t, err) + } + } +} diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go new file mode 100644 index 0000000000..cc42ba225a --- /dev/null +++ b/x/ecocredit/server/core/msg_server.go @@ -0,0 +1,1199 @@ +package core + +import ( + "context" + "fmt" + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + basketv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1beta1" + marketplacev1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1beta1" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "google.golang.org/protobuf/types/known/timestamppb" +) + +// TODO: Revisit this once we have proper gas fee framework. +// Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, https://github.com/cosmos/cosmos-sdk/discussions/9072 +const gasCostPerIteration = uint64(10) + +// CreateClass creates a new class of ecocredit +// +// The admin is charged a fee for creating the class. This is controlled by +// the global parameter CreditClassFee, which can be updated through the +// governance process. +func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass) (*v1beta1.MsgCreateClassResponse, error) { + regenCtx := types.UnwrapSDKContext(ctx) + sdkCtx := sdk.UnwrapSDKContext(ctx) + // Charge the admin a fee to create the credit class + adminAddress, err := sdk.AccAddressFromBech32(req.Admin) + if err != nil { + return nil, err + } + + var params ecocredit.Params + s.paramSpace.GetParamSet(regenCtx.Context, ¶ms) + if params.AllowlistEnabled && !s.isCreatorAllowListed(regenCtx, params.AllowedClassCreators, adminAddress) { + return nil, sdkerrors.ErrUnauthorized.Wrapf("%s is not allowed to create credit classes", adminAddress.String()) + } + + err = s.chargeCreditClassFee(regenCtx.Context, adminAddress) + if err != nil { + return nil, err + } + + //creditType, err := s.creditTypeStore.GetByName(ctx, req.CreditTypeName) + //if err != nil { + // return nil, err + //} + + creditType, err := s.getCreditType(sdkCtx, req.CreditTypeName) + if err != nil { + return nil, err + } + + classSeq, err := s.getClassSequenceNo(ctx, req.CreditTypeName) + if err != nil { + return nil, fmt.Errorf("error getting class sequence") + } + classID := FormatClassID(creditType, classSeq) + + // TODO(Tyler): waiting for PR that should make this should return the row ID, should include in event and response. + _, err = s.classInfoStore.InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ + Name: classID, + Admin: req.Admin, + Metadata: req.Metadata, + CreditType: req.CreditTypeName, + }) + if err != nil { + return nil, err + } + + for _, issuer := range req.Issuers { + if err = s.classIssuerStore.Insert(ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: classID, + Issuer: issuer, + }); err != nil { + return nil, err + } + } + + err = regenCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateClass{ + ClassId: classID, + Admin: req.Admin, + }) + if err != nil { + return nil, err + } + + return &v1beta1.MsgCreateClassResponse{ClassId: classID}, nil +} + +// CreateProject creates a new project. +func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreateProject) (*v1beta1.MsgCreateProjectResponse, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + classID := req.ClassId + classInfo, err := s.classInfoStore.GetByName(ctx, classID) + if err != nil { + return nil, err + } + + err = s.assertClassIssuer(ctx, classID, req.Issuer) + if err != nil { + return nil, err + } + + projectID := req.ProjectId + if projectID == "" { + found := false + for !found { + projectID, err = s.genProjectID(ctx, classInfo.Id, classInfo.Name) + if err != nil { + return nil, err + } + found, err = s.projectInfoStore.HasByClassIdName(ctx, classInfo.Id, projectID) + if err != nil { + return nil, err + } + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "project id sequence") + } + } + + // TODO(Tyler): update this to handle the id it returns and put it in event and response. + _, err = s.projectInfoStore.InsertReturningID(ctx, &ecocreditv1beta1.ProjectInfo{ + Name: projectID, + ClassId: classInfo.Id, + ProjectLocation: req.ProjectLocation, + Metadata: req.Metadata, + }) + if err != nil { + return nil, err + } + + if err := sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateProject{ + ClassId: classID, + ProjectId: projectID, + Issuer: req.Issuer, + ProjectLocation: req.ProjectLocation, + }); err != nil { + return nil, err + } + + return &v1beta1.MsgCreateProjectResponse{ + ProjectId: projectID, + }, nil +} + +// CreateBatch creates a new batch of credits. +// Credits in the batch must not have more decimal places than the credit type's specified precision. +func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch) (*v1beta1.MsgCreateBatchResponse, error) { + regenCtx := types.UnwrapSDKContext(ctx) + sdkCtx := sdk.UnwrapSDKContext(ctx) + projectID := req.ProjectId + + projectInfo, err := s.projectInfoStore.GetByName(ctx, projectID) + if err != nil { + return nil, err + } + + classInfo, err := s.classInfoStore.Get(ctx, projectInfo.ClassId) + if err != nil { + return nil, err + } + + err = s.assertClassIssuer(ctx, classInfo.Name, req.Issuer) + if err != nil { + return nil, err + } + + creditType, err := s.getCreditType(sdkCtx, classInfo.CreditType) + if err != nil { + return nil, err + } + + maxDecimalPlaces := creditType.Precision + + batchSeqNo, err := s.getBatchSeqNo(ctx, projectID) + if err != nil { + return nil, err + } + + batchDenom, err := ecocredit.FormatDenom(classInfo.Name, batchSeqNo, req.StartDate, req.EndDate) + if err != nil { + return nil, err + } + + // TODO(Tyler): this should return the ID. we need to use it. wait for update. + id, err := s.batchInfoStore.InsertReturningID(ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: projectInfo.Id, + BatchDenom: batchDenom, + Metadata: req.Metadata, + StartDate: timestamppb.New(req.StartDate.UTC()), + EndDate: timestamppb.New(req.EndDate.UTC()), + }) + if err != nil { + return nil, err + } + newBatchID := id + + tradableSupply, retiredSupply := math.NewDecFromInt64(0), math.NewDecFromInt64(0) + + for _, issuance := range req.Issuance { + decs, err := getNonNegativeFixedDecs(maxDecimalPlaces, issuance.TradableAmount, issuance.RetiredAmount) + if err != nil { + return nil, err + } + tradable, retired := decs[0], decs[1] + + recipient, _ := sdk.AccAddressFromBech32(issuance.Recipient) + if !tradable.IsZero() { + tradableSupply, err = tradableSupply.Add(tradable) + if err != nil { + return nil, err + } + } + if !retired.IsZero() { + retiredSupply, err = retiredSupply.Add(retired) + if err != nil { + return nil, err + } + if err = regenCtx.EventManager().EmitTypedEvent(&v1beta1.EventRetire{ + Retirer: recipient.String(), + BatchDenom: batchDenom, + Amount: retired.String(), + Location: issuance.RetirementLocation, + }); err != nil { + return nil, err + } + } + if err = s.batchBalanceStore.Insert(ctx, &ecocreditv1beta1.BatchBalance{ + Address: recipient, + BatchId: newBatchID, + Tradable: tradable.String(), + Retired: retired.String(), + }); err != nil { + return nil, err + } + + if err = regenCtx.EventManager().EmitTypedEvent(&v1beta1.EventReceive{ + Recipient: recipient.String(), + BatchDenom: batchDenom, + RetiredAmount: tradable.String(), + TradableAmount: retired.String(), + }); err != nil { + return nil, err + } + + regenCtx.GasMeter().ConsumeGas(gasCostPerIteration, "batch issuance") + } + + if err = s.batchSupplyStore.Insert(ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: newBatchID, + TradableAmount: tradableSupply.String(), + RetiredAmount: retiredSupply.String(), + CancelledAmount: math.NewDecFromInt64(0).String(), + }); err != nil { + return nil, err + } + + // TODO(Tyler): put id here + return &v1beta1.MsgCreateBatchResponse{BatchDenom: batchDenom}, nil +} + +// Send sends credits to a recipient. +// Send also retires credits if the amount to retire is specified in the request. +func (s serverImpl) Send(ctx context.Context, req *v1beta1.MsgSend) (*v1beta1.MsgSendResponse, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + sender, _ := sdk.AccAddressFromBech32(req.Sender) + recipient, _ := sdk.AccAddressFromBech32(req.Recipient) + + for _, credit := range req.Credits { + err := s.sendEcocredits(ctx, credit, recipient, sender) + if err != nil { + return nil, err + } + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventReceive{ + Sender: req.Sender, + Recipient: req.Recipient, + BatchDenom: credit.BatchDenom, + TradableAmount: credit.TradableAmount, + RetiredAmount: credit.RetiredAmount, + }); err != nil { + return nil, err + } + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "send ecocredits") + } + return &v1beta1.MsgSendResponse{}, nil +} + +// Retire credits to the specified location. +// WARNING: retiring credits is permanent. Retired credits cannot be un-retired. +func (s serverImpl) Retire(ctx context.Context, req *v1beta1.MsgRetire) (*v1beta1.MsgRetireResponse, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + holder, _ := sdk.AccAddressFromBech32(req.Holder) + + for _, credit := range req.Credits { + batch, err := s.batchInfoStore.GetByBatchDenom(ctx, credit.BatchDenom) + if err != nil { + return nil, err + } + creditType, err := s.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) + if err != nil { + return nil, err + } + userBalance, err := s.batchBalanceStore.Get(ctx, holder, batch.Id) + if err != nil { + return nil, err + } + + decs, err := getNonNegativeFixedDecs(creditType.Precision, credit.Amount, userBalance.Tradable) + if err != nil { + return nil, err + } + amtToRetire, userTradableBalance := decs[0], decs[1] + + userTradableBalance, err = userTradableBalance.Sub(amtToRetire) + if err != nil { + return nil, err + } + if userTradableBalance.IsNegative() { + return nil, ecocredit.ErrInsufficientFunds.Wrapf("cannot retire %s credits with a balance of %s", credit.Amount, userBalance.Tradable) + } + userRetiredBalance, err := math.NewNonNegativeFixedDecFromString(userBalance.Retired, creditType.Precision) + if err != nil { + return nil, err + } + userRetiredBalance, err = userRetiredBalance.Add(amtToRetire) + if err != nil { + return nil, err + } + batchSupply, err := s.batchSupplyStore.Get(ctx, batch.Id) + if err != nil { + return nil, err + } + decs, err = getNonNegativeFixedDecs(creditType.Precision, batchSupply.RetiredAmount, batchSupply.TradableAmount) + if err != nil { + return nil, err + } + supplyRetired, supplyTradable := decs[0], decs[1] + supplyRetired, err = supplyRetired.Add(amtToRetire) + if err != nil { + return nil, err + } + supplyTradable, err = supplyTradable.Sub(amtToRetire) + if err != nil { + return nil, err + } + + if err = s.batchBalanceStore.Update(ctx, &ecocreditv1beta1.BatchBalance{ + Address: holder, + BatchId: batch.Id, + Tradable: userTradableBalance.String(), + Retired: userRetiredBalance.String(), + }); err != nil { + return nil, err + } + err = s.batchSupplyStore.Update(ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: batch.Id, + TradableAmount: supplyTradable.String(), + RetiredAmount: supplyRetired.String(), + CancelledAmount: batchSupply.CancelledAmount, + }) + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventRetire{ + Retirer: req.Holder, + BatchDenom: credit.BatchDenom, + Amount: credit.Amount, + Location: req.Location, + }); err != nil { + return nil, err + } + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "retire ecocredits") + } + return &v1beta1.MsgRetireResponse{}, nil +} + +// Cancel credits, removing them from the supply and balance of the holder +func (s serverImpl) Cancel(ctx context.Context, req *v1beta1.MsgCancel) (*v1beta1.MsgCancelResponse, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + holder, _ := sdk.AccAddressFromBech32(req.Holder) + + for _, credit := range req.Credits { + batch, err := s.batchInfoStore.GetByBatchDenom(ctx, credit.BatchDenom) + if err != nil { + return nil, err + + } + creditType, err := s.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) + if err != nil { + return nil, err + } + precision := creditType.Precision + + userBalance, err := s.batchBalanceStore.Get(ctx, holder, batch.Id) + if err != nil { + return nil, err + } + batchSupply, err := s.batchSupplyStore.Get(ctx, batch.Id) + if err != nil { + return nil, err + } + decs, err := getNonNegativeFixedDecs(precision, credit.Amount, batchSupply.TradableAmount, userBalance.Tradable, batchSupply.CancelledAmount) + if err != nil { + return nil, err + } + amtToCancelDec, supplyTradable, userBalTradable, cancelledDec := decs[0], decs[1], decs[2], decs[3] + userBalTradable, err = math.SafeSubBalance(userBalTradable, amtToCancelDec) + if err != nil { + return nil, err + } + supplyTradable, err = math.SafeSubBalance(supplyTradable, amtToCancelDec) + if err != nil { + return nil, err + } + cancelledDec, err = cancelledDec.Add(amtToCancelDec) + if err != nil { + return nil, err + } + if err = s.batchBalanceStore.Update(ctx, &ecocreditv1beta1.BatchBalance{ + Address: holder, + BatchId: batch.Id, + Tradable: userBalTradable.String(), + Retired: userBalance.Retired, + }); err != nil { + return nil, err + } + if err = s.batchSupplyStore.Update(ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: batch.Id, + TradableAmount: supplyTradable.String(), + RetiredAmount: batchSupply.RetiredAmount, + CancelledAmount: cancelledDec.String(), + }); err != nil { + return nil, err + } + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCancel{ + Canceller: holder.String(), + BatchDenom: credit.BatchDenom, + Amount: credit.Amount, + }); err != nil { + return nil, err + } + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "cancel ecocredits") + } + return &v1beta1.MsgCancelResponse{}, nil +} + +func (s serverImpl) UpdateClassAdmin(ctx context.Context, req *v1beta1.MsgUpdateClassAdmin) (*v1beta1.MsgUpdateClassAdminResponse, error) { + classInfo, err := s.classInfoStore.GetByName(ctx, req.ClassId) + if err != nil { + return nil, err + } + if classInfo.Admin != req.Admin { + return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) + } + classInfo.Admin = req.NewAdmin + if err = s.classInfoStore.Update(ctx, classInfo); err != nil { + return nil, err + } + return &v1beta1.MsgUpdateClassAdminResponse{}, err +} + +func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpdateClassIssuers) (*v1beta1.MsgUpdateClassIssuersResponse, error) { + class, err := s.classInfoStore.GetByName(ctx, req.ClassId) + if err != nil { + return nil, err + } + if class.Admin != req.Admin { + return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", class.Admin, req.Admin) + } + + // delete the old issuers + if err = s.classIssuerStore.DeleteBy(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(class.Name)); err != nil { + return nil, err + } + + // add the new issuers + for _, issuer := range req.Issuers { + if err = s.classIssuerStore.Insert(ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: req.ClassId, + Issuer: issuer, + }); err != nil { + return nil, err + } + } + return &v1beta1.MsgUpdateClassIssuersResponse{}, nil +} + +func (s serverImpl) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpdateClassMetadata) (*v1beta1.MsgUpdateClassMetadataResponse, error) { + classInfo, err := s.classInfoStore.GetByName(ctx, req.ClassId) + if err != nil { + return nil, err + } + if classInfo.Admin != req.Admin { + return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) + } + classInfo.Metadata = req.Metadata + if err = s.classInfoStore.Update(ctx, classInfo); err != nil { + return nil, err + } + return &v1beta1.MsgUpdateClassMetadataResponse{}, err +} + +// Sell creates new sell orders for credits +// TODO: update this function with ORM +func (s serverImpl) Sell(ctx context.Context, sell *marketplacev1beta1.MsgSell) (*marketplacev1beta1.MsgSellResponse, error) { + panic("implement me") + //ctx := types.UnwrapSDKContext(goCtx) + //owner := req.Owner + //store := ctx.KVStore(s.storeKey) + // + //ownerAddr, err := sdk.AccAddressFromBech32(owner) + //if err != nil { + // return nil, err + //} + // + //sellOrderIds := make([]uint64, len(req.Orders)) + // + //for i, order := range req.Orders { + // + // // verify expiration is in the future + // if order.Expiration != nil && order.Expiration.Before(ctx.BlockTime()) { + // return nil, sdkerrors.ErrInvalidRequest.Wrapf("expiration must be in the future: %s", order.Expiration) + // } + // + // err = verifyCreditBalance(store, ownerAddr, order.BatchDenom, order.Quantity) + // if err != nil { + // return nil, err + // } + // + // // TODO: Verify that AskPrice.Denom is in AllowAskDenom #624 + // + // orderID, err := s.createSellOrder(ctx, owner, order) + // if err != nil { + // return nil, err + // } + // + // sellOrderIds[i] = orderID + // err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventSell{ + // OrderId: orderID, + // BatchDenom: order.BatchDenom, + // Quantity: order.Quantity, + // AskPrice: order.AskPrice, + // DisableAutoRetire: order.DisableAutoRetire, + // Expiration: order.Expiration, + // }) + // if err != nil { + // return nil, err + // } + // + // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "create sell order") + //} + // + //return &ecocredit.MsgSellResponse{SellOrderIds: sellOrderIds}, nil +} + +// TODO: implement this with ORM +func (s serverImpl) createSellOrder(ctx types.Context, owner string, o *marketplacev1beta1.MsgSell_Order) (uint64, error) { + panic("impl me!") + //orderID := s.sellOrderTable.Sequence().PeekNextVal(ctx) + //_, err := s.sellOrderTable.Create(ctx, &ecocredit.SellOrder{ + // Owner: owner, + // OrderId: orderID, + // BatchDenom: o.BatchDenom, + // Quantity: o.Quantity, + // AskPrice: o.AskPrice, + // DisableAutoRetire: o.DisableAutoRetire, + // Expiration: o.Expiration, + //}) + //return orderID, err +} + +// UpdateSellOrders updates existing sell orders for credits +// TODO: impl with ORM +func (s serverImpl) UpdateSellOrders(ctx context.Context, orders *marketplacev1beta1.MsgUpdateSellOrders) (*marketplacev1beta1.MsgUpdateSellOrdersResponse, error) { + panic("implement me") + //ctx := types.UnwrapSDKContext(goCtx) + //owner := req.Owner + //store := ctx.KVStore(s.storeKey) + // + //ownerAddr, err := sdk.AccAddressFromBech32(owner) + //if err != nil { + // return nil, err + //} + // + //for _, update := range req.Updates { + // + // // verify expiration is in the future + // if update.NewExpiration != nil && update.NewExpiration.Before(ctx.BlockTime()) { + // return nil, sdkerrors.ErrInvalidRequest.Wrapf("expiration must be in the future: %s", update.NewExpiration) + // } + // + // sellOrder, err := s.getSellOrder(ctx, update.SellOrderId) + // if err != nil { + // return nil, ecocredit.ErrInvalidSellOrder.Wrapf("sell order id %d not found", update.SellOrderId) + // } + // + // if req.Owner != sellOrder.Owner { + // return nil, sdkerrors.ErrUnauthorized.Wrapf("signer is not the owner of sell order id %d", update.SellOrderId) + // } + // + // // TODO: Verify that NewAskPrice.Denom is in AllowAskDenom #624 + // + // err = verifyCreditBalance(store, ownerAddr, sellOrder.BatchDenom, update.NewQuantity) + // if err != nil { + // return nil, err + // } + // + // sellOrder.Quantity = update.NewQuantity + // sellOrder.AskPrice = update.NewAskPrice + // sellOrder.DisableAutoRetire = update.DisableAutoRetire + // sellOrder.Expiration = update.NewExpiration + // + // err = s.sellOrderTable.Update(ctx, sellOrder.OrderId, sellOrder) + // if err != nil { + // return nil, err + // } + // + // err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventUpdateSellOrder{ + // Owner: owner, + // SellOrderId: sellOrder.OrderId, + // BatchDenom: sellOrder.BatchDenom, + // NewQuantity: sellOrder.Quantity, + // NewAskPrice: sellOrder.AskPrice, + // DisableAutoRetire: sellOrder.DisableAutoRetire, + // NewExpiration: sellOrder.Expiration, + // }) + // if err != nil { + // return nil, err + // } + // + // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "update sell order") + //} + // + //return &ecocredit.MsgUpdateSellOrdersResponse{}, nil +} + +// Buy creates new buy orders for credits +func (s serverImpl) Buy(ctx context.Context, buy *marketplacev1beta1.MsgBuy) (*marketplacev1beta1.MsgBuyResponse, error) { + panic("implement me") + //ctx := types.UnwrapSDKContext(goCtx) + //sdkCtx := sdk.UnwrapSDKContext(goCtx) + //store := ctx.KVStore(s.storeKey) + //buyer := req.Buyer + // + //buyerAddr, err := sdk.AccAddressFromBech32(buyer) + //if err != nil { + // return nil, err + //} + // + //buyOrderIds := make([]uint64, len(req.Orders)) + // + //for i, order := range req.Orders { + // + // // verify expiration is in the future + // if order.Expiration != nil && order.Expiration.Before(ctx.BlockTime()) { + // return nil, sdkerrors.ErrInvalidRequest.Wrapf("expiration must be in the future: %s", order.Expiration) + // } + // + // balances := s.bankKeeper.SpendableCoins(sdkCtx, buyerAddr) + // bidPrice := order.BidPrice + // balanceAmount := balances.AmountOf(bidPrice.Denom) + // + // // TODO: Verify that bidPrice.Denom is in AllowAskDenom #624 + // + // // get decimal amount of credits desired for purchase + // creditsDesired, err := math.NewPositiveDecFromString(order.Quantity) + // if err != nil { + // return nil, err + // } + // + // // calculate the amount of coin to send for purchase + // coinToSend, err := getCoinNeeded(creditsDesired, bidPrice) + // if err != nil { + // return nil, err + // } + // + // // verify buyer has sufficient balance in coin + // if balanceAmount.LT(coinToSend.Amount) { + // return nil, sdkerrors.ErrInsufficientFunds.Wrapf("insufficient balance: got %s, needed at least: %s", balanceAmount.String(), coinToSend.Amount.String()) + // } + // + // switch order.Selection.Sum.(type) { + // case *ecocredit.MsgBuy_Order_Selection_SellOrderId: + // + // sellOrderId := order.Selection.GetSellOrderId() + // sellOrder, err := s.getSellOrder(ctx, sellOrderId) + // if err != nil { + // return nil, err + // } + // + // sellerAddr, err := sdk.AccAddressFromBech32(sellOrder.Owner) + // if err != nil { + // return nil, err + // } + // + // // verify bid price and ask price denoms match + // if bidPrice.Denom != sellOrder.AskPrice.Denom { + // return nil, sdkerrors.ErrInvalidRequest.Wrapf("bid price denom does not match ask price denom: got %s, expected: %s", bidPrice.Denom, sellOrder.AskPrice.Denom) + // } + // + // // verify bid price is greater than or equal to ask price + // if bidPrice.Amount.LT(sellOrder.AskPrice.Amount) { + // return nil, sdkerrors.ErrInvalidRequest.Wrapf("bid price too low: got %s, needed at least: %s", bidPrice.String(), sellOrder.AskPrice.String()) + // } + // + // // verify seller has sufficient balance in credits + // err = verifyCreditBalance(store, sellerAddr, sellOrder.BatchDenom, sellOrder.Quantity) + // if err != nil { + // return nil, ecocredit.ErrInvalidSellOrder.Wrap(err.Error()) + // } + // + // // get decimal amount of credits available for purchase + // creditsAvailable, err := math.NewDecFromString(sellOrder.Quantity) + // if err != nil { + // return nil, ecocredit.ErrInvalidSellOrder.Wrap(err.Error()) + // } + // + // creditsToReceive := creditsDesired + // + // // check if credits desired is more than credits available + // if creditsDesired.Cmp(creditsAvailable) == 1 { + // + // // error if partial fill disabled + // if order.DisablePartialFill { + // return nil, ecocredit.ErrInsufficientFunds.Wrap("sell order does not have sufficient credits to fill the buy order") + // } + // + // creditsToReceive = creditsAvailable + // + // // recalculate coinToSend if creditsToReceive is not creditsDesired + // coinToSend, err = getCoinNeeded(creditsToReceive, bidPrice) + // if err != nil { + // return nil, err + // } + // } + // + // // send coin to the seller account + // err = s.bankKeeper.SendCoins(sdkCtx, buyerAddr, sellerAddr, sdk.Coins{coinToSend}) + // if err != nil { + // return nil, err + // } + // + // // error if auto-retire is required for given sell order + // if !sellOrder.DisableAutoRetire && order.DisableAutoRetire { + // return nil, ecocredit.ErrInvalidBuyOrder.Wrapf("auto-retire is required for sell order %d", sellOrder.OrderId) + // } + // + // // error if auto-retire is required and missing location + // if !sellOrder.DisableAutoRetire && order.RetirementLocation == "" { + // return nil, ecocredit.ErrInvalidBuyOrder.Wrapf("retirement location is required for sell order %d", sellOrder.OrderId) + // } + // + // // declare credit for send message + // credit := &ecocredit.MsgSend_SendCredits{ + // BatchDenom: sellOrder.BatchDenom, + // } + // + // // set tradable or retired amount depending on auto-retire + // if sellOrder.DisableAutoRetire && order.DisableAutoRetire { + // credit.RetiredAmount = "0" + // credit.TradableAmount = creditsToReceive.String() + // } else { + // credit.RetiredAmount = creditsToReceive.String() + // credit.RetirementLocation = order.RetirementLocation + // credit.TradableAmount = "0" + // } + // + // // send credits to the buyer account + // err = s.sendEcocredits(ctx, credit, store, sellerAddr, buyerAddr) + // if err != nil { + // return nil, err + // } + // + // // get remaining credits in sell order + // creditsRemaining, err := creditsAvailable.Sub(creditsToReceive) + // if err != nil { + // return nil, err + // } + // + // if creditsRemaining.IsZero() { + // + // // delete sell order if no remaining credits + // if err := s.sellOrderTable.Delete(ctx, sellOrder.OrderId); err != nil { + // return nil, err + // } + // + // } else { + // sellOrder.Quantity = creditsRemaining.String() + // + // // update sell order quantity with remaining credits + // err = s.sellOrderTable.Update(ctx, sellOrder.OrderId, sellOrder) + // if err != nil { + // return nil, err + // } + // } + // + // // TODO: do we want to store a direct buy order? #623 + // buyOrderID := s.buyOrderTable.Sequence().NextVal(ctx) + // buyOrderIds[i] = buyOrderID + // + // err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventBuyOrderCreated{ + // BuyOrderId: buyOrderID, + // SellOrderId: sellOrderId, + // Quantity: order.Quantity, + // BidPrice: order.BidPrice, + // DisableAutoRetire: order.DisableAutoRetire, + // DisablePartialFill: order.DisablePartialFill, + // RetirementLocation: order.RetirementLocation, + // Expiration: order.Expiration, + // }) + // if err != nil { + // return nil, err + // } + // + // err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventBuyOrderFilled{ + // BuyOrderId: buyOrderID, + // SellOrderId: sellOrderId, + // BatchDenom: sellOrder.BatchDenom, + // Quantity: creditsToReceive.String(), + // TotalPrice: &coinToSend, + // }) + // if err != nil { + // return nil, err + // } + // + // // TODO: implement processing for filter option #623 + // //case *ecocredit.MsgBuy_Order_Selection_Filter: + // + // default: + // return nil, sdkerrors.ErrInvalidRequest + // } + // + // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "create buy order") + //} + // + //return &ecocredit.MsgBuyResponse{BuyOrderIds: buyOrderIds}, nil +} + +// TODO: impl with ORM +func (s serverImpl) createBuyOrder(ctx types.Context, buyer string, o *marketplacev1beta1.MsgBuy_Order) (uint64, error) { + panic("impl me!") + //orderID := s.buyOrderTable.Sequence().PeekNextVal(ctx) + //selection := ecocredit.BuyOrder_Selection{ + // Sum: &ecocredit.BuyOrder_Selection_SellOrderId{ + // SellOrderId: o.Selection.GetSellOrderId(), + // }, + //} + //_, err := s.buyOrderTable.Create(ctx, &ecocredit.BuyOrder{ + // Buyer: buyer, + // BuyOrderId: orderID, + // Selection: &selection, + // Quantity: o.Quantity, + // BidPrice: o.BidPrice, + // DisableAutoRetire: o.DisableAutoRetire, + // DisablePartialFill: o.DisablePartialFill, + // Expiration: o.Expiration, + //}) + //return orderID, err +} + +// AllowAskDenom adds a new ask denom +// TODO: impl with ORM +func (s serverImpl) AllowAskDenom(ctx context.Context, denom *marketplacev1beta1.MsgAllowAskDenom) (*marketplacev1beta1.MsgAllowAskDenomResponse, error) { + panic("implement me") + // ctx := types.UnwrapSDKContext(goCtx) + // + //rootAddress := s.accountKeeper.GetModuleAddress(govtypes.ModuleName).String() + // + //if req.RootAddress != rootAddress { + // return nil, sdkerrors.ErrUnauthorized.Wrapf("root address must be governance module address, got: %s, expected: %s", req.RootAddress, rootAddress) + //} + // + //err := s.askDenomTable.Create(ctx, &ecocredit.AskDenom{ + // Denom: req.Denom, + // DisplayDenom: req.DisplayDenom, + // Exponent: req.Exponent, + //}) + //if err != nil { + // return nil, err + //} + // + //err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventAllowAskDenom{ + // Denom: req.Denom, + // DisplayDenom: req.DisplayDenom, + // Exponent: req.Exponent, + //}) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.MsgAllowAskDenomResponse{}, nil +} + +func (s serverImpl) CreateBasket(ctx context.Context, basket *basketv1beta1.MsgCreateBasket) (*basketv1beta1.MsgCreateBasketResponse, error) { + panic("implement me") +} + +func (s serverImpl) AddToBasket(ctx context.Context, basket *basketv1beta1.MsgAddToBasket) (*basketv1beta1.MsgAddToBasketResponse, error) { + panic("implement me") +} + +func (s serverImpl) TakeFromBasket(ctx context.Context, basket *basketv1beta1.MsgTakeFromBasket) (*basketv1beta1.MsgTakeFromBasketResponse, error) { + panic("implement me") +} + +func (s serverImpl) PickFromBasket(ctx context.Context, basket *basketv1beta1.MsgPickFromBasket) (*basketv1beta1.MsgPickFromBasketResponse, error) { + panic("implement me") +} + +// ------- UTILITIES ------ + +// Checks if the given address is in the allowlist of credit class creators +func (s serverImpl) isCreatorAllowListed(ctx types.Context, allowlist []string, designer sdk.Address) bool { + for _, addr := range allowlist { + ctx.GasMeter().ConsumeGas(gasCostPerIteration, "credit class creators allowlist") + allowListedAddr, _ := sdk.AccAddressFromBech32(addr) + if designer.Equals(allowListedAddr) { + return true + } + } + return false +} + +// AssertClassIssuer makes sure that the issuer is part of issuers of given classID. +// Returns ErrUnauthorized otherwise. +func (s serverImpl) assertClassIssuer(goCtx context.Context, classID, issuer string) error { + it, err := s.classIssuerStore.List(goCtx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classID)) + if err != nil { + return err + } + + defer it.Close() + for it.Next() { + v, err := it.Value() + if err != nil { + return err + } + if v.Issuer == issuer { + return nil + } + } + return sdkerrors.ErrUnauthorized.Wrapf("%s is not an issuer for class %s", issuer, classID) +} + +func (s serverImpl) genProjectID(ctx context.Context, classRowID uint64, classID string) (string, error) { + var nextID uint64 + projectSeqNo, err := s.projectSeqStore.Get(ctx, classRowID) + switch err { + case ormerrors.NotFound: + nextID = 1 + case nil: + nextID = projectSeqNo.NextProjectId + default: + return "", err + } + + if err = s.projectSeqStore.Save(ctx, &ecocreditv1beta1.ProjectSequence{ + ClassId: classRowID, + NextProjectId: nextID + 1, + }); err != nil { + return "", err + } + + return ecocredit.FormatProjectID(classID, nextID), nil +} + +func (s serverImpl) getBatchSeqNo(ctx context.Context, projectID string) (uint64, error) { + var seq uint64 + batchSeq, err := s.batchSeqStore.Get(ctx, projectID) + + switch err { + case ormerrors.NotFound: + seq = 1 + case nil: + seq = batchSeq.NextBatchId + default: + return 0, err + } + if err = s.batchSeqStore.Save(ctx, &ecocreditv1beta1.BatchSequence{ + ProjectId: projectID, + NextBatchId: seq + 1, + }); err != nil { + return 0, err + } + + return seq, err +} + +func (s serverImpl) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_SendCredits, to, from sdk.AccAddress) error { + batch, err := s.batchInfoStore.GetByBatchDenom(ctx, credit.BatchDenom) + if err != nil { + return err + } + creditType, err := s.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) + if err != nil { + return err + } + precision := creditType.Precision + + batchSupply, err := s.batchSupplyStore.Get(ctx, batch.Id) + if err != nil { + return err + } + fromBalance, err := s.batchBalanceStore.Get(ctx, from, batch.Id) + if err != nil { + if err == ormerrors.NotFound { + return ecocredit.ErrInsufficientFunds.Wrapf("you do not have any credits from batch %s", batch.BatchDenom) + } + return err + } + + toBalance, err := s.batchBalanceStore.Get(ctx, to, batch.Id) + if err != nil { + if err == ormerrors.NotFound { + toBalance = &ecocreditv1beta1.BatchBalance{ + Address: to, + BatchId: batch.Id, + Tradable: "0", + Retired: "0", + } + } else { + return err + } + } + decs, err := getNonNegativeFixedDecs(precision, toBalance.Tradable, toBalance.Retired, fromBalance.Tradable, fromBalance.Retired, credit.TradableAmount, credit.RetiredAmount, batchSupply.TradableAmount, batchSupply.RetiredAmount) + if err != nil { + return err + } + toTradableBalance, toRetiredBalance, + fromTradableBalance, fromRetiredBalance, + sendAmtTradable, sendAmtRetired, + batchSupplyTradable, batchSupplyRetired := decs[0], decs[1], decs[2], decs[3], decs[4], decs[5], decs[6], decs[7] + + if !sendAmtTradable.IsZero() { + fromTradableBalance, err = math.SafeSubBalance(fromTradableBalance, sendAmtTradable) + if err != nil { + return err + } + toTradableBalance, err = toTradableBalance.Add(sendAmtTradable) + if err != nil { + return err + } + } + + didRetire := false + if !sendAmtRetired.IsZero() { + didRetire = true + fromTradableBalance, err = math.SafeSubBalance(fromTradableBalance, sendAmtRetired) + if err != nil { + return err + } + toRetiredBalance, err = toRetiredBalance.Add(sendAmtRetired) + if err != nil { + return err + } + batchSupplyRetired, err = batchSupplyRetired.Add(sendAmtRetired) + if err != nil { + return err + } + batchSupplyTradable, err = batchSupplyTradable.Sub(sendAmtRetired) + if err != nil { + return err + } + } + // update the "to" balance + if err := s.batchBalanceStore.Save(ctx, &ecocreditv1beta1.BatchBalance{ + Address: to, + BatchId: batch.Id, + Tradable: toTradableBalance.String(), + Retired: toRetiredBalance.String(), + }); err != nil { + return err + } + + // update the "from" balance + if err := s.batchBalanceStore.Update(ctx, &ecocreditv1beta1.BatchBalance{ + Address: from, + BatchId: batch.Id, + Tradable: fromTradableBalance.String(), + Retired: fromRetiredBalance.String(), + }); err != nil { + return err + } + // update the "retired" balance only if credits were retired + if didRetire { + if err := s.batchSupplyStore.Update(ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: batch.Id, + TradableAmount: batchSupplyTradable.String(), + RetiredAmount: batchSupplyRetired.String(), + CancelledAmount: batchSupply.CancelledAmount, + }); err != nil { + return err + } + if err = sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&ecocredit.EventRetire{ + Retirer: to.String(), + BatchDenom: credit.BatchDenom, + Amount: sendAmtRetired.String(), + Location: credit.RetirementLocation, + }); err != nil { + return err + } + } + return nil +} + +func getNonNegativeFixedDecs(precision uint32, decimals ...string) ([]math.Dec, error) { + decs := make([]math.Dec, len(decimals)) + for i, decimal := range decimals { + dec, err := math.NewNonNegativeFixedDecFromString(decimal, precision) + if err != nil { + return nil, err + } + decs[i] = dec + } + return decs, nil +} + +func (s serverImpl) getCreditTypeFromBatchDenom(ctx context.Context, denom string) (v1beta1.CreditType, error) { + classId := ecocredit.GetClassIdFromBatchDenom(denom) + classInfo, err := s.classInfoStore.GetByName(ctx, classId) + if err != nil { + return v1beta1.CreditType{}, err + } + return s.getCreditType(sdk.UnwrapSDKContext(ctx), classInfo.CreditType) +} + +func (s serverImpl) getClassSequenceNo(ctx context.Context, ctype string) (uint64, error) { + var seq uint64 + classSeq, err := s.classSeqStore.Get(ctx, ctype) + switch err { + case nil: + seq = classSeq.NextClassId + case ormerrors.NotFound: + seq = 1 + default: + return 0, err + } + err = s.classSeqStore.Save(ctx, &ecocreditv1beta1.ClassSequence{ + CreditType: ctype, + NextClassId: seq + 1, + }) + return seq, err +} + +func (s serverImpl) getCreditType(ctx sdk.Context, creditTypeName string) (v1beta1.CreditType, error) { + creditTypes := s.getAllCreditTypes(ctx) + creditTypeName = ecocredit.NormalizeCreditTypeName(creditTypeName) + for _, creditType := range creditTypes { + // credit type name's stored via params have enforcement on normalization, so we can be sure they will already + // be normalized here. + if creditType.Name == creditTypeName { + return *creditType, nil + } + } + return v1beta1.CreditType{}, sdkerrors.ErrInvalidType.Wrapf("%s is not a valid credit type", creditTypeName) +} + +func (s serverImpl) getAllCreditTypes(ctx sdk.Context) []*v1beta1.CreditType { + var params ecocredit.Params + s.paramSpace.GetParamSet(ctx, ¶ms) + creditTypes := params.CreditTypes + v1beta1types := make([]*v1beta1.CreditType, len(creditTypes)) + for i, typ := range creditTypes { + v1beta1types[i] = &v1beta1.CreditType{ + Abbreviation: typ.Abbreviation, + Name: typ.Name, + Unit: typ.Unit, + Precision: typ.Precision, + } + } + return v1beta1types +} + +func (s serverImpl) getCreditClassFee(ctx sdk.Context) sdk.Coins { + var params ecocredit.Params + s.paramSpace.GetParamSet(ctx, ¶ms) + return params.CreditClassFee +} + +func (s serverImpl) chargeCreditClassFee(ctx sdk.Context, creatorAddr sdk.AccAddress) error { + creditClassFee := s.getCreditClassFee(ctx) + + // Move the fee to the ecocredit module's account + err := s.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, ecocredit.ModuleName, creditClassFee) + if err != nil { + return err + } + + // Burn the coins + // TODO: Update this implementation based on the discussion at + // https://github.com/regen-network/regen-ledger/issues/351 + err = s.bankKeeper.BurnCoins(ctx, ecocredit.ModuleName, creditClassFee) + if err != nil { + return err + } + + return nil +} diff --git a/x/ecocredit/server/core/operations.go b/x/ecocredit/server/core/operations.go new file mode 100644 index 0000000000..a6e5722ab6 --- /dev/null +++ b/x/ecocredit/server/core/operations.go @@ -0,0 +1,20 @@ +package core + +import ( + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// WeightedOperations returns all the ecocredit module operations with their respective weights. +// TODO: sim refactor PR +func (s serverImpl) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + //key := s.storeKey.(servermodule.RootModuleKey) + //queryClient := ecocredit.NewQueryClient(key) + // + //return simulation.WeightedOperations( + // simState.AppParams, simState.Cdc, + // s.accountKeeper, s.bankKeeper, + // queryClient, + //) + return nil +} diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go new file mode 100644 index 0000000000..ff3dc0f69d --- /dev/null +++ b/x/ecocredit/server/core/query_server.go @@ -0,0 +1,619 @@ +package core + +import ( + "context" + queryv1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/query/v1beta1" + "github.com/cosmos/cosmos-sdk/orm/model/ormlist" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/gogo/protobuf/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// Classes queries for all credit classes with pagination. +func (s serverImpl) Classes(ctx context.Context, request *v1beta1.QueryClassesRequest) (*v1beta1.QueryClassesResponse, error) { + if request == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + if request.Pagination == nil { + request.Pagination = &query.PageRequest{} + } + p := request.Pagination + it, err := s.classInfoStore.List(ctx, &ecocreditv1beta1.ClassInfoPrimaryKey{}, ormlist.Paginate(&queryv1beta1.PageRequest{ + Key: p.Key, + Offset: p.Offset, + Limit: p.Limit, + CountTotal: p.CountTotal, + Reverse: p.Reverse, + })) + if err != nil { + return nil, err + } + infos := make([]*v1beta1.ClassInfo, 0) + for it.Next() { + info, err := it.Value() + if err != nil { + return nil, err + } + infos = append(infos, &v1beta1.ClassInfo{ + Id: info.Id, + Name: info.Name, + Admin: info.Admin, + Metadata: info.Metadata, + CreditType: info.CreditType, + }) + } + return nil, err +} + +// ClassInfo queries for information on a credit class. +func (s serverImpl) ClassInfo(ctx context.Context, request *v1beta1.QueryClassInfoRequest) (*v1beta1.QueryClassInfoResponse, error) { + if request == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + if err := ecocredit.ValidateClassID(request.ClassId); err != nil { + return nil, err + } + classInfo, err := s.classInfoStore.GetByName(ctx, request.ClassId) + if err != nil { + return nil, err + } + + issuers := make([]string, 0) + it, err := s.classIssuerStore.List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId)) + if err != nil { + return nil, err + } + for it.Next() { + val, err := it.Value() + if err != nil { + return nil, err + } + issuers = append(issuers, val.Issuer) + } + + return &v1beta1.QueryClassInfoResponse{Info: &v1beta1.ClassInfo{ + Id: classInfo.Id, + Name: request.ClassId, + Admin: classInfo.Admin, + Metadata: classInfo.Metadata, + CreditType: classInfo.CreditType, + }}, nil +} + +func (s serverImpl) ClassIssuers(ctx context.Context, request *v1beta1.QueryClassIssuersRequest) (*v1beta1.QueryClassIssuersResponse, error) { + if request == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + if request.Pagination == nil { + request.Pagination = &query.PageRequest{} + } + p := request.Pagination + if err := ecocredit.ValidateClassID(request.ClassId); err != nil { + return nil, err + } + + it, err := s.classIssuerStore.List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId), ormlist.Paginate(&queryv1beta1.PageRequest{ + Key: p.Key, + Offset: p.Offset, + Limit: p.Limit, + CountTotal: p.CountTotal, + Reverse: p.Reverse, + })) + if err != nil { + return nil, err + } + + issuers := make([]string, 0) + for it.Next() { + issuer, err := it.Value() + if err != nil { + return nil, err + } + issuers = append(issuers, issuer.Issuer) + } + pr := it.PageResponse() + + return &v1beta1.QueryClassIssuersResponse{ + Issuers: issuers, + Pagination: &query.PageResponse{ + NextKey: pr.NextKey, + Total: pr.Total, + }, + }, nil +} + +// Projects queries projects of a given credit batch. +func (s serverImpl) Projects(ctx context.Context, request *v1beta1.QueryProjectsRequest) (*v1beta1.QueryProjectsResponse, error) { + if request == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + if request.Pagination == nil { + request.Pagination = &query.PageRequest{} + } + p := request.Pagination + cInfo, err := s.classInfoStore.GetByName(ctx, request.ClassId) + if err != nil { + return nil, err + } + it, err := s.projectInfoStore.List(ctx, ecocreditv1beta1.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ + Key: p.Key, + Offset: p.Offset, + Limit: p.Limit, + CountTotal: p.CountTotal, + Reverse: p.Reverse, + })) + if err != nil { + return nil, err + } + projectInfos := make([]*v1beta1.ProjectInfo, 0) + for it.Next() { + info, err := it.Value() + if err != nil { + return nil, err + } + classInfo, err := s.classInfoStore.Get(ctx, info.ClassId) + if err != nil { + return nil, err + } + projectInfos = append(projectInfos, &v1beta1.ProjectInfo{ + Id: info.Id, + Name: info.Name, + ClassId: classInfo.Id, + ProjectLocation: info.ProjectLocation, + Metadata: info.Metadata, + }) + } + pg := it.PageResponse() + return &v1beta1.QueryProjectsResponse{ + Projects: projectInfos, + Pagination: &query.PageResponse{ + NextKey: pg.NextKey, + Total: pg.Total, + }, + }, nil +} + +func (s serverImpl) ProjectInfo(ctx context.Context, request *v1beta1.QueryProjectInfoRequest) (*v1beta1.QueryProjectInfoResponse, error) { + if request == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + if err := ecocredit.ValidateProjectID(request.ProjectId); err != nil { + return nil, err + } + pInfo, err := s.projectInfoStore.GetByName(ctx, request.ProjectId) + if err != nil { + return nil, err + } + + cInfo, err := s.classInfoStore.Get(ctx, pInfo.ClassId) + if err != nil { + return nil, err + } + + return &v1beta1.QueryProjectInfoResponse{Info: &v1beta1.ProjectInfo{ + Id: pInfo.Id, + Name: request.ProjectId, + ClassId: cInfo.Id, + ProjectLocation: pInfo.ProjectLocation, + Metadata: pInfo.Metadata, + }}, nil +} + +// Batches queries for all batches in the given credit class. +func (s serverImpl) Batches(ctx context.Context, request *v1beta1.QueryBatchesRequest) (*v1beta1.QueryBatchesResponse, error) { + if request == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + if request.Pagination == nil { + request.Pagination = &query.PageRequest{} + } + p := request.Pagination + project, err := s.projectInfoStore.GetByName(ctx, request.ProjectId) + if err != nil { + return nil, err + } + it, err := s.batchInfoStore.List(ctx, ecocreditv1beta1.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ + Key: p.Key, + Offset: p.Offset, + Limit: p.Limit, + CountTotal: p.CountTotal, + Reverse: p.Reverse, + })) + if err != nil { + return nil, err + } + + projectName := request.ProjectId + pinfo, err := s.projectInfoStore.GetByName(ctx, projectName) + if err != nil { + return nil, err + } + + batches := make([]*v1beta1.BatchInfo, 0) + for it.Next() { + batch, err := it.Value() + if err != nil { + return nil, err + } + + protoStart, err := types.TimestampProto(batch.StartDate.AsTime()) + if err != nil { + return nil, err + } + protoEnd, err := types.TimestampProto(batch.EndDate.AsTime()) + if err != nil { + return nil, err + } + batches = append(batches, &v1beta1.BatchInfo{ + ProjectId: pinfo.Id, + BatchDenom: batch.BatchDenom, + Metadata: batch.Metadata, + StartDate: protoStart, + EndDate: protoEnd, + }) + } + pr := it.PageResponse() + return &v1beta1.QueryBatchesResponse{ + Batches: batches, + Pagination: &query.PageResponse{ + NextKey: pr.NextKey, + Total: pr.Total, + }, + }, nil +} + +// BatchInfo queries for information on a credit batch. +func (s serverImpl) BatchInfo(ctx context.Context, request *v1beta1.QueryBatchInfoRequest) (*v1beta1.QueryBatchInfoResponse, error) { + if request == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + if err := ecocredit.ValidateDenom(request.BatchDenom); err != nil { + return nil, err + } + + batch, err := s.batchInfoStore.GetByBatchDenom(ctx, request.BatchDenom) + if err != nil { + return nil, err + } + + project, err := s.projectInfoStore.Get(ctx, batch.ProjectId) + if err != nil { + return nil, err + } + + protoStart, err := types.TimestampProto(batch.StartDate.AsTime()) + if err != nil { + return nil, err + } + protoEnd, err := types.TimestampProto(batch.EndDate.AsTime()) + if err != nil { + return nil, err + } + return &v1beta1.QueryBatchInfoResponse{ + Info: &v1beta1.BatchInfo{ + Id: batch.Id, + ProjectId: project.Id, + BatchDenom: request.BatchDenom, + Metadata: batch.Metadata, + StartDate: protoStart, + EndDate: protoEnd, + }, + }, nil +} + +// Balance queries the balance (both tradable and retired) of a given credit +// batch for a given account. +func (s serverImpl) Balance(ctx context.Context, req *v1beta1.QueryBalanceRequest) (*v1beta1.QueryBalanceResponse, error) { + if req == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + if err := ecocredit.ValidateDenom(req.BatchDenom); err != nil { + return nil, err + } + batch, err := s.batchInfoStore.GetByBatchDenom(ctx, req.BatchDenom) + if err != nil { + return nil, err + } + if batch == nil { + return nil, sdkerrors.ErrNotFound.Wrapf("batch with denom %s not found", req.BatchDenom) + } + addr, _ := sdk.AccAddressFromBech32(req.Account) + + balance, err := s.batchBalanceStore.Get(ctx, addr, batch.Id) + if err != nil { + return nil, err + } + if balance == nil { + return &v1beta1.QueryBalanceResponse{ + TradableAmount: "0", + RetiredAmount: "0", + }, nil + } + return &v1beta1.QueryBalanceResponse{ + TradableAmount: balance.Tradable, + RetiredAmount: balance.Retired, + }, nil +} + +// Supply queries the supply (tradable, retired, cancelled) of a given credit batch. +func (s serverImpl) Supply(ctx context.Context, request *v1beta1.QuerySupplyRequest) (*v1beta1.QuerySupplyResponse, error) { + if request == nil { + return nil, status.Errorf(codes.InvalidArgument, "empty request") + } + + if err := ecocredit.ValidateDenom(request.BatchDenom); err != nil { + return nil, err + } + + batch, err := s.batchInfoStore.GetByBatchDenom(ctx, request.BatchDenom) + if err != nil { + return nil, err + } + + supply, err := s.batchSupplyStore.Get(ctx, batch.Id) + if err != nil { + return nil, err + } + + return &v1beta1.QuerySupplyResponse{ + TradableSupply: supply.TradableAmount, + RetiredSupply: supply.RetiredAmount, + CancelledAmount: supply.CancelledAmount, + }, nil +} + +// CreditTypes queries the list of allowed types that credit classes can have. +// TODO: migrate to v1beta1 +func (s serverImpl) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypesRequest) (*v1beta1.QueryCreditTypesResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + creditTypes := s.getAllCreditTypes(sdkCtx) + return &v1beta1.QueryCreditTypesResponse{CreditTypes: creditTypes}, nil +} + +// Params queries the ecocredit module parameters. +// TODO: refactor to v1beta1 +func (s serverImpl) Params(ctx context.Context, _ *v1beta1.QueryParamsRequest) (*v1beta1.QueryParamsResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + var params ecocredit.Params + s.paramSpace.GetParamSet(sdkCtx, ¶ms) + v1beta1types := make([]*v1beta1.CreditType, len(params.CreditTypes)) + for i, typ := range params.CreditTypes { + v1beta1types[i] = &v1beta1.CreditType{ + Abbreviation: typ.Abbreviation, + Name: typ.Name, + Unit: typ.Unit, + Precision: typ.Precision, + } + } + v1beta1Params := v1beta1.Params{ + CreditClassFee: params.CreditClassFee, + AllowedClassCreators: params.AllowedClassCreators, + AllowlistEnabled: params.AllowlistEnabled, + CreditTypes: v1beta1types, + } + return &v1beta1.QueryParamsResponse{Params: &v1beta1Params}, nil +} + +// SellOrder queries for information about a sell order by its ID +// TODO: impl with ORM, integrate sell order? +func (s serverImpl) SellOrder(goCtx context.Context, request *ecocredit.QuerySellOrderRequest) (*ecocredit.QuerySellOrderResponse, error) { + panic("impl me!") + //if request == nil { + // return nil, status.Errorf(codes.InvalidArgument, "empty request") + //} + // + //ctx := types.UnwrapSDKContext(goCtx) + //sellOrder, err := s.getSellOrder(ctx, request.SellOrderId) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.QuerySellOrderResponse{SellOrder: sellOrder}, nil +} + +// SellOrders queries for all sell orders with pagination. +// TODO: impl with ORM +func (s serverImpl) SellOrders(goCtx context.Context, request *ecocredit.QuerySellOrdersRequest) (*ecocredit.QuerySellOrdersResponse, error) { + panic("impl me!") + //if request == nil { + // return nil, status.Errorf(codes.InvalidArgument, "empty request") + //} + // + //ctx := types.UnwrapSDKContext(goCtx) + //ordersIter, err := s.sellOrderTable.PrefixScan(ctx, 1, math.MaxUint64) + //if err != nil { + // return nil, err + //} + // + //var orders []*ecocredit.SellOrder + //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.QuerySellOrdersResponse{ + // SellOrders: orders, + // Pagination: pageResp, + //}, nil +} + +// SellOrdersByAddress queries for all sell orders by address with pagination. +// TODO: impl with ORM +func (s serverImpl) SellOrdersByAddress(goCtx context.Context, request *ecocredit.QuerySellOrdersByAddressRequest) (*ecocredit.QuerySellOrdersByAddressResponse, error) { + panic("impl me!") + //if request == nil { + // return nil, status.Errorf(codes.InvalidArgument, "empty request") + //} + // + //addr, err := sdk.AccAddressFromBech32(request.Address) + //if err != nil { + // return nil, err + //} + // + //ctx := types.UnwrapSDKContext(goCtx) + //ordersIter, err := s.sellOrderByAddressIndex.GetPaginated(ctx, addr.Bytes(), request.Pagination) + //if err != nil { + // return nil, err + //} + // + //var orders []*ecocredit.SellOrder + //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.QuerySellOrdersByAddressResponse{ + // SellOrders: orders, + // Pagination: pageResp, + //}, nil +} + +// SellOrdersByBatchDenom queries for all sell orders by address with pagination. +// TODO: impl with ORM +func (s serverImpl) SellOrdersByBatchDenom(goCtx context.Context, request *ecocredit.QuerySellOrdersByBatchDenomRequest) (*ecocredit.QuerySellOrdersByBatchDenomResponse, error) { + panic("impl me!") + //if request == nil { + // return nil, status.Errorf(codes.InvalidArgument, "empty request") + //} + // + //if err := ecocredit.ValidateDenom(request.BatchDenom); err != nil { + // return nil, err + //} + // + //ctx := types.UnwrapSDKContext(goCtx) + //ordersIter, err := s.sellOrderByBatchDenomIndex.GetPaginated(ctx, request.BatchDenom, request.Pagination) + //if err != nil { + // return nil, err + //} + // + //var orders []*ecocredit.SellOrder + //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.QuerySellOrdersByBatchDenomResponse{ + // SellOrders: orders, + // Pagination: pageResp, + //}, nil +} + +// BuyOrder queries for information about a buy order by its ID +// TODO: impl with ORM +func (s serverImpl) BuyOrder(goCtx context.Context, request *ecocredit.QueryBuyOrderRequest) (*ecocredit.QueryBuyOrderResponse, error) { + panic("impl me!") + //if request == nil { + // return nil, status.Errorf(codes.InvalidArgument, "empty request") + //} + // + //ctx := types.UnwrapSDKContext(goCtx) + //buyOrder, err := s.getBuyOrder(ctx, request.BuyOrderId) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.QueryBuyOrderResponse{BuyOrder: buyOrder}, nil +} + +// BuyOrders queries for all buy orders with pagination. +// TODO: impl with ORM +func (s serverImpl) BuyOrders(goCtx context.Context, request *ecocredit.QueryBuyOrdersRequest) (*ecocredit.QueryBuyOrdersResponse, error) { + panic("impl me!") + //if request == nil { + // return nil, status.Errorf(codes.InvalidArgument, "empty request") + //} + // + //ctx := types.UnwrapSDKContext(goCtx) + //ordersIter, err := s.buyOrderTable.PrefixScan(ctx, 1, math.MaxUint64) + //if err != nil { + // return nil, err + //} + // + //var orders []*ecocredit.BuyOrder + //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.QueryBuyOrdersResponse{ + // BuyOrders: orders, + // Pagination: pageResp, + //}, nil +} + +// BuyOrdersByAddress queries for all buy orders by address with pagination. +// TODO: impl with ORM +func (s serverImpl) BuyOrdersByAddress(goCtx context.Context, request *ecocredit.QueryBuyOrdersByAddressRequest) (*ecocredit.QueryBuyOrdersByAddressResponse, error) { + panic("impl me!") + //if request == nil { + // return nil, status.Errorf(codes.InvalidArgument, "empty request") + //} + // + //ctx := types.UnwrapSDKContext(goCtx) + //addr, err := sdk.AccAddressFromBech32(request.Address) + //if err != nil { + // return nil, err + //} + // + //ordersIter, err := s.buyOrderByAddressIndex.GetPaginated(ctx, addr.Bytes(), request.Pagination) + //if err != nil { + // return nil, err + //} + // + //var orders []*ecocredit.BuyOrder + //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.QueryBuyOrdersByAddressResponse{ + // BuyOrders: orders, + // Pagination: pageResp, + //}, nil +} + +// AllowedAskDenoms queries for all allowed ask denoms with pagination. +// TODO: impl with ORM +func (s serverImpl) AllowedAskDenoms(goCtx context.Context, request *ecocredit.QueryAllowedAskDenomsRequest) (*ecocredit.QueryAllowedAskDenomsResponse, error) { + panic("impl me!") + //if request == nil { + // return nil, status.Errorf(codes.InvalidArgument, "empty request") + //} + // + //ctx := types.UnwrapSDKContext(goCtx) + //denomsIter, err := s.askDenomTable.PrefixScan(ctx, nil, nil) + //if err != nil { + // return nil, err + //} + // + //var denoms []*ecocredit.AskDenom + //pageResp, err := orm.Paginate(denomsIter, request.Pagination, &denoms) + //if err != nil { + // return nil, err + //} + // + //return &ecocredit.QueryAllowedAskDenomsResponse{ + // AskDenoms: denoms, + // Pagination: pageResp, + //}, nil +} + +// TODO: baskets PR queries + +func (s serverImpl) Basket(ctx context.Context, request *ecocredit.QueryBasketRequest) (*ecocredit.QueryBasketResponse, error) { + panic("implement me") +} + +func (s serverImpl) Baskets(ctx context.Context, request *ecocredit.QueryBasketsRequest) (*ecocredit.QueryBasketsResponse, error) { + panic("implement me") +} + +func (s serverImpl) BasketCredits(ctx context.Context, request *ecocredit.QueryBasketCreditsRequest) (*ecocredit.QueryBasketCreditsResponse, error) { + panic("implement me") +} diff --git a/x/ecocredit/server/core/server.go b/x/ecocredit/server/core/server.go new file mode 100644 index 0000000000..479cace116 --- /dev/null +++ b/x/ecocredit/server/core/server.go @@ -0,0 +1,83 @@ +package core + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/orm/model/ormdb" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types/module/server" + "github.com/regen-network/regen-ledger/types/ormstore" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "google.golang.org/protobuf/reflect/protoreflect" +) + +type serverImpl struct { + storeKey sdk.StoreKey + + paramSpace paramtypes.Subspace + bankKeeper ecocredit.BankKeeper + accountKeeper ecocredit.AccountKeeper + + db ormdb.ModuleDB + + creditTypeStore ecocreditv1beta1.CreditTypeStore + + batchInfoStore ecocreditv1beta1.BatchInfoStore + batchSupplyStore ecocreditv1beta1.BatchSupplyStore + batchBalanceStore ecocreditv1beta1.BatchBalanceStore + batchSeqStore ecocreditv1beta1.BatchSequenceStore + + projectInfoStore ecocreditv1beta1.ProjectInfoStore + projectSeqStore ecocreditv1beta1.ProjectSequenceStore + + classInfoStore ecocreditv1beta1.ClassInfoStore + classIssuerStore ecocreditv1beta1.ClassIssuerStore + classSeqStore ecocreditv1beta1.ClassSequenceStore +} + +var ecocreditSchema = ormdb.ModuleSchema{ + FileDescriptors: map[uint32]protoreflect.FileDescriptor{1: ecocreditv1beta1.File_regen_ecocredit_v1beta1_state_proto}, + Prefix: nil, +} + +func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, + accountKeeper ecocredit.AccountKeeper, bankKeeper ecocredit.BankKeeper, cdc codec.Codec) serverImpl { + + s := serverImpl{ + storeKey: storeKey, + paramSpace: paramSpace, + bankKeeper: bankKeeper, + accountKeeper: accountKeeper, + } + + db, err := ormstore.NewStoreKeyDB(ecocreditSchema, storeKey, ormdb.ModuleDBOptions{}) + if err != nil { + panic(err) + } + s.db = db + + stateStore, err := ecocreditv1beta1.NewStateStore(db) + if err != nil { + panic(err) + } + s.creditTypeStore, s.classInfoStore, s.classSeqStore, s.projectInfoStore, + s.projectSeqStore, s.batchInfoStore, s.batchSeqStore, s.batchBalanceStore, + s.batchSupplyStore, s.classIssuerStore = stateStore.CreditTypeStore(), stateStore.ClassInfoStore(), stateStore.ClassSequenceStore(), + stateStore.ProjectInfoStore(), stateStore.ProjectSequenceStore(), stateStore.BatchInfoStore(), + stateStore.BatchSequenceStore(), stateStore.BatchBalanceStore(), stateStore.BatchSupplyStore(), stateStore.ClassIssuerStore() + + return s +} + +func RegisterServices(configurator server.Configurator, paramSpace paramtypes.Subspace, accountKeeper ecocredit.AccountKeeper, + bankKeeper ecocredit.BankKeeper) v1beta1.MsgServer { + impl := newServer(configurator.ModuleKey(), paramSpace, accountKeeper, bankKeeper, configurator.Marshaler()) + v1beta1.RegisterMsgServer(configurator.MsgServer(), impl) + v1beta1.RegisterQueryServer(configurator.QueryServer(), impl) + configurator.RegisterGenesisHandlers(impl.InitGenesis, impl.ExportGenesis) + configurator.RegisterWeightedOperationsHandler(impl.WeightedOperations) + configurator.RegisterInvariantsHandler(impl.RegisterInvariants) + return impl +} diff --git a/x/ecocredit/v1beta1/query.pb.go b/x/ecocredit/v1beta1/query.pb.go index 1a17dbcbe8..719d3f7178 100644 --- a/x/ecocredit/v1beta1/query.pb.go +++ b/x/ecocredit/v1beta1/query.pb.go @@ -305,6 +305,116 @@ func (m *QueryClassInfoResponse) GetInfo() *ClassInfo { return nil } +// QueryClassIssuersRequest is the Query/ClassIssuers request type. +type QueryClassIssuersRequest struct { + // class_id is the unique ID of credit class to query. + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + // pagination defines an optional pagination for the request. + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryClassIssuersRequest) Reset() { *m = QueryClassIssuersRequest{} } +func (m *QueryClassIssuersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryClassIssuersRequest) ProtoMessage() {} +func (*QueryClassIssuersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_65a0fecd2f04365f, []int{6} +} +func (m *QueryClassIssuersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryClassIssuersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryClassIssuersRequest.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 *QueryClassIssuersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassIssuersRequest.Merge(m, src) +} +func (m *QueryClassIssuersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryClassIssuersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassIssuersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryClassIssuersRequest proto.InternalMessageInfo + +func (m *QueryClassIssuersRequest) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *QueryClassIssuersRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryClassIssuersRequest is the Query/ClassIssuers response type. +type QueryClassIssuersResponse struct { + // issuers is a list of issuers for the credit class + Issuers []string `protobuf:"bytes,1,rep,name=issuers,proto3" json:"issuers,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryClassIssuersResponse) Reset() { *m = QueryClassIssuersResponse{} } +func (m *QueryClassIssuersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryClassIssuersResponse) ProtoMessage() {} +func (*QueryClassIssuersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_65a0fecd2f04365f, []int{7} +} +func (m *QueryClassIssuersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryClassIssuersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryClassIssuersResponse.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 *QueryClassIssuersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryClassIssuersResponse.Merge(m, src) +} +func (m *QueryClassIssuersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryClassIssuersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryClassIssuersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryClassIssuersResponse proto.InternalMessageInfo + +func (m *QueryClassIssuersResponse) GetIssuers() []string { + if m != nil { + return m.Issuers + } + return nil +} + +func (m *QueryClassIssuersResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + // QueryProjectsRequest is the Query/Projects request type. type QueryProjectsRequest struct { // class_id is the unique ID of credit class to query. @@ -317,7 +427,7 @@ func (m *QueryProjectsRequest) Reset() { *m = QueryProjectsRequest{} } func (m *QueryProjectsRequest) String() string { return proto.CompactTextString(m) } func (*QueryProjectsRequest) ProtoMessage() {} func (*QueryProjectsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{6} + return fileDescriptor_65a0fecd2f04365f, []int{8} } func (m *QueryProjectsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -372,7 +482,7 @@ func (m *QueryProjectsResponse) Reset() { *m = QueryProjectsResponse{} } func (m *QueryProjectsResponse) String() string { return proto.CompactTextString(m) } func (*QueryProjectsResponse) ProtoMessage() {} func (*QueryProjectsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{7} + return fileDescriptor_65a0fecd2f04365f, []int{9} } func (m *QueryProjectsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -425,7 +535,7 @@ func (m *QueryProjectInfoRequest) Reset() { *m = QueryProjectInfoRequest func (m *QueryProjectInfoRequest) String() string { return proto.CompactTextString(m) } func (*QueryProjectInfoRequest) ProtoMessage() {} func (*QueryProjectInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{8} + return fileDescriptor_65a0fecd2f04365f, []int{10} } func (m *QueryProjectInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -471,7 +581,7 @@ func (m *QueryProjectInfoResponse) Reset() { *m = QueryProjectInfoRespon func (m *QueryProjectInfoResponse) String() string { return proto.CompactTextString(m) } func (*QueryProjectInfoResponse) ProtoMessage() {} func (*QueryProjectInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{9} + return fileDescriptor_65a0fecd2f04365f, []int{11} } func (m *QueryProjectInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -519,7 +629,7 @@ func (m *QueryBatchesRequest) Reset() { *m = QueryBatchesRequest{} } func (m *QueryBatchesRequest) String() string { return proto.CompactTextString(m) } func (*QueryBatchesRequest) ProtoMessage() {} func (*QueryBatchesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{10} + return fileDescriptor_65a0fecd2f04365f, []int{12} } func (m *QueryBatchesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -574,7 +684,7 @@ func (m *QueryBatchesResponse) Reset() { *m = QueryBatchesResponse{} } func (m *QueryBatchesResponse) String() string { return proto.CompactTextString(m) } func (*QueryBatchesResponse) ProtoMessage() {} func (*QueryBatchesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{11} + return fileDescriptor_65a0fecd2f04365f, []int{13} } func (m *QueryBatchesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -627,7 +737,7 @@ func (m *QueryBatchInfoRequest) Reset() { *m = QueryBatchInfoRequest{} } func (m *QueryBatchInfoRequest) String() string { return proto.CompactTextString(m) } func (*QueryBatchInfoRequest) ProtoMessage() {} func (*QueryBatchInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{12} + return fileDescriptor_65a0fecd2f04365f, []int{14} } func (m *QueryBatchInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -673,7 +783,7 @@ func (m *QueryBatchInfoResponse) Reset() { *m = QueryBatchInfoResponse{} func (m *QueryBatchInfoResponse) String() string { return proto.CompactTextString(m) } func (*QueryBatchInfoResponse) ProtoMessage() {} func (*QueryBatchInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{13} + return fileDescriptor_65a0fecd2f04365f, []int{15} } func (m *QueryBatchInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -721,7 +831,7 @@ func (m *QueryBalanceRequest) Reset() { *m = QueryBalanceRequest{} } func (m *QueryBalanceRequest) String() string { return proto.CompactTextString(m) } func (*QueryBalanceRequest) ProtoMessage() {} func (*QueryBalanceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{14} + return fileDescriptor_65a0fecd2f04365f, []int{16} } func (m *QueryBalanceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -776,7 +886,7 @@ func (m *QueryBalanceResponse) Reset() { *m = QueryBalanceResponse{} } func (m *QueryBalanceResponse) String() string { return proto.CompactTextString(m) } func (*QueryBalanceResponse) ProtoMessage() {} func (*QueryBalanceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{15} + return fileDescriptor_65a0fecd2f04365f, []int{17} } func (m *QueryBalanceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -829,7 +939,7 @@ func (m *QuerySupplyRequest) Reset() { *m = QuerySupplyRequest{} } func (m *QuerySupplyRequest) String() string { return proto.CompactTextString(m) } func (*QuerySupplyRequest) ProtoMessage() {} func (*QuerySupplyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{16} + return fileDescriptor_65a0fecd2f04365f, []int{18} } func (m *QuerySupplyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -873,13 +983,16 @@ type QuerySupplyResponse struct { // retired_supply is the decimal number of retired credits in the batch // supply. RetiredSupply string `protobuf:"bytes,2,opt,name=retired_supply,json=retiredSupply,proto3" json:"retired_supply,omitempty"` + // cancelled_amount is the decimal number of cancelled credits in the batch + // supply. + CancelledAmount string `protobuf:"bytes,3,opt,name=cancelled_amount,json=cancelledAmount,proto3" json:"cancelled_amount,omitempty"` } func (m *QuerySupplyResponse) Reset() { *m = QuerySupplyResponse{} } func (m *QuerySupplyResponse) String() string { return proto.CompactTextString(m) } func (*QuerySupplyResponse) ProtoMessage() {} func (*QuerySupplyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{17} + return fileDescriptor_65a0fecd2f04365f, []int{19} } func (m *QuerySupplyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -922,6 +1035,13 @@ func (m *QuerySupplyResponse) GetRetiredSupply() string { return "" } +func (m *QuerySupplyResponse) GetCancelledAmount() string { + if m != nil { + return m.CancelledAmount + } + return "" +} + // QueryCreditTypesRequest is the Query/Credit_Types request type type QueryCreditTypesRequest struct { } @@ -930,7 +1050,7 @@ func (m *QueryCreditTypesRequest) Reset() { *m = QueryCreditTypesRequest func (m *QueryCreditTypesRequest) String() string { return proto.CompactTextString(m) } func (*QueryCreditTypesRequest) ProtoMessage() {} func (*QueryCreditTypesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{18} + return fileDescriptor_65a0fecd2f04365f, []int{20} } func (m *QueryCreditTypesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -969,7 +1089,7 @@ func (m *QueryCreditTypesResponse) Reset() { *m = QueryCreditTypesRespon func (m *QueryCreditTypesResponse) String() string { return proto.CompactTextString(m) } func (*QueryCreditTypesResponse) ProtoMessage() {} func (*QueryCreditTypesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_65a0fecd2f04365f, []int{19} + return fileDescriptor_65a0fecd2f04365f, []int{21} } func (m *QueryCreditTypesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1012,6 +1132,8 @@ func init() { proto.RegisterType((*QueryClassesResponse)(nil), "regen.ecocredit.v1beta1.QueryClassesResponse") proto.RegisterType((*QueryClassInfoRequest)(nil), "regen.ecocredit.v1beta1.QueryClassInfoRequest") proto.RegisterType((*QueryClassInfoResponse)(nil), "regen.ecocredit.v1beta1.QueryClassInfoResponse") + proto.RegisterType((*QueryClassIssuersRequest)(nil), "regen.ecocredit.v1beta1.QueryClassIssuersRequest") + proto.RegisterType((*QueryClassIssuersResponse)(nil), "regen.ecocredit.v1beta1.QueryClassIssuersResponse") proto.RegisterType((*QueryProjectsRequest)(nil), "regen.ecocredit.v1beta1.QueryProjectsRequest") proto.RegisterType((*QueryProjectsResponse)(nil), "regen.ecocredit.v1beta1.QueryProjectsResponse") proto.RegisterType((*QueryProjectInfoRequest)(nil), "regen.ecocredit.v1beta1.QueryProjectInfoRequest") @@ -1033,70 +1155,75 @@ func init() { } var fileDescriptor_65a0fecd2f04365f = []byte{ - // 1003 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x97, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0xb3, 0x01, 0xf2, 0xe3, 0xb9, 0x14, 0x69, 0x68, 0x69, 0x6a, 0x81, 0x13, 0xb6, 0x94, - 0x44, 0xb4, 0xde, 0x69, 0x52, 0x9a, 0x06, 0xa9, 0xa0, 0x92, 0xa2, 0x42, 0x2e, 0x28, 0xa4, 0x3d, - 0x21, 0xa1, 0x68, 0xbc, 0x9e, 0xb8, 0x06, 0x7b, 0x67, 0xbb, 0x3b, 0x06, 0xa2, 0x90, 0x0b, 0x67, - 0x0e, 0x95, 0x38, 0x73, 0xa0, 0x42, 0x20, 0x71, 0xe2, 0xcf, 0xe0, 0x58, 0x89, 0x0b, 0x47, 0x94, - 0xf0, 0x07, 0xf0, 0x27, 0x20, 0xbf, 0x79, 0xfb, 0xcb, 0xce, 0x66, 0xd6, 0x55, 0x8e, 0x1e, 0xbf, - 0x1f, 0x9f, 0x79, 0x6f, 0xde, 0xf7, 0x69, 0xe1, 0x4a, 0x24, 0x3b, 0x32, 0xe0, 0xd2, 0x57, 0x7e, - 0x24, 0xdb, 0x5d, 0xcd, 0xbf, 0x5e, 0x6d, 0x49, 0x2d, 0x56, 0xf9, 0xe3, 0x81, 0x8c, 0xf6, 0xbd, - 0x30, 0x52, 0x5a, 0xb1, 0x4b, 0x68, 0xe4, 0xa5, 0x46, 0x1e, 0x19, 0xd5, 0x5f, 0xef, 0x28, 0xd5, - 0xe9, 0x49, 0x2e, 0xc2, 0x2e, 0x17, 0x41, 0xa0, 0xb4, 0xd0, 0x5d, 0x15, 0xc4, 0xc6, 0xad, 0x5e, - 0x1a, 0x3b, 0xd6, 0x42, 0x4b, 0x9b, 0x91, 0xde, 0x0f, 0x65, 0x12, 0xe9, 0x1d, 0x5f, 0xc5, 0x7d, - 0x15, 0xf3, 0x96, 0x88, 0xa5, 0x21, 0x4b, 0xcd, 0x42, 0xd1, 0xe9, 0x06, 0x98, 0xd6, 0xd8, 0xba, - 0x17, 0x80, 0x7d, 0x36, 0xb4, 0xd8, 0x16, 0x91, 0xe8, 0xc7, 0x3b, 0xf2, 0xf1, 0x40, 0xc6, 0xda, - 0xfd, 0x14, 0x5e, 0x2d, 0x9c, 0xc6, 0xa1, 0x0a, 0x62, 0xc9, 0x6e, 0xc3, 0x4c, 0x88, 0x27, 0x0b, - 0xce, 0x92, 0xb3, 0x52, 0x5b, 0x5b, 0xf4, 0x4a, 0xae, 0xea, 0x91, 0x23, 0x99, 0xbb, 0x5f, 0x50, - 0xbc, 0x7b, 0x3d, 0x11, 0xc7, 0x32, 0x49, 0xc3, 0xee, 0x03, 0x64, 0x40, 0x14, 0xf3, 0x6d, 0xcf, - 0xd0, 0x7b, 0x43, 0x7a, 0xcf, 0xd4, 0x35, 0x8b, 0xda, 0x91, 0xe4, 0xbb, 0x93, 0xf3, 0x74, 0x7f, - 0x72, 0xe0, 0x42, 0x31, 0x3e, 0x01, 0xdf, 0x81, 0x59, 0xdf, 0x1c, 0x2d, 0x38, 0x4b, 0x2f, 0xac, - 0xd4, 0xd6, 0xdc, 0x52, 0x62, 0x74, 0xdd, 0x0a, 0xf6, 0xd4, 0x4e, 0xe2, 0xc2, 0x3e, 0x2e, 0xe0, - 0x4d, 0x23, 0xde, 0xb2, 0x15, 0xcf, 0xa4, 0x2e, 0xf0, 0xad, 0xc1, 0xc5, 0x0c, 0x0f, 0x73, 0x50, - 0x01, 0x2e, 0xc3, 0x1c, 0x26, 0xdb, 0xed, 0xb6, 0xf1, 0xfa, 0xf3, 0x94, 0x7c, 0xab, 0xed, 0x6e, - 0xc3, 0x6b, 0xa3, 0x3e, 0x74, 0xa9, 0x75, 0x78, 0xb1, 0x1b, 0xec, 0x29, 0xaa, 0x57, 0x95, 0x1b, - 0xa1, 0xbd, 0xbb, 0x4f, 0x45, 0xda, 0x8e, 0xd4, 0x97, 0xd2, 0xd7, 0xb1, 0x1d, 0x62, 0xa4, 0x41, - 0xd3, 0xcf, 0xdd, 0xa0, 0xa7, 0x0e, 0x55, 0x20, 0xcb, 0x4d, 0x97, 0xb9, 0x0b, 0x73, 0x21, 0x9d, - 0x51, 0x8b, 0xde, 0x2a, 0x7f, 0x54, 0xc6, 0x10, 0xaf, 0x94, 0x7a, 0x9d, 0x5d, 0x97, 0x36, 0xe0, - 0x52, 0x9e, 0x31, 0xdf, 0xa7, 0x37, 0x00, 0x28, 0x5f, 0x56, 0xa4, 0x79, 0x3a, 0xd9, 0x6a, 0xbb, - 0x0f, 0x61, 0x61, 0xdc, 0x93, 0x2e, 0xb8, 0x51, 0xe8, 0x56, 0xb5, 0xcb, 0x99, 0x7e, 0x7d, 0x47, - 0x43, 0xb3, 0x29, 0xb4, 0xff, 0x28, 0x1b, 0x9a, 0xd3, 0x59, 0xce, 0xac, 0x65, 0xe9, 0x4c, 0xa5, - 0xe9, 0xb3, 0x99, 0x6a, 0x99, 0x23, 0xeb, 0x4c, 0xa1, 0xab, 0x99, 0x29, 0x72, 0x39, 0xcb, 0x6e, - 0x5d, 0xcc, 0xf0, 0xf2, 0xbd, 0x5a, 0x84, 0x1a, 0x26, 0xdb, 0x6d, 0xcb, 0x40, 0xf5, 0xa9, 0x40, - 0x80, 0x47, 0x1f, 0x0d, 0x4f, 0xd2, 0xc9, 0xca, 0x79, 0x4e, 0x38, 0x59, 0x99, 0xa7, 0xe9, 0xd4, - 0x76, 0xda, 0xa9, 0x9e, 0x08, 0xfc, 0xa4, 0x9c, 0x6c, 0x01, 0x66, 0x85, 0xef, 0xab, 0x41, 0xa0, - 0x93, 0xb9, 0xa2, 0x9f, 0xa3, 0x8c, 0xd3, 0x63, 0x8c, 0x7b, 0x69, 0xf1, 0x29, 0x22, 0x11, 0x2e, - 0xc3, 0x2b, 0x3a, 0x12, 0x6d, 0xd1, 0xea, 0xc9, 0x5d, 0xd1, 0xcf, 0x85, 0x3e, 0x9f, 0x1c, 0x7f, - 0x88, 0xa7, 0xec, 0x2a, 0x9c, 0x8f, 0xa4, 0xee, 0x46, 0xb2, 0x9d, 0xd8, 0x99, 0x24, 0x2f, 0xd3, - 0xa9, 0x31, 0x73, 0x6f, 0x91, 0xfc, 0x3f, 0x18, 0x84, 0x61, 0x6f, 0xbf, 0x72, 0x09, 0x25, 0x5d, - 0x38, 0x71, 0x3b, 0x81, 0x2e, 0xc6, 0xbf, 0x46, 0xe9, 0x8c, 0x43, 0x9e, 0x8e, 0xec, 0x8a, 0x74, - 0xc6, 0xcc, 0xbd, 0x4c, 0x13, 0x79, 0x0f, 0xcb, 0xff, 0x70, 0xb8, 0xe2, 0x92, 0x0d, 0xd5, 0xa2, - 0x91, 0x2b, 0xfc, 0x45, 0x18, 0xf7, 0xe1, 0x9c, 0x69, 0xd8, 0x2e, 0x6e, 0x45, 0x7a, 0xa6, 0x57, - 0xca, 0x85, 0x32, 0x8d, 0xb1, 0x53, 0xf3, 0xb3, 0x78, 0x6b, 0xff, 0x9d, 0x83, 0x97, 0x30, 0x09, - 0x7b, 0xe2, 0xc0, 0x2c, 0xed, 0x16, 0x76, 0xbd, 0x34, 0xce, 0x09, 0x2b, 0xae, 0xde, 0xac, 0x68, - 0x6d, 0xd0, 0xdd, 0x95, 0xef, 0xff, 0xfa, 0xf7, 0xc7, 0x69, 0x97, 0x2d, 0xf1, 0xb2, 0x45, 0x9f, - 0x2c, 0xa7, 0x9f, 0x1d, 0x98, 0x4f, 0x15, 0x9e, 0x79, 0x15, 0xd2, 0xe4, 0x86, 0xa4, 0xce, 0x2b, - 0xdb, 0x13, 0xd8, 0x4d, 0x04, 0x6b, 0xb2, 0x6b, 0x36, 0x30, 0x7e, 0x90, 0x2c, 0x93, 0x43, 0xf6, - 0x9b, 0x03, 0x73, 0x89, 0xe2, 0x33, 0x4b, 0x25, 0x46, 0xb6, 0x52, 0xdd, 0xab, 0x6a, 0x4e, 0x80, - 0x77, 0x10, 0x70, 0x9d, 0xbd, 0x3b, 0x01, 0x20, 0x4f, 0x97, 0xc8, 0xef, 0x0e, 0xd4, 0x72, 0x0a, - 0xcc, 0x6e, 0x54, 0xca, 0x9e, 0xaf, 0xe8, 0xea, 0x04, 0x1e, 0x84, 0xbc, 0x8e, 0xc8, 0x37, 0x98, - 0x57, 0x8a, 0x9c, 0xf0, 0xf1, 0x83, 0x4c, 0xf2, 0x0f, 0xd9, 0xaf, 0x0e, 0xcc, 0x92, 0x2a, 0xdb, - 0x5e, 0x63, 0x71, 0x77, 0xd8, 0x5e, 0xe3, 0x88, 0xd4, 0xbb, 0x1f, 0x20, 0xe0, 0x06, 0x5b, 0x9f, - 0x0c, 0x90, 0x27, 0x62, 0xff, 0x8b, 0x03, 0xf3, 0xa9, 0x56, 0xda, 0xde, 0xe8, 0xa8, 0x90, 0xdb, - 0xde, 0xe8, 0x98, 0x7c, 0x57, 0xa8, 0x27, 0x81, 0xf1, 0x83, 0x9c, 0xbc, 0x1d, 0xb2, 0x3f, 0xb0, - 0x9e, 0x28, 0xb4, 0xf6, 0x7a, 0xe6, 0x15, 0xde, 0x5e, 0xcf, 0x82, 0x7a, 0xbb, 0x9f, 0x20, 0xe0, - 0x26, 0xbb, 0x3b, 0x19, 0x20, 0x6f, 0x99, 0x38, 0xfc, 0x80, 0xf6, 0xc7, 0x21, 0x7b, 0xea, 0xc0, - 0x0c, 0x69, 0xe9, 0xb5, 0xd3, 0x19, 0x0a, 0xca, 0x5e, 0xbf, 0x5e, 0xcd, 0x98, 0x78, 0xdf, 0x47, - 0xde, 0xdb, 0xec, 0xd6, 0x84, 0xbc, 0x46, 0xd3, 0x87, 0x12, 0x55, 0xcb, 0xe9, 0xb3, 0x6d, 0xa8, - 0xc6, 0x55, 0xde, 0x36, 0x54, 0x27, 0x88, 0xbf, 0xdb, 0x44, 0xe6, 0x65, 0x76, 0xb5, 0x5c, 0x07, - 0xf0, 0x67, 0x13, 0x77, 0x03, 0xfb, 0xc1, 0x81, 0x19, 0xf3, 0xb1, 0x62, 0x2b, 0x64, 0xe1, 0x0b, - 0xc9, 0x56, 0xc8, 0xe2, 0x87, 0x93, 0xbb, 0x8c, 0x50, 0x6f, 0xb2, 0xc5, 0xf2, 0x41, 0x42, 0x87, - 0xcd, 0x07, 0x7f, 0x1e, 0x35, 0x9c, 0x67, 0x47, 0x0d, 0xe7, 0x9f, 0xa3, 0x86, 0xf3, 0xe4, 0xb8, - 0x31, 0xf5, 0xec, 0xb8, 0x31, 0xf5, 0xf7, 0x71, 0x63, 0xea, 0xf3, 0xf7, 0x3a, 0x5d, 0xfd, 0x68, - 0xd0, 0xf2, 0x7c, 0xd5, 0x37, 0x41, 0x9a, 0x81, 0xd4, 0xdf, 0xa8, 0xe8, 0x2b, 0xfa, 0xd5, 0x93, - 0xed, 0x8e, 0x8c, 0xf8, 0xb7, 0xe3, 0xb1, 0x5b, 0x33, 0xf8, 0xa9, 0x77, 0xf3, 0xff, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x4e, 0x5b, 0x07, 0x2c, 0xbe, 0x0e, 0x00, 0x00, + // 1086 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0xc7, 0x33, 0x29, 0x24, 0xd9, 0xb7, 0x25, 0x45, 0x43, 0x4b, 0x93, 0x15, 0x6c, 0x82, 0x4b, + 0x49, 0xa0, 0x5d, 0xbb, 0xd9, 0xd2, 0x34, 0x48, 0x05, 0x95, 0x14, 0x15, 0x72, 0x41, 0x61, 0xdb, + 0x13, 0x12, 0x8a, 0x66, 0xbd, 0x93, 0x8d, 0xc1, 0x6b, 0xbb, 0xb6, 0x17, 0x88, 0xc2, 0x72, 0xe0, + 0xcc, 0x21, 0x12, 0x67, 0x0e, 0x54, 0xa8, 0x48, 0x9c, 0x90, 0xf8, 0x27, 0x38, 0x56, 0xe2, 0xc2, + 0x11, 0x25, 0xfc, 0x21, 0x68, 0xdf, 0x3c, 0xff, 0xda, 0xac, 0x6b, 0x2f, 0x5a, 0x71, 0xf4, 0xf8, + 0xfd, 0xf8, 0xbc, 0xf7, 0x66, 0xe6, 0x6b, 0xc3, 0x15, 0x5f, 0x76, 0xa5, 0x63, 0x48, 0xd3, 0x35, + 0x7d, 0xd9, 0xb1, 0x42, 0xe3, 0xcb, 0x8d, 0xb6, 0x0c, 0xc5, 0x86, 0xf1, 0xa8, 0x2f, 0xfd, 0x43, + 0xdd, 0xf3, 0xdd, 0xd0, 0xe5, 0x97, 0xd1, 0x48, 0x8f, 0x8d, 0x74, 0x32, 0xaa, 0xbd, 0xd2, 0x75, + 0xdd, 0xae, 0x2d, 0x0d, 0xe1, 0x59, 0x86, 0x70, 0x1c, 0x37, 0x14, 0xa1, 0xe5, 0x3a, 0x81, 0x72, + 0xab, 0xe5, 0xc6, 0x0e, 0x42, 0x11, 0xca, 0x22, 0xa3, 0xf0, 0xd0, 0x93, 0x51, 0xa4, 0xb7, 0x4c, + 0x37, 0xe8, 0xb9, 0x81, 0xd1, 0x16, 0x81, 0x54, 0x64, 0xb1, 0x99, 0x27, 0xba, 0x96, 0x83, 0x69, + 0x95, 0xad, 0x76, 0x11, 0xf8, 0x27, 0x43, 0x8b, 0x5d, 0xe1, 0x8b, 0x5e, 0xd0, 0x92, 0x8f, 0xfa, + 0x32, 0x08, 0xb5, 0x8f, 0xe1, 0xa5, 0xcc, 0x6a, 0xe0, 0xb9, 0x4e, 0x20, 0xf9, 0x6d, 0x98, 0xf3, + 0x70, 0x65, 0x89, 0xad, 0xb2, 0xf5, 0x6a, 0x73, 0x45, 0xcf, 0x29, 0x55, 0x27, 0x47, 0x32, 0xd7, + 0x3e, 0xa3, 0x78, 0xf7, 0x6c, 0x11, 0x04, 0x32, 0x4a, 0xc3, 0xef, 0x03, 0x24, 0x40, 0x14, 0xf3, + 0x0d, 0x5d, 0xd1, 0xeb, 0x43, 0x7a, 0x5d, 0xf5, 0x35, 0x89, 0xda, 0x95, 0xe4, 0xdb, 0x4a, 0x79, + 0x6a, 0x3f, 0x32, 0xb8, 0x98, 0x8d, 0x4f, 0xc0, 0x77, 0x60, 0xde, 0x54, 0x4b, 0x4b, 0x6c, 0xf5, + 0xdc, 0x7a, 0xb5, 0xa9, 0xe5, 0x12, 0xa3, 0xeb, 0x8e, 0xb3, 0xef, 0xb6, 0x22, 0x17, 0xfe, 0x61, + 0x06, 0x6f, 0x16, 0xf1, 0xd6, 0x0a, 0xf1, 0x54, 0xea, 0x0c, 0x5f, 0x13, 0x2e, 0x25, 0x78, 0x98, + 0x83, 0x1a, 0xb0, 0x0c, 0x0b, 0x98, 0x6c, 0xcf, 0xea, 0x60, 0xf9, 0x15, 0x4a, 0xbe, 0xd3, 0xd1, + 0x76, 0xe1, 0xe5, 0x51, 0x1f, 0x2a, 0x6a, 0x13, 0x9e, 0xb3, 0x9c, 0x7d, 0x97, 0xfa, 0x55, 0xa6, + 0x22, 0xb4, 0xd7, 0x06, 0xb0, 0x94, 0x8a, 0x18, 0x04, 0x7d, 0xe9, 0x07, 0xc5, 0x20, 0x23, 0x43, + 0x9a, 0xfd, 0xcf, 0x43, 0xfa, 0x16, 0x96, 0xc7, 0xa4, 0xa7, 0x9a, 0x96, 0x60, 0xde, 0x52, 0x4b, + 0x38, 0xa8, 0x4a, 0x2b, 0x7a, 0x9c, 0xde, 0x10, 0x0e, 0x69, 0x8f, 0xec, 0xfa, 0xee, 0xe7, 0xd2, + 0x0c, 0xff, 0xcf, 0xd2, 0x1f, 0x33, 0xda, 0x00, 0x49, 0x6e, 0xaa, 0xfb, 0x2e, 0x2c, 0x78, 0xb4, + 0x46, 0x3b, 0xf4, 0xf5, 0xfc, 0x33, 0xa5, 0x0c, 0x71, 0xa2, 0xb1, 0xd7, 0xf4, 0xfa, 0xb3, 0x05, + 0x97, 0xd3, 0x8c, 0xe9, 0x6d, 0xfa, 0x2a, 0x00, 0xe5, 0x4b, 0x9a, 0x54, 0xa1, 0x95, 0x9d, 0x8e, + 0xf6, 0x90, 0x36, 0x56, 0xc6, 0x93, 0x0a, 0xdc, 0xca, 0x6c, 0xd6, 0x72, 0xc5, 0xa9, 0xed, 0xfa, + 0x0d, 0xdd, 0x19, 0xdb, 0x22, 0x34, 0x0f, 0x92, 0x3b, 0xe3, 0xd9, 0x2c, 0x53, 0x1b, 0x59, 0x7c, + 0xa5, 0xc4, 0xe9, 0x93, 0x2b, 0xa5, 0xad, 0x96, 0x0a, 0xaf, 0x14, 0x74, 0x55, 0x57, 0x0a, 0xb9, + 0x4c, 0x73, 0x5a, 0x97, 0x12, 0xbc, 0xf4, 0xac, 0x56, 0xa0, 0x8a, 0xc9, 0xf6, 0x3a, 0xd2, 0x71, + 0x7b, 0xd4, 0x20, 0xc0, 0xa5, 0x0f, 0x86, 0x2b, 0xf1, 0xc5, 0x92, 0xf2, 0x9c, 0xf0, 0x62, 0x49, + 0x3c, 0xd5, 0xa4, 0x76, 0xe3, 0x49, 0xd9, 0xc2, 0x31, 0xa3, 0x76, 0x0e, 0xcf, 0xb4, 0x30, 0x4d, + 0xb7, 0xef, 0x84, 0xd1, 0xb9, 0xa2, 0xc7, 0x51, 0xc6, 0xd9, 0x33, 0x8c, 0xfb, 0x71, 0xf3, 0x29, + 0x22, 0x11, 0xae, 0xc1, 0x85, 0xd0, 0x17, 0x1d, 0xd1, 0xb6, 0xe5, 0x9e, 0xe8, 0xa5, 0x42, 0x2f, + 0x46, 0xcb, 0xef, 0xe3, 0x2a, 0xbf, 0x0a, 0x8b, 0xbe, 0x0c, 0x2d, 0x5f, 0x76, 0x22, 0x3b, 0x95, + 0xe4, 0x05, 0x5a, 0x55, 0x66, 0xda, 0x2d, 0x52, 0xbf, 0x07, 0x7d, 0xcf, 0xb3, 0x0f, 0x4b, 0xb7, + 0xf0, 0x98, 0x51, 0xc5, 0x91, 0xdf, 0x18, 0xbc, 0x00, 0x5f, 0x8d, 0xe2, 0x29, 0x87, 0x34, 0x1e, + 0xd9, 0x65, 0xf1, 0xc8, 0xec, 0x4d, 0x78, 0xd1, 0x1c, 0xd6, 0x6f, 0xdb, 0x49, 0x1d, 0xe7, 0xd0, + 0xf0, 0x42, 0xbc, 0x4e, 0x95, 0x2c, 0xd3, 0xe9, 0xbd, 0x87, 0xa3, 0x7a, 0x38, 0xfc, 0x1a, 0x88, + 0xc4, 0xbc, 0x1d, 0xdd, 0xfb, 0xe9, 0x57, 0x44, 0x7c, 0x1f, 0xce, 0xab, 0xe1, 0xee, 0xe1, 0x07, + 0x04, 0x6d, 0xe9, 0x2b, 0xf9, 0x9a, 0x12, 0xc7, 0x68, 0x55, 0xcd, 0x24, 0x5e, 0xf3, 0xc9, 0x22, + 0x3c, 0x8f, 0x49, 0xf8, 0x31, 0x83, 0x79, 0x92, 0x61, 0x7e, 0x3d, 0x37, 0xce, 0x98, 0xaf, 0x81, + 0x5a, 0xa3, 0xa4, 0xb5, 0x42, 0xd7, 0xd6, 0xbf, 0xfb, 0xf3, 0x9f, 0x1f, 0x66, 0x35, 0xbe, 0x6a, + 0xe4, 0x7d, 0x13, 0x45, 0x3a, 0xfe, 0x13, 0x83, 0x4a, 0x2c, 0x86, 0x5c, 0x2f, 0x91, 0x26, 0x75, + 0xa0, 0x6a, 0x46, 0x69, 0x7b, 0x02, 0xbb, 0x89, 0x60, 0x0d, 0x7e, 0xad, 0x08, 0xcc, 0x38, 0x8a, + 0x84, 0x67, 0xc0, 0x7f, 0x67, 0x70, 0x3e, 0xad, 0x8c, 0x7c, 0xa3, 0x4c, 0xda, 0x8c, 0x88, 0xd7, + 0x9a, 0x93, 0xb8, 0x10, 0xec, 0x1d, 0x84, 0xdd, 0xe4, 0x6f, 0x8f, 0x81, 0x15, 0xb6, 0x77, 0x20, + 0x9a, 0x63, 0x68, 0x8d, 0x48, 0x9c, 0x7f, 0x61, 0xb0, 0x10, 0x69, 0x1a, 0x2f, 0x98, 0xdf, 0x88, + 0xee, 0xd6, 0xf4, 0xb2, 0xe6, 0x25, 0x48, 0xf3, 0xda, 0x6a, 0xc4, 0x32, 0xf9, 0x2b, 0x83, 0x6a, + 0x4a, 0x63, 0xf8, 0x8d, 0x52, 0xd9, 0xd3, 0xfb, 0x60, 0x63, 0x02, 0x0f, 0x42, 0xde, 0x44, 0xe4, + 0x1b, 0x5c, 0xcf, 0x45, 0x8e, 0xf8, 0x8c, 0xa3, 0x44, 0xd4, 0x06, 0xfc, 0x09, 0x83, 0x79, 0xd2, + 0x9d, 0xa2, 0x33, 0x94, 0x55, 0xc7, 0xa2, 0x33, 0x34, 0x22, 0x66, 0xda, 0x7b, 0x08, 0xb8, 0xc5, + 0x37, 0x27, 0x03, 0x34, 0x22, 0x39, 0xfb, 0x99, 0x41, 0x25, 0x56, 0x83, 0xa2, 0x93, 0x35, 0x2a, + 0x55, 0x45, 0x27, 0xeb, 0x8c, 0x40, 0x95, 0xe8, 0x27, 0x81, 0x19, 0x47, 0xa9, 0x0b, 0x7c, 0xc0, + 0x7f, 0xc3, 0x7e, 0xa2, 0x94, 0x14, 0xf7, 0x33, 0xad, 0x61, 0xc5, 0xfd, 0xcc, 0xe8, 0x93, 0xf6, + 0x11, 0x02, 0x6e, 0xf3, 0xbb, 0x93, 0x01, 0x1a, 0x6d, 0x15, 0xc7, 0x38, 0x22, 0x85, 0x1c, 0xf0, + 0xc7, 0x0c, 0xe6, 0x48, 0x05, 0xae, 0x3d, 0x9b, 0x21, 0xa3, 0x5d, 0xb5, 0xeb, 0xe5, 0x8c, 0x89, + 0xf7, 0x5d, 0xe4, 0xbd, 0xcd, 0x6f, 0x4d, 0xc8, 0xab, 0x44, 0x6b, 0x78, 0xb1, 0x56, 0x53, 0xaa, + 0x52, 0x74, 0xa8, 0xce, 0x6a, 0x53, 0xd1, 0xa1, 0x1a, 0x23, 0x59, 0x5a, 0x03, 0x99, 0xd7, 0xf8, + 0xd5, 0xfc, 0x7b, 0x00, 0x1f, 0x1b, 0xa8, 0x68, 0xfc, 0x7b, 0x06, 0x73, 0xea, 0x6f, 0xb4, 0xa8, + 0x91, 0x99, 0x5f, 0xe0, 0xa2, 0x46, 0x66, 0xff, 0x8c, 0xb5, 0x35, 0x84, 0x7a, 0x8d, 0xaf, 0xe4, + 0x1f, 0x24, 0x74, 0xd8, 0x7e, 0xf0, 0xc7, 0x49, 0x9d, 0x3d, 0x3d, 0xa9, 0xb3, 0xbf, 0x4f, 0xea, + 0xec, 0xf8, 0xb4, 0x3e, 0xf3, 0xf4, 0xb4, 0x3e, 0xf3, 0xd7, 0x69, 0x7d, 0xe6, 0xd3, 0x77, 0xba, + 0x56, 0x78, 0xd0, 0x6f, 0xeb, 0xa6, 0xdb, 0x53, 0x41, 0x1a, 0x8e, 0x0c, 0xbf, 0x72, 0xfd, 0x2f, + 0xe8, 0xc9, 0x96, 0x9d, 0xae, 0xf4, 0x8d, 0xaf, 0xcf, 0xc6, 0x6e, 0xcf, 0xe1, 0xbf, 0xfc, 0xcd, + 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xc1, 0xce, 0x32, 0x9f, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1115,6 +1242,8 @@ type QueryClient interface { Classes(ctx context.Context, in *QueryClassesRequest, opts ...grpc.CallOption) (*QueryClassesResponse, error) // ClassInfo queries for information on a credit class. ClassInfo(ctx context.Context, in *QueryClassInfoRequest, opts ...grpc.CallOption) (*QueryClassInfoResponse, error) + // ClassIssuers queries for the addresses of the issuers for a credit class. + ClassIssuers(ctx context.Context, in *QueryClassIssuersRequest, opts ...grpc.CallOption) (*QueryClassIssuersResponse, error) // Projects queries for all projects within a class with pagination. Projects(ctx context.Context, in *QueryProjectsRequest, opts ...grpc.CallOption) (*QueryProjectsResponse, error) // ClassInfo queries for information on a project. @@ -1161,6 +1290,15 @@ func (c *queryClient) ClassInfo(ctx context.Context, in *QueryClassInfoRequest, return out, nil } +func (c *queryClient) ClassIssuers(ctx context.Context, in *QueryClassIssuersRequest, opts ...grpc.CallOption) (*QueryClassIssuersResponse, error) { + out := new(QueryClassIssuersResponse) + err := c.cc.Invoke(ctx, "/regen.ecocredit.v1beta1.Query/ClassIssuers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) Projects(ctx context.Context, in *QueryProjectsRequest, opts ...grpc.CallOption) (*QueryProjectsResponse, error) { out := new(QueryProjectsResponse) err := c.cc.Invoke(ctx, "/regen.ecocredit.v1beta1.Query/Projects", in, out, opts...) @@ -1239,6 +1377,8 @@ type QueryServer interface { Classes(context.Context, *QueryClassesRequest) (*QueryClassesResponse, error) // ClassInfo queries for information on a credit class. ClassInfo(context.Context, *QueryClassInfoRequest) (*QueryClassInfoResponse, error) + // ClassIssuers queries for the addresses of the issuers for a credit class. + ClassIssuers(context.Context, *QueryClassIssuersRequest) (*QueryClassIssuersResponse, error) // Projects queries for all projects within a class with pagination. Projects(context.Context, *QueryProjectsRequest) (*QueryProjectsResponse, error) // ClassInfo queries for information on a project. @@ -1269,6 +1409,9 @@ func (*UnimplementedQueryServer) Classes(ctx context.Context, req *QueryClassesR func (*UnimplementedQueryServer) ClassInfo(ctx context.Context, req *QueryClassInfoRequest) (*QueryClassInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClassInfo not implemented") } +func (*UnimplementedQueryServer) ClassIssuers(ctx context.Context, req *QueryClassIssuersRequest) (*QueryClassIssuersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClassIssuers not implemented") +} func (*UnimplementedQueryServer) Projects(ctx context.Context, req *QueryProjectsRequest) (*QueryProjectsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Projects not implemented") } @@ -1334,6 +1477,24 @@ func _Query_ClassInfo_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Query_ClassIssuers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryClassIssuersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ClassIssuers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/regen.ecocredit.v1beta1.Query/ClassIssuers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ClassIssuers(ctx, req.(*QueryClassIssuersRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_Projects_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryProjectsRequest) if err := dec(in); err != nil { @@ -1490,6 +1651,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ClassInfo", Handler: _Query_ClassInfo_Handler, }, + { + MethodName: "ClassIssuers", + Handler: _Query_ClassIssuers_Handler, + }, { MethodName: "Projects", Handler: _Query_Projects_Handler, @@ -1734,6 +1899,92 @@ func (m *QueryClassInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *QueryClassIssuersRequest) 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 *QueryClassIssuersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryClassIssuersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryClassIssuersResponse) 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 *QueryClassIssuersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryClassIssuersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Issuers) > 0 { + for iNdEx := len(m.Issuers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Issuers[iNdEx]) + copy(dAtA[i:], m.Issuers[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Issuers[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *QueryProjectsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2170,6 +2421,13 @@ func (m *QuerySupplyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.CancelledAmount) > 0 { + i -= len(m.CancelledAmount) + copy(dAtA[i:], m.CancelledAmount) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CancelledAmount))) + i-- + dAtA[i] = 0x1a + } if len(m.RetiredSupply) > 0 { i -= len(m.RetiredSupply) copy(dAtA[i:], m.RetiredSupply) @@ -2338,6 +2596,42 @@ func (m *QueryClassInfoResponse) Size() (n int) { return n } +func (m *QueryClassIssuersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryClassIssuersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Issuers) > 0 { + for _, s := range m.Issuers { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryProjectsRequest) Size() (n int) { if m == nil { return 0 @@ -2523,6 +2817,10 @@ func (m *QuerySupplyResponse) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } + l = len(m.CancelledAmount) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -3084,6 +3382,248 @@ func (m *QueryClassInfoResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryClassIssuersRequest) 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 ErrIntOverflowQuery + } + 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: QueryClassIssuersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryClassIssuersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryClassIssuersResponse) 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 ErrIntOverflowQuery + } + 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: QueryClassIssuersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryClassIssuersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Issuers", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Issuers = append(m.Issuers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryProjectsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4332,6 +4872,38 @@ func (m *QuerySupplyResponse) Unmarshal(dAtA []byte) error { } m.RetiredSupply = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CancelledAmount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CancelledAmount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/ecocredit/v1beta1/query.pb.gw.go b/x/ecocredit/v1beta1/query.pb.gw.go index 70288317e7..fd446c0ecd 100644 --- a/x/ecocredit/v1beta1/query.pb.gw.go +++ b/x/ecocredit/v1beta1/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join var ( filter_Query_Classes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} @@ -121,6 +123,78 @@ func local_request_Query_ClassInfo_0(ctx context.Context, marshaler runtime.Mars } +var ( + filter_Query_ClassIssuers_0 = &utilities.DoubleArray{Encoding: map[string]int{"class_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_ClassIssuers_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassIssuersRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ClassIssuers_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ClassIssuers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ClassIssuers_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryClassIssuersRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ClassIssuers_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ClassIssuers(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_Projects_0 = &utilities.DoubleArray{Encoding: map[string]int{"class_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -542,12 +616,14 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Classes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -555,6 +631,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Classes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -568,6 +645,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ClassInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -575,6 +654,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ClassInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -585,9 +665,34 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_ClassIssuers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ClassIssuers_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ClassIssuers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Projects_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -595,6 +700,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Projects_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -608,6 +714,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ProjectInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -615,6 +723,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ProjectInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -628,6 +737,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Batches_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -635,6 +746,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Batches_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -648,6 +760,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_BatchInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -655,6 +769,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_BatchInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -668,6 +783,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Balance_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -675,6 +792,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Balance_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -688,6 +806,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Supply_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -695,6 +815,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Supply_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -708,6 +829,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_CreditTypes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -715,6 +838,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_CreditTypes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -728,6 +852,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -735,6 +861,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -826,6 +953,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_ClassIssuers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ClassIssuers_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ClassIssuers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Projects_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -994,6 +1141,8 @@ var ( pattern_Query_ClassInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"regen", "ecocredit", "v1beta1", "classes", "class_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ClassIssuers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"regen", "ecocredit", "v1alpha2", "classes", "class_id", "issuers"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Projects_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"regen", "ecocredit", "v1beta1", "classes", "class_id", "projects"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ProjectInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"regen", "ecocredit", "v1beta1", "projects", "project_id"}, "", runtime.AssumeColonVerbOpt(false))) @@ -1016,6 +1165,8 @@ var ( forward_Query_ClassInfo_0 = runtime.ForwardResponseMessage + forward_Query_ClassIssuers_0 = runtime.ForwardResponseMessage + forward_Query_Projects_0 = runtime.ForwardResponseMessage forward_Query_ProjectInfo_0 = runtime.ForwardResponseMessage diff --git a/x/group/query.pb.gw.go b/x/group/query.pb.gw.go index 3f884b0b26..0ddb983760 100644 --- a/x/group/query.pb.gw.go +++ b/x/group/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_GroupInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryGroupInfoRequest @@ -776,12 +778,14 @@ func local_request_Query_VotesByVoter_0(ctx context.Context, marshaler runtime.M // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_GroupInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -789,6 +793,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GroupInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -802,6 +807,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GroupAccountInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -809,6 +816,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GroupAccountInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -822,6 +830,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GroupMembers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -829,6 +839,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GroupMembers_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -842,6 +853,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GroupsByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -849,6 +862,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GroupsByAdmin_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -862,6 +876,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GroupAccountsByGroup_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -869,6 +885,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GroupAccountsByGroup_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -882,6 +899,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_GroupAccountsByAdmin_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -889,6 +908,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_GroupAccountsByAdmin_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -902,6 +922,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -909,6 +931,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -922,6 +945,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ProposalsByGroupAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -929,6 +954,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ProposalsByGroupAccount_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -942,6 +968,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_VoteByProposalVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -949,6 +977,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_VoteByProposalVoter_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -962,6 +991,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_VotesByProposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -969,6 +1000,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_VotesByProposal_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -982,6 +1014,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_VotesByVoter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -989,6 +1023,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_VotesByVoter_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) From 772e109c79c2db131882c8e55d5751883a5f243e Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:43:39 -0800 Subject: [PATCH 02/31] chore: reduce FormatClassID function --- x/ecocredit/denom.go | 4 ++-- x/ecocredit/server/core/denom.go | 16 ---------------- x/ecocredit/server/core/msg_server.go | 2 +- 3 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 x/ecocredit/server/core/denom.go diff --git a/x/ecocredit/denom.go b/x/ecocredit/denom.go index 2f64e93952..4625322417 100644 --- a/x/ecocredit/denom.go +++ b/x/ecocredit/denom.go @@ -13,8 +13,8 @@ import ( // // The initial version has format: // -func FormatClassID(creditType CreditType, classSeqNo uint64) string { - return fmt.Sprintf("%s%02d", creditType.Abbreviation, classSeqNo) +func FormatClassID(creditTypeAbbreviation string, classSeqNo uint64) string { + return fmt.Sprintf("%s%02d", creditTypeAbbreviation, classSeqNo) } // FormatDenom formats the denomination to use for a batch, based on the batch diff --git a/x/ecocredit/server/core/denom.go b/x/ecocredit/server/core/denom.go deleted file mode 100644 index 2886f4c202..0000000000 --- a/x/ecocredit/server/core/denom.go +++ /dev/null @@ -1,16 +0,0 @@ -package core - -import ( - "fmt" - "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" -) - -// FormatClassID formats the ID to use for a new credit class, based on the credit type and -// sequence number. This format may evolve over time, but will maintain -// backwards compatibility. -// -// The initial version has format: -// -func FormatClassID(creditType v1beta1.CreditType, classSeqNo uint64) string { - return fmt.Sprintf("%s%02d", creditType.Abbreviation, classSeqNo) -} diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index cc42ba225a..de095a62ea 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -59,7 +59,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass if err != nil { return nil, fmt.Errorf("error getting class sequence") } - classID := FormatClassID(creditType, classSeq) + classID := ecocredit.FormatClassID(creditType.Abbreviation, classSeq) // TODO(Tyler): waiting for PR that should make this should return the row ID, should include in event and response. _, err = s.classInfoStore.InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ From 534f46bab98c411285a976830d0f9e4581e41bcf Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:53:14 -0800 Subject: [PATCH 03/31] chore: reduce to single state store instance --- x/ecocredit/server/core/msg_server.go | 89 ++++++++++++------------- x/ecocredit/server/core/query_server.go | 36 +++++----- x/ecocredit/server/core/server.go | 30 ++------- 3 files changed, 67 insertions(+), 88 deletions(-) diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index de095a62ea..0b1a8b5bf2 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -45,11 +45,6 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass return nil, err } - //creditType, err := s.creditTypeStore.GetByName(ctx, req.CreditTypeName) - //if err != nil { - // return nil, err - //} - creditType, err := s.getCreditType(sdkCtx, req.CreditTypeName) if err != nil { return nil, err @@ -62,7 +57,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass classID := ecocredit.FormatClassID(creditType.Abbreviation, classSeq) // TODO(Tyler): waiting for PR that should make this should return the row ID, should include in event and response. - _, err = s.classInfoStore.InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ + _, err = s.stateStore.ClassInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ Name: classID, Admin: req.Admin, Metadata: req.Metadata, @@ -73,7 +68,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } for _, issuer := range req.Issuers { - if err = s.classIssuerStore.Insert(ctx, &ecocreditv1beta1.ClassIssuer{ + if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ ClassId: classID, Issuer: issuer, }); err != nil { @@ -96,7 +91,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreateProject) (*v1beta1.MsgCreateProjectResponse, error) { sdkCtx := types.UnwrapSDKContext(ctx) classID := req.ClassId - classInfo, err := s.classInfoStore.GetByName(ctx, classID) + classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, classID) if err != nil { return nil, err } @@ -114,7 +109,7 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro if err != nil { return nil, err } - found, err = s.projectInfoStore.HasByClassIdName(ctx, classInfo.Id, projectID) + found, err = s.stateStore.ProjectInfoStore().HasByClassIdName(ctx, classInfo.Id, projectID) if err != nil { return nil, err } @@ -123,7 +118,7 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro } // TODO(Tyler): update this to handle the id it returns and put it in event and response. - _, err = s.projectInfoStore.InsertReturningID(ctx, &ecocreditv1beta1.ProjectInfo{ + _, err = s.stateStore.ProjectInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ProjectInfo{ Name: projectID, ClassId: classInfo.Id, ProjectLocation: req.ProjectLocation, @@ -154,12 +149,12 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch sdkCtx := sdk.UnwrapSDKContext(ctx) projectID := req.ProjectId - projectInfo, err := s.projectInfoStore.GetByName(ctx, projectID) + projectInfo, err := s.stateStore.ProjectInfoStore().GetByName(ctx, projectID) if err != nil { return nil, err } - classInfo, err := s.classInfoStore.Get(ctx, projectInfo.ClassId) + classInfo, err := s.stateStore.ClassInfoStore().Get(ctx, projectInfo.ClassId) if err != nil { return nil, err } @@ -187,7 +182,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch } // TODO(Tyler): this should return the ID. we need to use it. wait for update. - id, err := s.batchInfoStore.InsertReturningID(ctx, &ecocreditv1beta1.BatchInfo{ + id, err := s.stateStore.BatchInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.BatchInfo{ ProjectId: projectInfo.Id, BatchDenom: batchDenom, Metadata: req.Metadata, @@ -229,7 +224,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch return nil, err } } - if err = s.batchBalanceStore.Insert(ctx, &ecocreditv1beta1.BatchBalance{ + if err = s.stateStore.BatchBalanceStore().Insert(ctx, &ecocreditv1beta1.BatchBalance{ Address: recipient, BatchId: newBatchID, Tradable: tradable.String(), @@ -250,7 +245,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch regenCtx.GasMeter().ConsumeGas(gasCostPerIteration, "batch issuance") } - if err = s.batchSupplyStore.Insert(ctx, &ecocreditv1beta1.BatchSupply{ + if err = s.stateStore.BatchSupplyStore().Insert(ctx, &ecocreditv1beta1.BatchSupply{ BatchId: newBatchID, TradableAmount: tradableSupply.String(), RetiredAmount: retiredSupply.String(), @@ -296,7 +291,7 @@ func (s serverImpl) Retire(ctx context.Context, req *v1beta1.MsgRetire) (*v1beta holder, _ := sdk.AccAddressFromBech32(req.Holder) for _, credit := range req.Credits { - batch, err := s.batchInfoStore.GetByBatchDenom(ctx, credit.BatchDenom) + batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) if err != nil { return nil, err } @@ -304,7 +299,7 @@ func (s serverImpl) Retire(ctx context.Context, req *v1beta1.MsgRetire) (*v1beta if err != nil { return nil, err } - userBalance, err := s.batchBalanceStore.Get(ctx, holder, batch.Id) + userBalance, err := s.stateStore.BatchBalanceStore().Get(ctx, holder, batch.Id) if err != nil { return nil, err } @@ -330,7 +325,7 @@ func (s serverImpl) Retire(ctx context.Context, req *v1beta1.MsgRetire) (*v1beta if err != nil { return nil, err } - batchSupply, err := s.batchSupplyStore.Get(ctx, batch.Id) + batchSupply, err := s.stateStore.BatchSupplyStore().Get(ctx, batch.Id) if err != nil { return nil, err } @@ -348,7 +343,7 @@ func (s serverImpl) Retire(ctx context.Context, req *v1beta1.MsgRetire) (*v1beta return nil, err } - if err = s.batchBalanceStore.Update(ctx, &ecocreditv1beta1.BatchBalance{ + if err = s.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ Address: holder, BatchId: batch.Id, Tradable: userTradableBalance.String(), @@ -356,7 +351,7 @@ func (s serverImpl) Retire(ctx context.Context, req *v1beta1.MsgRetire) (*v1beta }); err != nil { return nil, err } - err = s.batchSupplyStore.Update(ctx, &ecocreditv1beta1.BatchSupply{ + err = s.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ BatchId: batch.Id, TradableAmount: supplyTradable.String(), RetiredAmount: supplyRetired.String(), @@ -381,7 +376,7 @@ func (s serverImpl) Cancel(ctx context.Context, req *v1beta1.MsgCancel) (*v1beta holder, _ := sdk.AccAddressFromBech32(req.Holder) for _, credit := range req.Credits { - batch, err := s.batchInfoStore.GetByBatchDenom(ctx, credit.BatchDenom) + batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) if err != nil { return nil, err @@ -392,11 +387,11 @@ func (s serverImpl) Cancel(ctx context.Context, req *v1beta1.MsgCancel) (*v1beta } precision := creditType.Precision - userBalance, err := s.batchBalanceStore.Get(ctx, holder, batch.Id) + userBalance, err := s.stateStore.BatchBalanceStore().Get(ctx, holder, batch.Id) if err != nil { return nil, err } - batchSupply, err := s.batchSupplyStore.Get(ctx, batch.Id) + batchSupply, err := s.stateStore.BatchSupplyStore().Get(ctx, batch.Id) if err != nil { return nil, err } @@ -417,7 +412,7 @@ func (s serverImpl) Cancel(ctx context.Context, req *v1beta1.MsgCancel) (*v1beta if err != nil { return nil, err } - if err = s.batchBalanceStore.Update(ctx, &ecocreditv1beta1.BatchBalance{ + if err = s.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ Address: holder, BatchId: batch.Id, Tradable: userBalTradable.String(), @@ -425,7 +420,7 @@ func (s serverImpl) Cancel(ctx context.Context, req *v1beta1.MsgCancel) (*v1beta }); err != nil { return nil, err } - if err = s.batchSupplyStore.Update(ctx, &ecocreditv1beta1.BatchSupply{ + if err = s.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ BatchId: batch.Id, TradableAmount: supplyTradable.String(), RetiredAmount: batchSupply.RetiredAmount, @@ -446,7 +441,7 @@ func (s serverImpl) Cancel(ctx context.Context, req *v1beta1.MsgCancel) (*v1beta } func (s serverImpl) UpdateClassAdmin(ctx context.Context, req *v1beta1.MsgUpdateClassAdmin) (*v1beta1.MsgUpdateClassAdminResponse, error) { - classInfo, err := s.classInfoStore.GetByName(ctx, req.ClassId) + classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) if err != nil { return nil, err } @@ -454,14 +449,14 @@ func (s serverImpl) UpdateClassAdmin(ctx context.Context, req *v1beta1.MsgUpdate return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) } classInfo.Admin = req.NewAdmin - if err = s.classInfoStore.Update(ctx, classInfo); err != nil { + if err = s.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { return nil, err } return &v1beta1.MsgUpdateClassAdminResponse{}, err } func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpdateClassIssuers) (*v1beta1.MsgUpdateClassIssuersResponse, error) { - class, err := s.classInfoStore.GetByName(ctx, req.ClassId) + class, err := s.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) if err != nil { return nil, err } @@ -470,13 +465,13 @@ func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpda } // delete the old issuers - if err = s.classIssuerStore.DeleteBy(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(class.Name)); err != nil { + if err = s.stateStore.ClassIssuerStore().DeleteBy(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(class.Name)); err != nil { return nil, err } // add the new issuers for _, issuer := range req.Issuers { - if err = s.classIssuerStore.Insert(ctx, &ecocreditv1beta1.ClassIssuer{ + if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ ClassId: req.ClassId, Issuer: issuer, }); err != nil { @@ -487,7 +482,7 @@ func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpda } func (s serverImpl) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpdateClassMetadata) (*v1beta1.MsgUpdateClassMetadataResponse, error) { - classInfo, err := s.classInfoStore.GetByName(ctx, req.ClassId) + classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) if err != nil { return nil, err } @@ -495,7 +490,7 @@ func (s serverImpl) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpd return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) } classInfo.Metadata = req.Metadata - if err = s.classInfoStore.Update(ctx, classInfo); err != nil { + if err = s.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { return nil, err } return &v1beta1.MsgUpdateClassMetadataResponse{}, err @@ -925,7 +920,7 @@ func (s serverImpl) isCreatorAllowListed(ctx types.Context, allowlist []string, // AssertClassIssuer makes sure that the issuer is part of issuers of given classID. // Returns ErrUnauthorized otherwise. func (s serverImpl) assertClassIssuer(goCtx context.Context, classID, issuer string) error { - it, err := s.classIssuerStore.List(goCtx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classID)) + it, err := s.stateStore.ClassIssuerStore().List(goCtx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classID)) if err != nil { return err } @@ -945,7 +940,7 @@ func (s serverImpl) assertClassIssuer(goCtx context.Context, classID, issuer str func (s serverImpl) genProjectID(ctx context.Context, classRowID uint64, classID string) (string, error) { var nextID uint64 - projectSeqNo, err := s.projectSeqStore.Get(ctx, classRowID) + projectSeqNo, err := s.stateStore.ProjectSequenceStore().Get(ctx, classRowID) switch err { case ormerrors.NotFound: nextID = 1 @@ -955,7 +950,7 @@ func (s serverImpl) genProjectID(ctx context.Context, classRowID uint64, classID return "", err } - if err = s.projectSeqStore.Save(ctx, &ecocreditv1beta1.ProjectSequence{ + if err = s.stateStore.ProjectSequenceStore().Save(ctx, &ecocreditv1beta1.ProjectSequence{ ClassId: classRowID, NextProjectId: nextID + 1, }); err != nil { @@ -967,7 +962,7 @@ func (s serverImpl) genProjectID(ctx context.Context, classRowID uint64, classID func (s serverImpl) getBatchSeqNo(ctx context.Context, projectID string) (uint64, error) { var seq uint64 - batchSeq, err := s.batchSeqStore.Get(ctx, projectID) + batchSeq, err := s.stateStore.BatchSequenceStore().Get(ctx, projectID) switch err { case ormerrors.NotFound: @@ -977,7 +972,7 @@ func (s serverImpl) getBatchSeqNo(ctx context.Context, projectID string) (uint64 default: return 0, err } - if err = s.batchSeqStore.Save(ctx, &ecocreditv1beta1.BatchSequence{ + if err = s.stateStore.BatchSequenceStore().Save(ctx, &ecocreditv1beta1.BatchSequence{ ProjectId: projectID, NextBatchId: seq + 1, }); err != nil { @@ -988,7 +983,7 @@ func (s serverImpl) getBatchSeqNo(ctx context.Context, projectID string) (uint64 } func (s serverImpl) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_SendCredits, to, from sdk.AccAddress) error { - batch, err := s.batchInfoStore.GetByBatchDenom(ctx, credit.BatchDenom) + batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) if err != nil { return err } @@ -998,11 +993,11 @@ func (s serverImpl) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_ } precision := creditType.Precision - batchSupply, err := s.batchSupplyStore.Get(ctx, batch.Id) + batchSupply, err := s.stateStore.BatchSupplyStore().Get(ctx, batch.Id) if err != nil { return err } - fromBalance, err := s.batchBalanceStore.Get(ctx, from, batch.Id) + fromBalance, err := s.stateStore.BatchBalanceStore().Get(ctx, from, batch.Id) if err != nil { if err == ormerrors.NotFound { return ecocredit.ErrInsufficientFunds.Wrapf("you do not have any credits from batch %s", batch.BatchDenom) @@ -1010,7 +1005,7 @@ func (s serverImpl) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_ return err } - toBalance, err := s.batchBalanceStore.Get(ctx, to, batch.Id) + toBalance, err := s.stateStore.BatchBalanceStore().Get(ctx, to, batch.Id) if err != nil { if err == ormerrors.NotFound { toBalance = &ecocreditv1beta1.BatchBalance{ @@ -1064,7 +1059,7 @@ func (s serverImpl) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_ } } // update the "to" balance - if err := s.batchBalanceStore.Save(ctx, &ecocreditv1beta1.BatchBalance{ + if err := s.stateStore.BatchBalanceStore().Save(ctx, &ecocreditv1beta1.BatchBalance{ Address: to, BatchId: batch.Id, Tradable: toTradableBalance.String(), @@ -1074,7 +1069,7 @@ func (s serverImpl) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_ } // update the "from" balance - if err := s.batchBalanceStore.Update(ctx, &ecocreditv1beta1.BatchBalance{ + if err := s.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ Address: from, BatchId: batch.Id, Tradable: fromTradableBalance.String(), @@ -1084,7 +1079,7 @@ func (s serverImpl) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_ } // update the "retired" balance only if credits were retired if didRetire { - if err := s.batchSupplyStore.Update(ctx, &ecocreditv1beta1.BatchSupply{ + if err := s.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ BatchId: batch.Id, TradableAmount: batchSupplyTradable.String(), RetiredAmount: batchSupplyRetired.String(), @@ -1118,7 +1113,7 @@ func getNonNegativeFixedDecs(precision uint32, decimals ...string) ([]math.Dec, func (s serverImpl) getCreditTypeFromBatchDenom(ctx context.Context, denom string) (v1beta1.CreditType, error) { classId := ecocredit.GetClassIdFromBatchDenom(denom) - classInfo, err := s.classInfoStore.GetByName(ctx, classId) + classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, classId) if err != nil { return v1beta1.CreditType{}, err } @@ -1127,7 +1122,7 @@ func (s serverImpl) getCreditTypeFromBatchDenom(ctx context.Context, denom strin func (s serverImpl) getClassSequenceNo(ctx context.Context, ctype string) (uint64, error) { var seq uint64 - classSeq, err := s.classSeqStore.Get(ctx, ctype) + classSeq, err := s.stateStore.ClassSequenceStore().Get(ctx, ctype) switch err { case nil: seq = classSeq.NextClassId @@ -1136,7 +1131,7 @@ func (s serverImpl) getClassSequenceNo(ctx context.Context, ctype string) (uint6 default: return 0, err } - err = s.classSeqStore.Save(ctx, &ecocreditv1beta1.ClassSequence{ + err = s.stateStore.ClassSequenceStore().Save(ctx, &ecocreditv1beta1.ClassSequence{ CreditType: ctype, NextClassId: seq + 1, }) diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index ff3dc0f69d..1efe981858 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -24,7 +24,7 @@ func (s serverImpl) Classes(ctx context.Context, request *v1beta1.QueryClassesRe request.Pagination = &query.PageRequest{} } p := request.Pagination - it, err := s.classInfoStore.List(ctx, &ecocreditv1beta1.ClassInfoPrimaryKey{}, ormlist.Paginate(&queryv1beta1.PageRequest{ + it, err := s.stateStore.ClassInfoStore().List(ctx, &ecocreditv1beta1.ClassInfoPrimaryKey{}, ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, @@ -59,13 +59,13 @@ func (s serverImpl) ClassInfo(ctx context.Context, request *v1beta1.QueryClassIn if err := ecocredit.ValidateClassID(request.ClassId); err != nil { return nil, err } - classInfo, err := s.classInfoStore.GetByName(ctx, request.ClassId) + classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) if err != nil { return nil, err } issuers := make([]string, 0) - it, err := s.classIssuerStore.List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId)) + it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId)) if err != nil { return nil, err } @@ -98,7 +98,7 @@ func (s serverImpl) ClassIssuers(ctx context.Context, request *v1beta1.QueryClas return nil, err } - it, err := s.classIssuerStore.List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId), ormlist.Paginate(&queryv1beta1.PageRequest{ + it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId), ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, @@ -137,11 +137,11 @@ func (s serverImpl) Projects(ctx context.Context, request *v1beta1.QueryProjects request.Pagination = &query.PageRequest{} } p := request.Pagination - cInfo, err := s.classInfoStore.GetByName(ctx, request.ClassId) + cInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) if err != nil { return nil, err } - it, err := s.projectInfoStore.List(ctx, ecocreditv1beta1.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ + it, err := s.stateStore.ProjectInfoStore().List(ctx, ecocreditv1beta1.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, @@ -157,7 +157,7 @@ func (s serverImpl) Projects(ctx context.Context, request *v1beta1.QueryProjects if err != nil { return nil, err } - classInfo, err := s.classInfoStore.Get(ctx, info.ClassId) + classInfo, err := s.stateStore.ClassInfoStore().Get(ctx, info.ClassId) if err != nil { return nil, err } @@ -186,12 +186,12 @@ func (s serverImpl) ProjectInfo(ctx context.Context, request *v1beta1.QueryProje if err := ecocredit.ValidateProjectID(request.ProjectId); err != nil { return nil, err } - pInfo, err := s.projectInfoStore.GetByName(ctx, request.ProjectId) + pInfo, err := s.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) if err != nil { return nil, err } - cInfo, err := s.classInfoStore.Get(ctx, pInfo.ClassId) + cInfo, err := s.stateStore.ClassInfoStore().Get(ctx, pInfo.ClassId) if err != nil { return nil, err } @@ -214,11 +214,11 @@ func (s serverImpl) Batches(ctx context.Context, request *v1beta1.QueryBatchesRe request.Pagination = &query.PageRequest{} } p := request.Pagination - project, err := s.projectInfoStore.GetByName(ctx, request.ProjectId) + project, err := s.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) if err != nil { return nil, err } - it, err := s.batchInfoStore.List(ctx, ecocreditv1beta1.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ + it, err := s.stateStore.BatchInfoStore().List(ctx, ecocreditv1beta1.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, @@ -230,7 +230,7 @@ func (s serverImpl) Batches(ctx context.Context, request *v1beta1.QueryBatchesRe } projectName := request.ProjectId - pinfo, err := s.projectInfoStore.GetByName(ctx, projectName) + pinfo, err := s.stateStore.ProjectInfoStore().GetByName(ctx, projectName) if err != nil { return nil, err } @@ -277,12 +277,12 @@ func (s serverImpl) BatchInfo(ctx context.Context, request *v1beta1.QueryBatchIn return nil, err } - batch, err := s.batchInfoStore.GetByBatchDenom(ctx, request.BatchDenom) + batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, request.BatchDenom) if err != nil { return nil, err } - project, err := s.projectInfoStore.Get(ctx, batch.ProjectId) + project, err := s.stateStore.ProjectInfoStore().Get(ctx, batch.ProjectId) if err != nil { return nil, err } @@ -316,7 +316,7 @@ func (s serverImpl) Balance(ctx context.Context, req *v1beta1.QueryBalanceReques if err := ecocredit.ValidateDenom(req.BatchDenom); err != nil { return nil, err } - batch, err := s.batchInfoStore.GetByBatchDenom(ctx, req.BatchDenom) + batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, req.BatchDenom) if err != nil { return nil, err } @@ -325,7 +325,7 @@ func (s serverImpl) Balance(ctx context.Context, req *v1beta1.QueryBalanceReques } addr, _ := sdk.AccAddressFromBech32(req.Account) - balance, err := s.batchBalanceStore.Get(ctx, addr, batch.Id) + balance, err := s.stateStore.BatchBalanceStore().Get(ctx, addr, batch.Id) if err != nil { return nil, err } @@ -351,12 +351,12 @@ func (s serverImpl) Supply(ctx context.Context, request *v1beta1.QuerySupplyRequ return nil, err } - batch, err := s.batchInfoStore.GetByBatchDenom(ctx, request.BatchDenom) + batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, request.BatchDenom) if err != nil { return nil, err } - supply, err := s.batchSupplyStore.Get(ctx, batch.Id) + supply, err := s.stateStore.BatchSupplyStore().Get(ctx, batch.Id) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/server.go b/x/ecocredit/server/core/server.go index 479cace116..69af12e22e 100644 --- a/x/ecocredit/server/core/server.go +++ b/x/ecocredit/server/core/server.go @@ -22,24 +22,7 @@ type serverImpl struct { db ormdb.ModuleDB - creditTypeStore ecocreditv1beta1.CreditTypeStore - - batchInfoStore ecocreditv1beta1.BatchInfoStore - batchSupplyStore ecocreditv1beta1.BatchSupplyStore - batchBalanceStore ecocreditv1beta1.BatchBalanceStore - batchSeqStore ecocreditv1beta1.BatchSequenceStore - - projectInfoStore ecocreditv1beta1.ProjectInfoStore - projectSeqStore ecocreditv1beta1.ProjectSequenceStore - - classInfoStore ecocreditv1beta1.ClassInfoStore - classIssuerStore ecocreditv1beta1.ClassIssuerStore - classSeqStore ecocreditv1beta1.ClassSequenceStore -} - -var ecocreditSchema = ormdb.ModuleSchema{ - FileDescriptors: map[uint32]protoreflect.FileDescriptor{1: ecocreditv1beta1.File_regen_ecocredit_v1beta1_state_proto}, - Prefix: nil, + stateStore ecocreditv1beta1.StateStore } func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, @@ -52,6 +35,11 @@ func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper: accountKeeper, } + ecocreditSchema := ormdb.ModuleSchema{ + FileDescriptors: map[uint32]protoreflect.FileDescriptor{1: ecocreditv1beta1.File_regen_ecocredit_v1beta1_state_proto}, + Prefix: nil, + } + db, err := ormstore.NewStoreKeyDB(ecocreditSchema, storeKey, ormdb.ModuleDBOptions{}) if err != nil { panic(err) @@ -62,11 +50,7 @@ func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, if err != nil { panic(err) } - s.creditTypeStore, s.classInfoStore, s.classSeqStore, s.projectInfoStore, - s.projectSeqStore, s.batchInfoStore, s.batchSeqStore, s.batchBalanceStore, - s.batchSupplyStore, s.classIssuerStore = stateStore.CreditTypeStore(), stateStore.ClassInfoStore(), stateStore.ClassSequenceStore(), - stateStore.ProjectInfoStore(), stateStore.ProjectSequenceStore(), stateStore.BatchInfoStore(), - stateStore.BatchSequenceStore(), stateStore.BatchBalanceStore(), stateStore.BatchSupplyStore(), stateStore.ClassIssuerStore() + s.stateStore = stateStore return s } From 3e11a195daa907a605813b250addbff8f059aca1 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:54:35 -0800 Subject: [PATCH 04/31] chore: fix invariants --- x/ecocredit/server/core/invariants.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x/ecocredit/server/core/invariants.go b/x/ecocredit/server/core/invariants.go index f8e0a89c06..9a59f3542e 100644 --- a/x/ecocredit/server/core/invariants.go +++ b/x/ecocredit/server/core/invariants.go @@ -16,9 +16,9 @@ func (s serverImpl) RegisterInvariants(ir sdk.InvariantRegistry) { func (s serverImpl) tradableSupplyInvariant() sdk.Invariant { return func(ctx sdk.Context) (string, bool) { - supplyStore := s.batchSupplyStore - batchStore := s.batchInfoStore - balanceStore := s.batchBalanceStore + supplyStore := s.stateStore.BatchSupplyStore() + batchStore := s.stateStore.BatchInfoStore() + balanceStore := s.stateStore.BatchBalanceStore() return tradableSupplyInvariant(supplyStore, balanceStore, batchStore, ctx) } } @@ -78,9 +78,9 @@ func tradableSupplyInvariant(batchSupplyStore ecocreditv1beta1.BatchSupplyStore, func (s serverImpl) retiredSupplyInvariant() sdk.Invariant { return func(ctx sdk.Context) (string, bool) { - supplyStore := s.batchSupplyStore - balanceStore := s.batchBalanceStore - batchStore := s.batchInfoStore + supplyStore := s.stateStore.BatchSupplyStore() + balanceStore := s.stateStore.BatchBalanceStore() + batchStore := s.stateStore.BatchInfoStore() return retiredSupplyInvariant(supplyStore, balanceStore, batchStore, ctx) } } From 015eaffa09cfee6fd2876231c65f8ec43bb0fb65 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 14:09:32 -0800 Subject: [PATCH 05/31] feat: add row id to events/responses --- api/regen/ecocredit/v1beta1/events.pulsar.go | 397 +++++++++---- api/regen/ecocredit/v1beta1/tx.pulsar.go | 575 ++++++++++++------- proto/regen/ecocredit/v1beta1/events.proto | 34 +- proto/regen/ecocredit/v1beta1/tx.proto | 13 +- x/ecocredit/server/core/msg_server.go | 19 +- x/ecocredit/v1beta1/events.pb.go | 251 +++++--- x/ecocredit/v1beta1/tx.pb.go | 248 +++++--- 7 files changed, 1058 insertions(+), 479 deletions(-) diff --git a/api/regen/ecocredit/v1beta1/events.pulsar.go b/api/regen/ecocredit/v1beta1/events.pulsar.go index 309f62eef2..2d2e91e6b2 100644 --- a/api/regen/ecocredit/v1beta1/events.pulsar.go +++ b/api/regen/ecocredit/v1beta1/events.pulsar.go @@ -14,6 +14,7 @@ import ( var ( md_EventCreateClass protoreflect.MessageDescriptor + fd_EventCreateClass_row_id protoreflect.FieldDescriptor fd_EventCreateClass_class_id protoreflect.FieldDescriptor fd_EventCreateClass_admin protoreflect.FieldDescriptor ) @@ -21,6 +22,7 @@ var ( func init() { file_regen_ecocredit_v1beta1_events_proto_init() md_EventCreateClass = File_regen_ecocredit_v1beta1_events_proto.Messages().ByName("EventCreateClass") + fd_EventCreateClass_row_id = md_EventCreateClass.Fields().ByName("row_id") fd_EventCreateClass_class_id = md_EventCreateClass.Fields().ByName("class_id") fd_EventCreateClass_admin = md_EventCreateClass.Fields().ByName("admin") } @@ -90,6 +92,12 @@ func (x *fastReflection_EventCreateClass) Interface() protoreflect.ProtoMessage // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_EventCreateClass) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.RowId != uint64(0) { + value := protoreflect.ValueOfUint64(x.RowId) + if !f(fd_EventCreateClass_row_id, value) { + return + } + } if x.ClassId != "" { value := protoreflect.ValueOfString(x.ClassId) if !f(fd_EventCreateClass_class_id, value) { @@ -117,6 +125,8 @@ func (x *fastReflection_EventCreateClass) Range(f func(protoreflect.FieldDescrip // a repeated field is populated if it is non-empty. func (x *fastReflection_EventCreateClass) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateClass.row_id": + return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": return x.ClassId != "" case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -137,6 +147,8 @@ func (x *fastReflection_EventCreateClass) Has(fd protoreflect.FieldDescriptor) b // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateClass) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateClass.row_id": + x.RowId = uint64(0) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": x.ClassId = "" case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -157,6 +169,9 @@ func (x *fastReflection_EventCreateClass) Clear(fd protoreflect.FieldDescriptor) // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_EventCreateClass) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "regen.ecocredit.v1beta1.EventCreateClass.row_id": + value := x.RowId + return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": value := x.ClassId return protoreflect.ValueOfString(value) @@ -183,6 +198,8 @@ func (x *fastReflection_EventCreateClass) Get(descriptor protoreflect.FieldDescr // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateClass) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateClass.row_id": + x.RowId = value.Uint() case "regen.ecocredit.v1beta1.EventCreateClass.class_id": x.ClassId = value.Interface().(string) case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -207,6 +224,8 @@ func (x *fastReflection_EventCreateClass) Set(fd protoreflect.FieldDescriptor, v // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateClass) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateClass.row_id": + panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.EventCreateClass is not mutable")) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": panic(fmt.Errorf("field class_id of message regen.ecocredit.v1beta1.EventCreateClass is not mutable")) case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -224,6 +243,8 @@ func (x *fastReflection_EventCreateClass) Mutable(fd protoreflect.FieldDescripto // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_EventCreateClass) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateClass.row_id": + return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -297,6 +318,9 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { var n int var l int _ = l + if x.RowId != 0 { + n += 1 + runtime.Sov(uint64(x.RowId)) + } l = len(x.ClassId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -339,14 +363,19 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.Admin) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Admin))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if len(x.ClassId) > 0 { i -= len(x.ClassId) copy(dAtA[i:], x.ClassId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if x.RowId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) + i-- + dAtA[i] = 0x8 } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -398,6 +427,25 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + x.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -429,7 +477,7 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { } x.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } @@ -498,6 +546,7 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { var ( md_EventCreateProject protoreflect.MessageDescriptor + fd_EventCreateProject_row_id protoreflect.FieldDescriptor fd_EventCreateProject_project_id protoreflect.FieldDescriptor fd_EventCreateProject_class_id protoreflect.FieldDescriptor fd_EventCreateProject_issuer protoreflect.FieldDescriptor @@ -507,6 +556,7 @@ var ( func init() { file_regen_ecocredit_v1beta1_events_proto_init() md_EventCreateProject = File_regen_ecocredit_v1beta1_events_proto.Messages().ByName("EventCreateProject") + fd_EventCreateProject_row_id = md_EventCreateProject.Fields().ByName("row_id") fd_EventCreateProject_project_id = md_EventCreateProject.Fields().ByName("project_id") fd_EventCreateProject_class_id = md_EventCreateProject.Fields().ByName("class_id") fd_EventCreateProject_issuer = md_EventCreateProject.Fields().ByName("issuer") @@ -578,6 +628,12 @@ func (x *fastReflection_EventCreateProject) Interface() protoreflect.ProtoMessag // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_EventCreateProject) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.RowId != uint64(0) { + value := protoreflect.ValueOfUint64(x.RowId) + if !f(fd_EventCreateProject_row_id, value) { + return + } + } if x.ProjectId != "" { value := protoreflect.ValueOfString(x.ProjectId) if !f(fd_EventCreateProject_project_id, value) { @@ -617,6 +673,8 @@ func (x *fastReflection_EventCreateProject) Range(f func(protoreflect.FieldDescr // a repeated field is populated if it is non-empty. func (x *fastReflection_EventCreateProject) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateProject.row_id": + return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": return x.ProjectId != "" case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -641,6 +699,8 @@ func (x *fastReflection_EventCreateProject) Has(fd protoreflect.FieldDescriptor) // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateProject) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateProject.row_id": + x.RowId = uint64(0) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": x.ProjectId = "" case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -665,6 +725,9 @@ func (x *fastReflection_EventCreateProject) Clear(fd protoreflect.FieldDescripto // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_EventCreateProject) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "regen.ecocredit.v1beta1.EventCreateProject.row_id": + value := x.RowId + return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": value := x.ProjectId return protoreflect.ValueOfString(value) @@ -697,6 +760,8 @@ func (x *fastReflection_EventCreateProject) Get(descriptor protoreflect.FieldDes // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateProject) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateProject.row_id": + x.RowId = value.Uint() case "regen.ecocredit.v1beta1.EventCreateProject.project_id": x.ProjectId = value.Interface().(string) case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -725,6 +790,8 @@ func (x *fastReflection_EventCreateProject) Set(fd protoreflect.FieldDescriptor, // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateProject) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateProject.row_id": + panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.EventCreateProject is not mutable")) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": panic(fmt.Errorf("field project_id of message regen.ecocredit.v1beta1.EventCreateProject is not mutable")) case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -746,6 +813,8 @@ func (x *fastReflection_EventCreateProject) Mutable(fd protoreflect.FieldDescrip // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_EventCreateProject) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateProject.row_id": + return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -823,6 +892,9 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { var n int var l int _ = l + if x.RowId != 0 { + n += 1 + runtime.Sov(uint64(x.RowId)) + } l = len(x.ProjectId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -873,28 +945,33 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.ProjectLocation) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectLocation))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if len(x.Issuer) > 0 { i -= len(x.Issuer) copy(dAtA[i:], x.Issuer) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Issuer))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(x.ClassId) > 0 { i -= len(x.ClassId) copy(dAtA[i:], x.ClassId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if len(x.ProjectId) > 0 { i -= len(x.ProjectId) copy(dAtA[i:], x.ProjectId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if x.RowId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) + i-- + dAtA[i] = 0x8 } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -946,6 +1023,25 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + x.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -977,7 +1073,7 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { } x.ProjectId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1009,7 +1105,7 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { } x.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } @@ -1041,7 +1137,7 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { } x.Issuer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) } @@ -1110,6 +1206,7 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { var ( md_EventCreateBatch protoreflect.MessageDescriptor + fd_EventCreateBatch_row_id protoreflect.FieldDescriptor fd_EventCreateBatch_class_id protoreflect.FieldDescriptor fd_EventCreateBatch_batch_denom protoreflect.FieldDescriptor fd_EventCreateBatch_issuer protoreflect.FieldDescriptor @@ -1123,6 +1220,7 @@ var ( func init() { file_regen_ecocredit_v1beta1_events_proto_init() md_EventCreateBatch = File_regen_ecocredit_v1beta1_events_proto.Messages().ByName("EventCreateBatch") + fd_EventCreateBatch_row_id = md_EventCreateBatch.Fields().ByName("row_id") fd_EventCreateBatch_class_id = md_EventCreateBatch.Fields().ByName("class_id") fd_EventCreateBatch_batch_denom = md_EventCreateBatch.Fields().ByName("batch_denom") fd_EventCreateBatch_issuer = md_EventCreateBatch.Fields().ByName("issuer") @@ -1198,6 +1296,12 @@ func (x *fastReflection_EventCreateBatch) Interface() protoreflect.ProtoMessage // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_EventCreateBatch) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.RowId != uint64(0) { + value := protoreflect.ValueOfUint64(x.RowId) + if !f(fd_EventCreateBatch_row_id, value) { + return + } + } if x.ClassId != "" { value := protoreflect.ValueOfString(x.ClassId) if !f(fd_EventCreateBatch_class_id, value) { @@ -1261,6 +1365,8 @@ func (x *fastReflection_EventCreateBatch) Range(f func(protoreflect.FieldDescrip // a repeated field is populated if it is non-empty. func (x *fastReflection_EventCreateBatch) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": + return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": return x.ClassId != "" case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1293,6 +1399,8 @@ func (x *fastReflection_EventCreateBatch) Has(fd protoreflect.FieldDescriptor) b // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateBatch) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": + x.RowId = uint64(0) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": x.ClassId = "" case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1325,6 +1433,9 @@ func (x *fastReflection_EventCreateBatch) Clear(fd protoreflect.FieldDescriptor) // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_EventCreateBatch) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": + value := x.RowId + return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": value := x.ClassId return protoreflect.ValueOfString(value) @@ -1369,6 +1480,8 @@ func (x *fastReflection_EventCreateBatch) Get(descriptor protoreflect.FieldDescr // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateBatch) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": + x.RowId = value.Uint() case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": x.ClassId = value.Interface().(string) case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1405,6 +1518,8 @@ func (x *fastReflection_EventCreateBatch) Set(fd protoreflect.FieldDescriptor, v // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateBatch) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": + panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.EventCreateBatch is not mutable")) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": panic(fmt.Errorf("field class_id of message regen.ecocredit.v1beta1.EventCreateBatch is not mutable")) case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1434,6 +1549,8 @@ func (x *fastReflection_EventCreateBatch) Mutable(fd protoreflect.FieldDescripto // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_EventCreateBatch) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": + return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1519,6 +1636,9 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { var n int var l int _ = l + if x.RowId != 0 { + n += 1 + runtime.Sov(uint64(x.RowId)) + } l = len(x.ClassId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -1585,56 +1705,61 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.ProjectId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectId))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x4a } if len(x.ProjectLocation) > 0 { i -= len(x.ProjectLocation) copy(dAtA[i:], x.ProjectLocation) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectLocation))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x42 } if len(x.EndDate) > 0 { i -= len(x.EndDate) copy(dAtA[i:], x.EndDate) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.EndDate))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x3a } if len(x.StartDate) > 0 { i -= len(x.StartDate) copy(dAtA[i:], x.StartDate) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StartDate))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 } if len(x.TotalAmount) > 0 { i -= len(x.TotalAmount) copy(dAtA[i:], x.TotalAmount) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalAmount))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if len(x.Issuer) > 0 { i -= len(x.Issuer) copy(dAtA[i:], x.Issuer) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Issuer))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(x.BatchDenom) > 0 { i -= len(x.BatchDenom) copy(dAtA[i:], x.BatchDenom) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.BatchDenom))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if len(x.ClassId) > 0 { i -= len(x.ClassId) copy(dAtA[i:], x.ClassId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if x.RowId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) + i-- + dAtA[i] = 0x8 } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1686,6 +1811,25 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + x.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1717,7 +1861,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) } @@ -1749,7 +1893,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.BatchDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } @@ -1781,7 +1925,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.Issuer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TotalAmount", wireType) } @@ -1813,7 +1957,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.TotalAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartDate", wireType) } @@ -1845,7 +1989,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.StartDate = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 7: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EndDate", wireType) } @@ -1877,7 +2021,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.EndDate = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 8: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) } @@ -1909,7 +2053,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.ProjectLocation = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 9: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -3831,10 +3975,12 @@ type EventCreateClass struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // admin is the admin of the credit class. - Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` + Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` } func (x *EventCreateClass) Reset() { @@ -3857,6 +4003,13 @@ func (*EventCreateClass) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_events_proto_rawDescGZIP(), []int{0} } +func (x *EventCreateClass) GetRowId() uint64 { + if x != nil { + return x.RowId + } + return 0 +} + func (x *EventCreateClass) GetClassId() string { if x != nil { return x.ClassId @@ -3877,15 +4030,17 @@ type EventCreateProject struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // project_id is the unique ID of the project. - ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` // class_id is the unique ID of credit class for this project. - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,3,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // issuer is the issuer of the credit batches for this project. - Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - ProjectLocation string `protobuf:"bytes,4,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` + ProjectLocation string `protobuf:"bytes,5,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` } func (x *EventCreateProject) Reset() { @@ -3908,6 +4063,13 @@ func (*EventCreateProject) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_events_proto_rawDescGZIP(), []int{1} } +func (x *EventCreateProject) GetRowId() uint64 { + if x != nil { + return x.RowId + } + return 0 +} + func (x *EventCreateProject) GetProjectId() string { if x != nil { return x.ProjectId @@ -3942,25 +4104,27 @@ type EventCreateBatch struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // batch_denom is the unique ID of credit batch. - BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + BatchDenom string `protobuf:"bytes,3,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` // issuer is the account address of the issuer of the credit batch. - Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` // total_amount is the total number of credits in the credit batch. - TotalAmount string `protobuf:"bytes,4,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` + TotalAmount string `protobuf:"bytes,5,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` // start_date is the beginning of the period during which this credit batch // was quantified and verified. - StartDate string `protobuf:"bytes,5,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` + StartDate string `protobuf:"bytes,6,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` // end_date is the end of the period during which this credit batch was // quantified and verified. - EndDate string `protobuf:"bytes,6,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` + EndDate string `protobuf:"bytes,7,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - ProjectLocation string `protobuf:"bytes,7,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` + ProjectLocation string `protobuf:"bytes,8,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` // project_id is the unique ID of the project this batch belongs to. - ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,9,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` } func (x *EventCreateBatch) Reset() { @@ -3983,6 +4147,13 @@ func (*EventCreateBatch) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_events_proto_rawDescGZIP(), []int{2} } +func (x *EventCreateBatch) GetRowId() uint64 { + if x != nil { + return x.RowId + } + return 0 +} + func (x *EventCreateBatch) GetClassId() string { if x != nil { return x.ClassId @@ -4253,79 +4424,83 @@ var file_regen_ecocredit_v1beta1_events_proto_rawDesc = []byte{ 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x22, - 0x43, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, - 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x91, 0x01, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, + 0x5a, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x29, 0x0a, - 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8d, 0x02, 0x0a, 0x10, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x19, 0x0a, - 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, - 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, - 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, - 0x75, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, - 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x41, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, - 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, - 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x12, 0x29, - 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0xb5, 0x01, 0x0a, 0x0c, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, - 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, - 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, - 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, - 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x7c, 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, - 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, - 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x64, - 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x1c, 0x0a, - 0x09, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x62, - 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xfc, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x52, 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, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, - 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, - 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xe2, 0x02, 0x23, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, - 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0xa8, 0x01, 0x0a, 0x12, + 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, + 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa4, 0x02, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x72, + 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, + 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1f, 0x0a, + 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, + 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x6f, + 0x74, 0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, + 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, + 0x61, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, + 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0xb5, 0x01, + 0x0a, 0x0c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, + 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, + 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, + 0x6e, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, + 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, + 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, + 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x7c, 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, + 0x74, 0x69, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x72, 0x12, 0x1f, + 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, + 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x22, 0x64, 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6e, 0x63, + 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x72, + 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, + 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xfc, 0x01, 0x0a, 0x1b, 0x63, 0x6f, + 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x52, 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, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, + 0x45, 0x58, 0xaa, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, + 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, + 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, + 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, + 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/regen/ecocredit/v1beta1/tx.pulsar.go b/api/regen/ecocredit/v1beta1/tx.pulsar.go index 771d4fae1a..d05005f871 100644 --- a/api/regen/ecocredit/v1beta1/tx.pulsar.go +++ b/api/regen/ecocredit/v1beta1/tx.pulsar.go @@ -690,12 +690,14 @@ func (x *fastReflection_MsgCreateClass) ProtoMethods() *protoiface.Methods { var ( md_MsgCreateClassResponse protoreflect.MessageDescriptor + fd_MsgCreateClassResponse_row_id protoreflect.FieldDescriptor fd_MsgCreateClassResponse_class_id protoreflect.FieldDescriptor ) func init() { file_regen_ecocredit_v1beta1_tx_proto_init() md_MsgCreateClassResponse = File_regen_ecocredit_v1beta1_tx_proto.Messages().ByName("MsgCreateClassResponse") + fd_MsgCreateClassResponse_row_id = md_MsgCreateClassResponse.Fields().ByName("row_id") fd_MsgCreateClassResponse_class_id = md_MsgCreateClassResponse.Fields().ByName("class_id") } @@ -764,6 +766,12 @@ func (x *fastReflection_MsgCreateClassResponse) Interface() protoreflect.ProtoMe // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgCreateClassResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.RowId != uint64(0) { + value := protoreflect.ValueOfUint64(x.RowId) + if !f(fd_MsgCreateClassResponse_row_id, value) { + return + } + } if x.ClassId != "" { value := protoreflect.ValueOfString(x.ClassId) if !f(fd_MsgCreateClassResponse_class_id, value) { @@ -785,6 +793,8 @@ func (x *fastReflection_MsgCreateClassResponse) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgCreateClassResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": + return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": return x.ClassId != "" default: @@ -803,6 +813,8 @@ func (x *fastReflection_MsgCreateClassResponse) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClassResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": + x.RowId = uint64(0) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": x.ClassId = "" default: @@ -821,6 +833,9 @@ func (x *fastReflection_MsgCreateClassResponse) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgCreateClassResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": + value := x.RowId + return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": value := x.ClassId return protoreflect.ValueOfString(value) @@ -844,6 +859,8 @@ func (x *fastReflection_MsgCreateClassResponse) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClassResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": + x.RowId = value.Uint() case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": x.ClassId = value.Interface().(string) default: @@ -866,6 +883,8 @@ func (x *fastReflection_MsgCreateClassResponse) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClassResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": + panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.MsgCreateClassResponse is not mutable")) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": panic(fmt.Errorf("field class_id of message regen.ecocredit.v1beta1.MsgCreateClassResponse is not mutable")) default: @@ -881,6 +900,8 @@ func (x *fastReflection_MsgCreateClassResponse) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgCreateClassResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": + return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": return protoreflect.ValueOfString("") default: @@ -952,6 +973,9 @@ func (x *fastReflection_MsgCreateClassResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l + if x.RowId != 0 { + n += 1 + runtime.Sov(uint64(x.RowId)) + } l = len(x.ClassId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -990,7 +1014,12 @@ func (x *fastReflection_MsgCreateClassResponse) ProtoMethods() *protoiface.Metho copy(dAtA[i:], x.ClassId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if x.RowId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) + i-- + dAtA[i] = 0x8 } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1042,6 +1071,25 @@ func (x *fastReflection_MsgCreateClassResponse) ProtoMethods() *protoiface.Metho } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + x.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1788,12 +1836,14 @@ func (x *fastReflection_MsgCreateProject) ProtoMethods() *protoiface.Methods { var ( md_MsgCreateProjectResponse protoreflect.MessageDescriptor + fd_MsgCreateProjectResponse_row_id protoreflect.FieldDescriptor fd_MsgCreateProjectResponse_project_id protoreflect.FieldDescriptor ) func init() { file_regen_ecocredit_v1beta1_tx_proto_init() md_MsgCreateProjectResponse = File_regen_ecocredit_v1beta1_tx_proto.Messages().ByName("MsgCreateProjectResponse") + fd_MsgCreateProjectResponse_row_id = md_MsgCreateProjectResponse.Fields().ByName("row_id") fd_MsgCreateProjectResponse_project_id = md_MsgCreateProjectResponse.Fields().ByName("project_id") } @@ -1862,6 +1912,12 @@ func (x *fastReflection_MsgCreateProjectResponse) Interface() protoreflect.Proto // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgCreateProjectResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.RowId != uint64(0) { + value := protoreflect.ValueOfUint64(x.RowId) + if !f(fd_MsgCreateProjectResponse_row_id, value) { + return + } + } if x.ProjectId != "" { value := protoreflect.ValueOfString(x.ProjectId) if !f(fd_MsgCreateProjectResponse_project_id, value) { @@ -1883,6 +1939,8 @@ func (x *fastReflection_MsgCreateProjectResponse) Range(f func(protoreflect.Fiel // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgCreateProjectResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": + return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": return x.ProjectId != "" default: @@ -1901,6 +1959,8 @@ func (x *fastReflection_MsgCreateProjectResponse) Has(fd protoreflect.FieldDescr // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateProjectResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": + x.RowId = uint64(0) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": x.ProjectId = "" default: @@ -1919,6 +1979,9 @@ func (x *fastReflection_MsgCreateProjectResponse) Clear(fd protoreflect.FieldDes // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgCreateProjectResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": + value := x.RowId + return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": value := x.ProjectId return protoreflect.ValueOfString(value) @@ -1942,6 +2005,8 @@ func (x *fastReflection_MsgCreateProjectResponse) Get(descriptor protoreflect.Fi // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateProjectResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": + x.RowId = value.Uint() case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": x.ProjectId = value.Interface().(string) default: @@ -1964,6 +2029,8 @@ func (x *fastReflection_MsgCreateProjectResponse) Set(fd protoreflect.FieldDescr // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateProjectResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": + panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.MsgCreateProjectResponse is not mutable")) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": panic(fmt.Errorf("field project_id of message regen.ecocredit.v1beta1.MsgCreateProjectResponse is not mutable")) default: @@ -1979,6 +2046,8 @@ func (x *fastReflection_MsgCreateProjectResponse) Mutable(fd protoreflect.FieldD // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgCreateProjectResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": + return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": return protoreflect.ValueOfString("") default: @@ -2050,6 +2119,9 @@ func (x *fastReflection_MsgCreateProjectResponse) ProtoMethods() *protoiface.Met var n int var l int _ = l + if x.RowId != 0 { + n += 1 + runtime.Sov(uint64(x.RowId)) + } l = len(x.ProjectId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -2088,7 +2160,12 @@ func (x *fastReflection_MsgCreateProjectResponse) ProtoMethods() *protoiface.Met copy(dAtA[i:], x.ProjectId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if x.RowId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) + i-- + dAtA[i] = 0x8 } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -2140,6 +2217,25 @@ func (x *fastReflection_MsgCreateProjectResponse) ProtoMethods() *protoiface.Met } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + x.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -3666,12 +3762,14 @@ func (x *fastReflection_MsgCreateBatch_BatchIssuance) ProtoMethods() *protoiface var ( md_MsgCreateBatchResponse protoreflect.MessageDescriptor + fd_MsgCreateBatchResponse_row_id protoreflect.FieldDescriptor fd_MsgCreateBatchResponse_batch_denom protoreflect.FieldDescriptor ) func init() { file_regen_ecocredit_v1beta1_tx_proto_init() md_MsgCreateBatchResponse = File_regen_ecocredit_v1beta1_tx_proto.Messages().ByName("MsgCreateBatchResponse") + fd_MsgCreateBatchResponse_row_id = md_MsgCreateBatchResponse.Fields().ByName("row_id") fd_MsgCreateBatchResponse_batch_denom = md_MsgCreateBatchResponse.Fields().ByName("batch_denom") } @@ -3740,6 +3838,12 @@ func (x *fastReflection_MsgCreateBatchResponse) Interface() protoreflect.ProtoMe // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgCreateBatchResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.RowId != uint64(0) { + value := protoreflect.ValueOfUint64(x.RowId) + if !f(fd_MsgCreateBatchResponse_row_id, value) { + return + } + } if x.BatchDenom != "" { value := protoreflect.ValueOfString(x.BatchDenom) if !f(fd_MsgCreateBatchResponse_batch_denom, value) { @@ -3761,6 +3865,8 @@ func (x *fastReflection_MsgCreateBatchResponse) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgCreateBatchResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": + return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": return x.BatchDenom != "" default: @@ -3779,6 +3885,8 @@ func (x *fastReflection_MsgCreateBatchResponse) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateBatchResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": + x.RowId = uint64(0) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": x.BatchDenom = "" default: @@ -3797,6 +3905,9 @@ func (x *fastReflection_MsgCreateBatchResponse) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgCreateBatchResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": + value := x.RowId + return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": value := x.BatchDenom return protoreflect.ValueOfString(value) @@ -3820,6 +3931,8 @@ func (x *fastReflection_MsgCreateBatchResponse) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateBatchResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": + x.RowId = value.Uint() case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": x.BatchDenom = value.Interface().(string) default: @@ -3842,6 +3955,8 @@ func (x *fastReflection_MsgCreateBatchResponse) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateBatchResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": + panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.MsgCreateBatchResponse is not mutable")) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": panic(fmt.Errorf("field batch_denom of message regen.ecocredit.v1beta1.MsgCreateBatchResponse is not mutable")) default: @@ -3857,6 +3972,8 @@ func (x *fastReflection_MsgCreateBatchResponse) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgCreateBatchResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { + case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": + return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": return protoreflect.ValueOfString("") default: @@ -3928,6 +4045,9 @@ func (x *fastReflection_MsgCreateBatchResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l + if x.RowId != 0 { + n += 1 + runtime.Sov(uint64(x.RowId)) + } l = len(x.BatchDenom) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -3966,7 +4086,12 @@ func (x *fastReflection_MsgCreateBatchResponse) ProtoMethods() *protoiface.Metho copy(dAtA[i:], x.BatchDenom) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.BatchDenom))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if x.RowId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) + i-- + dAtA[i] = 0x8 } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -4018,6 +4143,25 @@ func (x *fastReflection_MsgCreateBatchResponse) ProtoMethods() *protoiface.Metho } switch fieldNum { case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + x.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + x.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) } @@ -11391,8 +11535,10 @@ type MsgCreateClassResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of the newly created credit class. - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } func (x *MsgCreateClassResponse) Reset() { @@ -11415,6 +11561,13 @@ func (*MsgCreateClassResponse) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_tx_proto_rawDescGZIP(), []int{1} } +func (x *MsgCreateClassResponse) GetRowId() uint64 { + if x != nil { + return x.RowId + } + return 0 +} + func (x *MsgCreateClassResponse) GetClassId() string { if x != nil { return x.ClassId @@ -11512,8 +11665,10 @@ type MsgCreateProjectResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // project_id is the ID of the newly created project. - ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` } func (x *MsgCreateProjectResponse) Reset() { @@ -11536,6 +11691,13 @@ func (*MsgCreateProjectResponse) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_tx_proto_rawDescGZIP(), []int{3} } +func (x *MsgCreateProjectResponse) GetRowId() uint64 { + if x != nil { + return x.RowId + } + return 0 +} + func (x *MsgCreateProjectResponse) GetProjectId() string { if x != nil { return x.ProjectId @@ -11633,8 +11795,10 @@ type MsgCreateBatchResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // batch_denom is the unique denomination ID of the newly created batch. - BatchDenom string `protobuf:"bytes,1,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` } func (x *MsgCreateBatchResponse) Reset() { @@ -11657,6 +11821,13 @@ func (*MsgCreateBatchResponse) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_tx_proto_rawDescGZIP(), []int{5} } +func (x *MsgCreateBatchResponse) GetRowId() uint64 { + if x != nil { + return x.RowId + } + return 0 +} + func (x *MsgCreateBatchResponse) GetBatchDenom() string { if x != nil { return x.BatchDenom @@ -12413,210 +12584,214 @@ var file_regen_ecocredit_v1beta1_tx_proto_rawDesc = []byte{ 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x10, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x33, 0x0a, 0x16, 0x4d, + 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x4a, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, - 0x22, 0xab, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x19, 0x0a, - 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, - 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x39, - 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0xe5, 0x03, 0x0a, 0x0e, 0x4d, 0x73, - 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x22, 0xab, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, - 0x73, 0x75, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x49, 0x64, 0x12, 0x51, 0x0a, 0x08, 0x69, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, - 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x42, - 0x61, 0x74, 0x63, 0x68, 0x49, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x69, 0x73, - 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x3f, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, - 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, - 0x1a, 0xae, 0x01, 0x0a, 0x0d, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x73, 0x73, 0x75, 0x61, 0x6e, - 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, - 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, - 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, - 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x2f, 0x0a, 0x13, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, - 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x22, 0x39, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, - 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x22, 0xb9, 0x02, 0x0a, - 0x07, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x46, - 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, - 0x64, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x52, 0x07, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x1a, 0xaf, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x43, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 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, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, - 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, - 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x13, 0x72, 0x65, 0x74, 0x69, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x53, - 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd5, 0x01, 0x0a, 0x09, - 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x6f, 0x6c, - 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x6c, 0x64, 0x65, - 0x72, 0x12, 0x4a, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x43, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x12, 0x1a, 0x0a, - 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x48, 0x0a, 0x0d, 0x52, 0x65, 0x74, - 0x69, 0x72, 0x65, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 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, 0x12, 0x16, 0x0a, 0x06, 0x61, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xb9, 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x4a, - 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, - 0x63, 0x65, 0x6c, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x1a, 0x48, 0x0a, 0x0d, 0x43, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x62, + 0x73, 0x75, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, + 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x29, 0x0a, 0x10, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x6f, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x50, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0xe5, 0x03, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, + 0x73, 0x75, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, + 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, + 0x64, 0x12, 0x51, 0x0a, 0x08, 0x69, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x42, 0x61, 0x74, + 0x63, 0x68, 0x49, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x69, 0x73, 0x73, 0x75, + 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x3f, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, + 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, + 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x1a, 0xae, + 0x01, 0x0a, 0x0d, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, + 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x27, + 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, + 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, + 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2f, + 0x0a, 0x13, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, 0x65, 0x74, + 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, + 0x50, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, + 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, + 0x6d, 0x22, 0xb9, 0x02, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, + 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, + 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x1a, 0xaf, 0x01, 0x0a, 0x0b, + 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 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, 0x12, 0x16, 0x0a, 0x06, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, - 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x63, 0x0a, 0x13, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, - 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x1d, - 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x62, 0x0a, - 0x15, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, - 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x73, 0x75, 0x65, - 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, - 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x65, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, - 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1a, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, 0x0a, 0x1e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc5, 0x07, 0x0a, 0x03, - 0x4d, 0x73, 0x67, 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, - 0x73, 0x73, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x27, 0x0a, 0x0f, + 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, + 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, + 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x13, + 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, 0x65, 0x74, 0x69, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x11, 0x0a, + 0x0f, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0xd5, 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x69, + 0x72, 0x65, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x48, + 0x0a, 0x0d, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 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, + 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x52, + 0x65, 0x74, 0x69, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xb9, 0x01, + 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x68, + 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, + 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x1a, + 0x48, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, + 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, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, + 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x63, + 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, + 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x64, + 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x41, 0x64, + 0x6d, 0x69, 0x6e, 0x22, 0x1d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x62, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, + 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, + 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69, + 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x65, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, + 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, + 0x0a, 0x1e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xc5, 0x07, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x6d, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x29, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x1a, 0x2f, 0x2e, 0x72, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x0d, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x29, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, + 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0b, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, - 0x74, 0x63, 0x68, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, + 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x04, 0x53, 0x65, 0x6e, + 0x64, 0x12, 0x20, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, + 0x65, 0x6e, 0x64, 0x1a, 0x28, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x20, 0x2e, 0x72, - 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x1a, 0x28, - 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x52, 0x65, 0x74, 0x69, - 0x72, 0x65, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, - 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x22, 0x2e, 0x72, - 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x10, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x1a, 0x34, + 0x67, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, + 0x06, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x1a, 0x2a, 0x2e, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, + 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x76, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, + 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, + 0x6d, 0x69, 0x6e, 0x1a, 0x34, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, + 0x2e, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x1a, + 0x36, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x1a, 0x36, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, - 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, - 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, - 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x37, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x42, 0xf8, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, - 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x52, - 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, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, - 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x52, - 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, + 0x37, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xf8, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, + 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x52, 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, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, + 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, + 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xe2, 0x02, 0x23, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, + 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/regen/ecocredit/v1beta1/events.proto b/proto/regen/ecocredit/v1beta1/events.proto index 77dc7c91bf..f1ab966b61 100644 --- a/proto/regen/ecocredit/v1beta1/events.proto +++ b/proto/regen/ecocredit/v1beta1/events.proto @@ -6,60 +6,66 @@ option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; // EventCreateClass is an event emitted when a credit class is created. message EventCreateClass { + // row_id is the id of the database row entry + uint64 row_id = 1; // class_id is the unique ID of credit class. - string class_id = 1; + string class_id = 2; // admin is the admin of the credit class. - string admin = 2; + string admin = 3; } // EventCreateProject is an event emitted when a project is created. message EventCreateProject { + // row_id is the id of the database row entry + uint64 row_id = 1; // project_id is the unique ID of the project. - string project_id = 1; + string project_id = 2; // class_id is the unique ID of credit class for this project. - string class_id = 2; + string class_id = 3; // issuer is the issuer of the credit batches for this project. - string issuer = 3; + string issuer = 4; // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - string project_location = 4; + string project_location = 5; } // EventCreateBatch is an event emitted when a credit batch is created. message EventCreateBatch { + // row_id is the id of the database row entry + uint64 row_id = 1; // class_id is the unique ID of credit class. - string class_id = 1; + string class_id = 2; // batch_denom is the unique ID of credit batch. - string batch_denom = 2; + string batch_denom = 3; // issuer is the account address of the issuer of the credit batch. - string issuer = 3; + string issuer = 4; // total_amount is the total number of credits in the credit batch. - string total_amount = 4; + string total_amount = 5; // start_date is the beginning of the period during which this credit batch // was quantified and verified. - string start_date = 5; + string start_date = 6; // end_date is the end of the period during which this credit batch was // quantified and verified. - string end_date = 6; + string end_date = 7; // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - string project_location = 7; + string project_location = 8; // project_id is the unique ID of the project this batch belongs to. - string project_id = 8; + string project_id = 9; } // EventReceive is an event emitted when credits are received either upon diff --git a/proto/regen/ecocredit/v1beta1/tx.proto b/proto/regen/ecocredit/v1beta1/tx.proto index 5de9aa4a46..9fe9b23db2 100644 --- a/proto/regen/ecocredit/v1beta1/tx.proto +++ b/proto/regen/ecocredit/v1beta1/tx.proto @@ -61,8 +61,11 @@ message MsgCreateClass { // MsgCreateClassResponse is the Msg/CreateClass response type. message MsgCreateClassResponse { + // row_id is the id of the database row entry + uint64 row_id = 1; + // class_id is the unique ID of the newly created credit class. - string class_id = 1; + string class_id = 2; } // MsgCreateProjectResponse is the Msg/CreateProject request type. @@ -96,9 +99,11 @@ message MsgCreateProject { // MsgCreateProjectResponse is the Msg/CreateProject response type. message MsgCreateProjectResponse { + // row_id is the id of the database row entry + uint64 row_id = 1; // project_id is the ID of the newly created project. - string project_id = 1; + string project_id = 2; } // MsgCreateBatch is the Msg/CreateBatch request type. @@ -152,9 +157,11 @@ message MsgCreateBatch { // MsgCreateBatchResponse is the Msg/CreateBatch response type. message MsgCreateBatchResponse { + // row_id is the id of the database row entry + uint64 row_id = 1; // batch_denom is the unique denomination ID of the newly created batch. - string batch_denom = 1; + string batch_denom = 2; } // MsgSend is the Msg/Send request type. diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index 0b1a8b5bf2..90f5ef1e8a 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -56,8 +56,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } classID := ecocredit.FormatClassID(creditType.Abbreviation, classSeq) - // TODO(Tyler): waiting for PR that should make this should return the row ID, should include in event and response. - _, err = s.stateStore.ClassInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ + rowID, err := s.stateStore.ClassInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ Name: classID, Admin: req.Admin, Metadata: req.Metadata, @@ -77,6 +76,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } err = regenCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateClass{ + RowId: rowID, ClassId: classID, Admin: req.Admin, }) @@ -84,7 +84,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass return nil, err } - return &v1beta1.MsgCreateClassResponse{ClassId: classID}, nil + return &v1beta1.MsgCreateClassResponse{RowId: rowID, ClassId: classID}, nil } // CreateProject creates a new project. @@ -117,8 +117,7 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro } } - // TODO(Tyler): update this to handle the id it returns and put it in event and response. - _, err = s.stateStore.ProjectInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ProjectInfo{ + rowID, err := s.stateStore.ProjectInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ProjectInfo{ Name: projectID, ClassId: classInfo.Id, ProjectLocation: req.ProjectLocation, @@ -129,6 +128,7 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro } if err := sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateProject{ + RowId: rowID, ClassId: classID, ProjectId: projectID, Issuer: req.Issuer, @@ -138,6 +138,7 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro } return &v1beta1.MsgCreateProjectResponse{ + RowId: rowID, ProjectId: projectID, }, nil } @@ -181,8 +182,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch return nil, err } - // TODO(Tyler): this should return the ID. we need to use it. wait for update. - id, err := s.stateStore.BatchInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.BatchInfo{ + rowID, err := s.stateStore.BatchInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.BatchInfo{ ProjectId: projectInfo.Id, BatchDenom: batchDenom, Metadata: req.Metadata, @@ -192,7 +192,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch if err != nil { return nil, err } - newBatchID := id + newBatchID := rowID tradableSupply, retiredSupply := math.NewDecFromInt64(0), math.NewDecFromInt64(0) @@ -254,8 +254,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch return nil, err } - // TODO(Tyler): put id here - return &v1beta1.MsgCreateBatchResponse{BatchDenom: batchDenom}, nil + return &v1beta1.MsgCreateBatchResponse{RowId: rowID, BatchDenom: batchDenom}, nil } // Send sends credits to a recipient. diff --git a/x/ecocredit/v1beta1/events.pb.go b/x/ecocredit/v1beta1/events.pb.go index 2d60f2d525..c95a95ff64 100644 --- a/x/ecocredit/v1beta1/events.pb.go +++ b/x/ecocredit/v1beta1/events.pb.go @@ -24,10 +24,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // EventCreateClass is an event emitted when a credit class is created. type EventCreateClass struct { + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // admin is the admin of the credit class. - Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` + Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` } func (m *EventCreateClass) Reset() { *m = EventCreateClass{} } @@ -63,6 +65,13 @@ func (m *EventCreateClass) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateClass proto.InternalMessageInfo +func (m *EventCreateClass) GetRowId() uint64 { + if m != nil { + return m.RowId + } + return 0 +} + func (m *EventCreateClass) GetClassId() string { if m != nil { return m.ClassId @@ -79,15 +88,17 @@ func (m *EventCreateClass) GetAdmin() string { // EventCreateProject is an event emitted when a project is created. type EventCreateProject struct { + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // project_id is the unique ID of the project. - ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` // class_id is the unique ID of credit class for this project. - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,3,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // issuer is the issuer of the credit batches for this project. - Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - ProjectLocation string `protobuf:"bytes,4,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` + ProjectLocation string `protobuf:"bytes,5,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` } func (m *EventCreateProject) Reset() { *m = EventCreateProject{} } @@ -123,6 +134,13 @@ func (m *EventCreateProject) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateProject proto.InternalMessageInfo +func (m *EventCreateProject) GetRowId() uint64 { + if m != nil { + return m.RowId + } + return 0 +} + func (m *EventCreateProject) GetProjectId() string { if m != nil { return m.ProjectId @@ -153,25 +171,27 @@ func (m *EventCreateProject) GetProjectLocation() string { // EventCreateBatch is an event emitted when a credit batch is created. type EventCreateBatch struct { + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // batch_denom is the unique ID of credit batch. - BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + BatchDenom string `protobuf:"bytes,3,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` // issuer is the account address of the issuer of the credit batch. - Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` // total_amount is the total number of credits in the credit batch. - TotalAmount string `protobuf:"bytes,4,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` + TotalAmount string `protobuf:"bytes,5,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` // start_date is the beginning of the period during which this credit batch // was quantified and verified. - StartDate string `protobuf:"bytes,5,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` + StartDate string `protobuf:"bytes,6,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` // end_date is the end of the period during which this credit batch was // quantified and verified. - EndDate string `protobuf:"bytes,6,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` + EndDate string `protobuf:"bytes,7,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - ProjectLocation string `protobuf:"bytes,7,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` + ProjectLocation string `protobuf:"bytes,8,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` // project_id is the unique ID of the project this batch belongs to. - ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,9,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` } func (m *EventCreateBatch) Reset() { *m = EventCreateBatch{} } @@ -207,6 +227,13 @@ func (m *EventCreateBatch) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateBatch proto.InternalMessageInfo +func (m *EventCreateBatch) GetRowId() uint64 { + if m != nil { + return m.RowId + } + return 0 +} + func (m *EventCreateBatch) GetClassId() string { if m != nil { return m.ClassId @@ -511,38 +538,39 @@ func init() { } var fileDescriptor_ead360ced581abaa = []byte{ - // 485 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xbf, 0x6e, 0x13, 0x41, - 0x10, 0xc6, 0x7d, 0x0e, 0xf1, 0x9f, 0x71, 0x48, 0xa2, 0x13, 0x82, 0x03, 0xc1, 0x01, 0x27, 0x10, - 0x50, 0xe0, 0x53, 0x44, 0x45, 0x49, 0x1c, 0x8a, 0x48, 0x14, 0x28, 0x74, 0x34, 0xd6, 0xde, 0xee, - 0xc8, 0x59, 0x38, 0xef, 0x5a, 0x7b, 0x63, 0x43, 0xc1, 0x2b, 0x20, 0xc1, 0xc3, 0xf0, 0x0e, 0x94, - 0x29, 0x29, 0x91, 0xfd, 0x22, 0x68, 0xff, 0x9c, 0x8d, 0x1d, 0x83, 0x10, 0xdd, 0xce, 0x6f, 0x3e, - 0xed, 0x7c, 0xf3, 0xdd, 0x2d, 0x3c, 0x30, 0x38, 0x42, 0x95, 0x23, 0xd7, 0xdc, 0xa0, 0x90, 0x94, - 0xcf, 0x8e, 0x0a, 0x24, 0x76, 0x94, 0xe3, 0x0c, 0x15, 0x55, 0xfd, 0x89, 0xd1, 0xa4, 0xe3, 0x1b, - 0x4e, 0xd5, 0x5f, 0xaa, 0xfa, 0x41, 0x95, 0x0d, 0xe0, 0xf0, 0xa5, 0x15, 0x0e, 0x0c, 0x32, 0xc2, - 0x41, 0xc9, 0xaa, 0x2a, 0xbe, 0x09, 0x1d, 0x6e, 0x0f, 0x43, 0x29, 0x92, 0xe8, 0x5e, 0xf4, 0xb8, - 0x7b, 0xd6, 0x76, 0xf5, 0xa9, 0x88, 0xaf, 0xc1, 0x2e, 0x13, 0x63, 0xa9, 0x92, 0xa6, 0xe3, 0xbe, - 0xc8, 0xbe, 0x46, 0x10, 0xff, 0x76, 0xcb, 0x6b, 0xa3, 0xdf, 0x21, 0xa7, 0xf8, 0x0e, 0xc0, 0xc4, - 0x1f, 0x57, 0x37, 0x75, 0x03, 0x39, 0x15, 0x6b, 0x63, 0x9a, 0xeb, 0x63, 0xae, 0x43, 0x4b, 0x56, - 0xd5, 0x14, 0x4d, 0xb2, 0xe3, 0x1a, 0xa1, 0x8a, 0x9f, 0xc0, 0x61, 0x7d, 0x63, 0xa9, 0x39, 0x23, - 0xa9, 0x55, 0x72, 0xc5, 0x29, 0x0e, 0x02, 0x7f, 0x15, 0x70, 0xf6, 0xb9, 0xb9, 0xb6, 0xd9, 0x31, - 0x23, 0x7e, 0xfe, 0xb7, 0xcd, 0xee, 0x42, 0xaf, 0xb0, 0x9a, 0xa1, 0x40, 0xa5, 0xc7, 0xc1, 0x10, - 0x38, 0x74, 0x62, 0xc9, 0x1f, 0x3d, 0xdd, 0x87, 0x3d, 0xd2, 0xc4, 0xca, 0x21, 0x1b, 0xeb, 0xa9, - 0xa2, 0xe0, 0xa7, 0xe7, 0xd8, 0x0b, 0x87, 0x6c, 0x10, 0x15, 0x31, 0x43, 0x43, 0xc1, 0x08, 0x93, - 0x5d, 0x1f, 0x84, 0x23, 0x27, 0x8c, 0xd0, 0xba, 0x42, 0x25, 0x7c, 0xb3, 0xe5, 0x5d, 0xa1, 0x12, - 0xae, 0xb5, 0x6d, 0xe1, 0xf6, 0xd6, 0x85, 0x37, 0xd2, 0xee, 0x6c, 0xa4, 0x9d, 0x7d, 0x8b, 0x60, - 0xcf, 0xe5, 0x71, 0x86, 0x1c, 0xe5, 0x0c, 0xed, 0x3e, 0x15, 0x2a, 0x81, 0x26, 0x24, 0x11, 0xaa, - 0xf8, 0x36, 0x74, 0x0d, 0x72, 0x39, 0x91, 0xa8, 0x28, 0xc4, 0xb0, 0x02, 0x9b, 0x31, 0xed, 0x5c, - 0x8a, 0xe9, 0x11, 0x1c, 0x90, 0x61, 0x82, 0x15, 0x25, 0xae, 0x27, 0xb2, 0x5f, 0xe3, 0x10, 0xca, - 0x43, 0xd8, 0x37, 0x48, 0xd2, 0xa0, 0xa8, 0x75, 0x3e, 0x98, 0xab, 0x81, 0x7a, 0x59, 0xf6, 0x09, - 0x7a, 0xc1, 0xb6, 0xa5, 0x71, 0x02, 0x6d, 0xdf, 0xaf, 0x6d, 0xd7, 0xe5, 0x3f, 0x7d, 0xc0, 0x30, - 0x28, 0x7c, 0x40, 0x5f, 0xc5, 0xb7, 0xa0, 0xb3, 0xf1, 0x33, 0x2d, 0xeb, 0x4c, 0x84, 0xe9, 0x03, - 0xa6, 0x38, 0x96, 0x36, 0x1b, 0xee, 0x4e, 0xe5, 0x72, 0xfe, 0x0a, 0xfc, 0xb7, 0x83, 0xe3, 0x37, - 0xdf, 0xe7, 0x69, 0x74, 0x31, 0x4f, 0xa3, 0x9f, 0xf3, 0x34, 0xfa, 0xb2, 0x48, 0x1b, 0x17, 0x8b, - 0xb4, 0xf1, 0x63, 0x91, 0x36, 0xde, 0x3e, 0x1f, 0x49, 0x3a, 0x9f, 0x16, 0x7d, 0xae, 0xc7, 0xb9, - 0x7b, 0xc2, 0x4f, 0x15, 0xd2, 0x07, 0x6d, 0xde, 0x87, 0xaa, 0x44, 0x31, 0x42, 0x93, 0x7f, 0xbc, - 0xfc, 0xfe, 0x8b, 0x96, 0x7b, 0xf9, 0xcf, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0xb6, 0xca, 0x79, - 0x8f, 0x21, 0x04, 0x00, 0x00, + // 508 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xbd, 0x6e, 0x13, 0x41, + 0x14, 0x85, 0xb3, 0x4e, 0xfc, 0x77, 0x1d, 0x92, 0x68, 0xc5, 0xcf, 0x82, 0x60, 0x09, 0x2b, 0x10, + 0xa1, 0xc0, 0x56, 0x44, 0x45, 0x49, 0x1c, 0x8a, 0x48, 0x14, 0xc8, 0x74, 0x69, 0xac, 0xf1, 0xcc, + 0x95, 0x33, 0xb0, 0x9e, 0xb1, 0x66, 0xaf, 0x6d, 0x0a, 0x1e, 0x82, 0x87, 0xa0, 0xe0, 0x05, 0x78, + 0x07, 0xca, 0x94, 0x94, 0xc8, 0x7e, 0x11, 0x34, 0x3f, 0xeb, 0x60, 0xe3, 0x08, 0x29, 0x9d, 0xcf, + 0xb9, 0xc7, 0x73, 0xcf, 0x7e, 0x23, 0x0d, 0x3c, 0x35, 0x38, 0x44, 0xd5, 0x41, 0xae, 0xb9, 0x41, + 0x21, 0xa9, 0x33, 0x3d, 0x1e, 0x20, 0xb1, 0xe3, 0x0e, 0x4e, 0x51, 0x51, 0xd1, 0x1e, 0x1b, 0x4d, + 0x3a, 0xbe, 0xe7, 0x52, 0xed, 0x65, 0xaa, 0x1d, 0x52, 0xd9, 0x39, 0x1c, 0xbc, 0xb5, 0xc1, 0xae, + 0x41, 0x46, 0xd8, 0xcd, 0x59, 0x51, 0xc4, 0x77, 0xa0, 0x66, 0xf4, 0xac, 0x2f, 0x45, 0x12, 0x1d, + 0x46, 0x47, 0x3b, 0xbd, 0xaa, 0xd1, 0xb3, 0x33, 0x11, 0xdf, 0x87, 0x06, 0xb7, 0x73, 0x3b, 0xa8, + 0x1c, 0x46, 0x47, 0xcd, 0x5e, 0xdd, 0xe9, 0x33, 0x11, 0xdf, 0x86, 0x2a, 0x13, 0x23, 0xa9, 0x92, + 0x6d, 0xe7, 0x7b, 0x91, 0x7d, 0x8f, 0x20, 0xfe, 0xeb, 0xf0, 0xf7, 0x46, 0x7f, 0x44, 0x4e, 0xd7, + 0x1d, 0xff, 0x08, 0x60, 0xec, 0x13, 0x57, 0x0b, 0x9a, 0xc1, 0x59, 0xdb, 0xbe, 0xbd, 0xba, 0xfd, + 0x2e, 0xd4, 0x64, 0x51, 0x4c, 0xd0, 0x24, 0x3b, 0x6e, 0x10, 0x54, 0xfc, 0x02, 0x0e, 0xca, 0x13, + 0x73, 0xcd, 0x19, 0x49, 0xad, 0x92, 0xaa, 0x4b, 0xec, 0x07, 0xff, 0x5d, 0xb0, 0xb3, 0x6f, 0x95, + 0x15, 0x0e, 0x27, 0x8c, 0xf8, 0xc5, 0x0d, 0x38, 0x3c, 0x86, 0xd6, 0xc0, 0xfe, 0xb5, 0x2f, 0x50, + 0xe9, 0x51, 0xe8, 0x09, 0xce, 0x3a, 0xb5, 0xce, 0xb5, 0x55, 0x9f, 0xc0, 0x2e, 0x69, 0x62, 0x79, + 0x9f, 0x8d, 0xf4, 0x44, 0x51, 0xa8, 0xd9, 0x72, 0xde, 0x1b, 0x67, 0x59, 0x3e, 0x05, 0x31, 0x43, + 0x7d, 0xc1, 0x08, 0x93, 0x9a, 0xe7, 0xe3, 0x9c, 0x53, 0x46, 0x68, 0x5b, 0xa1, 0x12, 0x7e, 0x58, + 0xf7, 0xad, 0x50, 0x09, 0x37, 0xda, 0xc4, 0xa1, 0xb1, 0x91, 0xc3, 0xda, 0x25, 0x34, 0xd7, 0x2e, + 0x21, 0xfb, 0x11, 0xc1, 0xae, 0xc3, 0xd4, 0x43, 0x8e, 0x72, 0x8a, 0xf6, 0x7b, 0x0a, 0x54, 0x02, + 0x8d, 0x43, 0xd4, 0xec, 0x05, 0x15, 0x3f, 0x84, 0xa6, 0x41, 0x2e, 0xc7, 0x12, 0x15, 0x95, 0x77, + 0xb9, 0x34, 0xfe, 0x8f, 0xe9, 0x39, 0xec, 0x93, 0x61, 0x82, 0x0d, 0x72, 0x2c, 0x89, 0x78, 0x5e, + 0x7b, 0xa5, 0x1d, 0xa0, 0x3c, 0x83, 0x3d, 0x83, 0x24, 0x0d, 0x8a, 0x55, 0x72, 0xb7, 0x82, 0xeb, + 0x63, 0xd9, 0x17, 0x68, 0x85, 0xda, 0xd6, 0x8d, 0x13, 0xa8, 0xfb, 0x79, 0x59, 0xbb, 0x94, 0xeb, + 0xcd, 0x2a, 0x9b, 0x2e, 0x30, 0x2c, 0xf2, 0xad, 0x83, 0x8a, 0x1f, 0x40, 0x63, 0xc9, 0xd6, 0x57, + 0x5d, 0xea, 0x4c, 0x84, 0xed, 0x5d, 0xa6, 0x38, 0xe6, 0x96, 0x0d, 0x77, 0xbf, 0xf2, 0xe5, 0xfe, + 0x2b, 0xe3, 0xc6, 0x0d, 0x4e, 0x3e, 0xfc, 0x9c, 0xa7, 0xd1, 0xe5, 0x3c, 0x8d, 0x7e, 0xcf, 0xd3, + 0xe8, 0xeb, 0x22, 0xdd, 0xba, 0x5c, 0xa4, 0x5b, 0xbf, 0x16, 0xe9, 0xd6, 0xf9, 0xeb, 0xa1, 0xa4, + 0x8b, 0xc9, 0xa0, 0xcd, 0xf5, 0xa8, 0xe3, 0xde, 0x81, 0x97, 0x0a, 0x69, 0xa6, 0xcd, 0xa7, 0xa0, + 0x72, 0x14, 0x43, 0x34, 0x9d, 0xcf, 0xff, 0x3e, 0x22, 0x83, 0x9a, 0x7b, 0x3e, 0x5e, 0xfd, 0x09, + 0x00, 0x00, 0xff, 0xff, 0xe1, 0x8e, 0x71, 0x8c, 0x66, 0x04, 0x00, 0x00, } func (m *EventCreateClass) Marshal() (dAtA []byte, err error) { @@ -570,14 +598,19 @@ func (m *EventCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Admin) i = encodeVarintEvents(dAtA, i, uint64(len(m.Admin))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if m.RowId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.RowId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -607,28 +640,33 @@ func (m *EventCreateProject) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ProjectLocation) i = encodeVarintEvents(dAtA, i, uint64(len(m.ProjectLocation))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if len(m.Issuer) > 0 { i -= len(m.Issuer) copy(dAtA[i:], m.Issuer) i = encodeVarintEvents(dAtA, i, uint64(len(m.Issuer))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if len(m.ProjectId) > 0 { i -= len(m.ProjectId) copy(dAtA[i:], m.ProjectId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ProjectId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if m.RowId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.RowId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -658,56 +696,61 @@ func (m *EventCreateBatch) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ProjectId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ProjectId))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x4a } if len(m.ProjectLocation) > 0 { i -= len(m.ProjectLocation) copy(dAtA[i:], m.ProjectLocation) i = encodeVarintEvents(dAtA, i, uint64(len(m.ProjectLocation))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x42 } if len(m.EndDate) > 0 { i -= len(m.EndDate) copy(dAtA[i:], m.EndDate) i = encodeVarintEvents(dAtA, i, uint64(len(m.EndDate))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x3a } if len(m.StartDate) > 0 { i -= len(m.StartDate) copy(dAtA[i:], m.StartDate) i = encodeVarintEvents(dAtA, i, uint64(len(m.StartDate))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 } if len(m.TotalAmount) > 0 { i -= len(m.TotalAmount) copy(dAtA[i:], m.TotalAmount) i = encodeVarintEvents(dAtA, i, uint64(len(m.TotalAmount))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if len(m.Issuer) > 0 { i -= len(m.Issuer) copy(dAtA[i:], m.Issuer) i = encodeVarintEvents(dAtA, i, uint64(len(m.Issuer))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(m.BatchDenom) > 0 { i -= len(m.BatchDenom) copy(dAtA[i:], m.BatchDenom) i = encodeVarintEvents(dAtA, i, uint64(len(m.BatchDenom))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if m.RowId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.RowId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -882,6 +925,9 @@ func (m *EventCreateClass) Size() (n int) { } var l int _ = l + if m.RowId != 0 { + n += 1 + sovEvents(uint64(m.RowId)) + } l = len(m.ClassId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -899,6 +945,9 @@ func (m *EventCreateProject) Size() (n int) { } var l int _ = l + if m.RowId != 0 { + n += 1 + sovEvents(uint64(m.RowId)) + } l = len(m.ProjectId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -924,6 +973,9 @@ func (m *EventCreateBatch) Size() (n int) { } var l int _ = l + if m.RowId != 0 { + n += 1 + sovEvents(uint64(m.RowId)) + } l = len(m.ClassId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -1070,6 +1122,25 @@ func (m *EventCreateClass) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + m.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1101,7 +1172,7 @@ func (m *EventCreateClass) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } @@ -1187,6 +1258,25 @@ func (m *EventCreateProject) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + m.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -1218,7 +1308,7 @@ func (m *EventCreateProject) Unmarshal(dAtA []byte) error { } m.ProjectId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1250,7 +1340,7 @@ func (m *EventCreateProject) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } @@ -1282,7 +1372,7 @@ func (m *EventCreateProject) Unmarshal(dAtA []byte) error { } m.Issuer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) } @@ -1368,6 +1458,25 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + m.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1399,7 +1508,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) } @@ -1431,7 +1540,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.BatchDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } @@ -1463,7 +1572,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.Issuer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TotalAmount", wireType) } @@ -1495,7 +1604,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.TotalAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StartDate", wireType) } @@ -1527,7 +1636,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.StartDate = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EndDate", wireType) } @@ -1559,7 +1668,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.EndDate = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) } @@ -1591,7 +1700,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.ProjectLocation = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } diff --git a/x/ecocredit/v1beta1/tx.pb.go b/x/ecocredit/v1beta1/tx.pb.go index 17d0b0748b..d2a7c914ed 100644 --- a/x/ecocredit/v1beta1/tx.pb.go +++ b/x/ecocredit/v1beta1/tx.pb.go @@ -107,8 +107,10 @@ func (m *MsgCreateClass) GetCreditTypeName() string { // MsgCreateClassResponse is the Msg/CreateClass response type. type MsgCreateClassResponse struct { + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of the newly created credit class. - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } func (m *MsgCreateClassResponse) Reset() { *m = MsgCreateClassResponse{} } @@ -144,6 +146,13 @@ func (m *MsgCreateClassResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateClassResponse proto.InternalMessageInfo +func (m *MsgCreateClassResponse) GetRowId() uint64 { + if m != nil { + return m.RowId + } + return 0 +} + func (m *MsgCreateClassResponse) GetClassId() string { if m != nil { return m.ClassId @@ -246,8 +255,10 @@ func (m *MsgCreateProject) GetProjectId() string { // MsgCreateProjectResponse is the Msg/CreateProject response type. type MsgCreateProjectResponse struct { + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // project_id is the ID of the newly created project. - ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` } func (m *MsgCreateProjectResponse) Reset() { *m = MsgCreateProjectResponse{} } @@ -283,6 +294,13 @@ func (m *MsgCreateProjectResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateProjectResponse proto.InternalMessageInfo +func (m *MsgCreateProjectResponse) GetRowId() uint64 { + if m != nil { + return m.RowId + } + return 0 +} + func (m *MsgCreateProjectResponse) GetProjectId() string { if m != nil { return m.ProjectId @@ -467,8 +485,10 @@ func (m *MsgCreateBatch_BatchIssuance) GetRetirementLocation() string { // MsgCreateBatchResponse is the Msg/CreateBatch response type. type MsgCreateBatchResponse struct { + // row_id is the id of the database row entry + RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // batch_denom is the unique denomination ID of the newly created batch. - BatchDenom string `protobuf:"bytes,1,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` } func (m *MsgCreateBatchResponse) Reset() { *m = MsgCreateBatchResponse{} } @@ -504,6 +524,13 @@ func (m *MsgCreateBatchResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateBatchResponse proto.InternalMessageInfo +func (m *MsgCreateBatchResponse) GetRowId() uint64 { + if m != nil { + return m.RowId + } + return 0 +} + func (m *MsgCreateBatchResponse) GetBatchDenom() string { if m != nil { return m.BatchDenom @@ -1338,70 +1365,70 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1beta1/tx.proto", fileDescriptor_a7efad3b6b8cd694) } var fileDescriptor_a7efad3b6b8cd694 = []byte{ - // 993 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xdf, 0x6f, 0xe3, 0xc4, - 0x13, 0xaf, 0x93, 0x5e, 0xd2, 0x4c, 0xbe, 0x69, 0x7b, 0xdb, 0xfb, 0x96, 0xe0, 0xa3, 0x69, 0x64, - 0x09, 0x35, 0x87, 0xc0, 0xa6, 0x3d, 0x7e, 0xa8, 0xe2, 0x01, 0x5d, 0x7b, 0x42, 0x57, 0x44, 0x10, - 0xf8, 0x0e, 0x09, 0xf1, 0x12, 0x6d, 0xec, 0xc1, 0x35, 0xc4, 0x76, 0x64, 0x6f, 0xaf, 0x77, 0x12, - 0x12, 0x6f, 0x3c, 0xdf, 0xff, 0x81, 0x04, 0xcf, 0xf7, 0x07, 0x20, 0xf1, 0x78, 0x2f, 0x48, 0xbc, - 0x81, 0x5a, 0xf1, 0x7f, 0x20, 0xef, 0xae, 0xb7, 0xd9, 0x34, 0x17, 0x27, 0x02, 0x89, 0x97, 0xa4, - 0x33, 0xfe, 0xcc, 0x67, 0x3f, 0x33, 0x99, 0x9d, 0x71, 0xa1, 0x9b, 0x62, 0x80, 0xb1, 0x83, 0x5e, - 0xe2, 0xa5, 0xe8, 0x87, 0xcc, 0x79, 0xbc, 0x3f, 0x44, 0x46, 0xf7, 0x1d, 0xf6, 0xc4, 0x1e, 0xa7, - 0x09, 0x4b, 0xc8, 0x2b, 0x1c, 0x61, 0x2b, 0x84, 0x2d, 0x11, 0xe6, 0xad, 0x20, 0x09, 0x12, 0x8e, - 0x71, 0xf2, 0xbf, 0x04, 0xdc, 0xdc, 0x0d, 0x92, 0x24, 0x18, 0xa1, 0xc3, 0xad, 0xe1, 0xd9, 0xd7, - 0x0e, 0x0b, 0x23, 0xcc, 0x18, 0x8d, 0xc6, 0x02, 0x60, 0xfd, 0x60, 0xc0, 0x7a, 0x3f, 0x0b, 0x8e, - 0x53, 0xa4, 0x0c, 0x8f, 0x47, 0x34, 0xcb, 0xc8, 0x2d, 0xb8, 0x41, 0xfd, 0x28, 0x8c, 0xdb, 0x46, - 0xd7, 0xe8, 0x35, 0x5c, 0x61, 0x90, 0x36, 0xd4, 0xc3, 0x2c, 0x3b, 0xc3, 0x34, 0x6b, 0x57, 0xba, - 0xd5, 0x5e, 0xc3, 0x2d, 0x4c, 0x62, 0xc2, 0x5a, 0x84, 0x8c, 0xfa, 0x94, 0xd1, 0x76, 0xb5, 0x6b, - 0xf4, 0xfe, 0xe7, 0x2a, 0x9b, 0xf4, 0x60, 0x53, 0xe8, 0x1c, 0xb0, 0xa7, 0x63, 0x1c, 0xc4, 0x34, - 0xc2, 0xf6, 0x2a, 0xa7, 0x5d, 0x17, 0xfe, 0x47, 0x4f, 0xc7, 0xf8, 0x29, 0x8d, 0xd0, 0xba, 0x0b, - 0xdb, 0xba, 0x0e, 0x17, 0xb3, 0x71, 0x12, 0x67, 0x48, 0x5e, 0x85, 0x35, 0x2f, 0x77, 0x0c, 0x42, - 0x5f, 0x4a, 0xaa, 0x73, 0xfb, 0xc4, 0xb7, 0x7e, 0x34, 0x60, 0x53, 0x45, 0x7d, 0x96, 0x26, 0xdf, - 0xa0, 0xc7, 0xc8, 0x36, 0xd4, 0x84, 0x34, 0x89, 0x96, 0x96, 0xc6, 0x53, 0xd1, 0x78, 0xe6, 0xa6, - 0x70, 0x07, 0x36, 0xc7, 0x82, 0x79, 0x30, 0x4a, 0x3c, 0xca, 0xc2, 0x24, 0x96, 0x29, 0x6c, 0x48, - 0xff, 0x27, 0xd2, 0x4d, 0x76, 0x00, 0x0a, 0x68, 0xe8, 0xb7, 0x6f, 0x70, 0x50, 0x43, 0x7a, 0x4e, - 0x7c, 0xeb, 0x10, 0xda, 0xd3, 0x62, 0x55, 0x92, 0x7a, 0xa8, 0x31, 0x1d, 0xfa, 0x57, 0x75, 0xe2, - 0x67, 0x3a, 0xa2, 0xcc, 0x3b, 0x7d, 0x69, 0x9a, 0x3a, 0x53, 0x65, 0x8a, 0x89, 0x7c, 0x0e, 0x6b, - 0x39, 0x90, 0xc6, 0x1e, 0xb6, 0xab, 0xdd, 0x6a, 0xaf, 0x79, 0xf0, 0xae, 0xfd, 0x92, 0x9e, 0xb2, - 0xf5, 0x13, 0x6d, 0xfe, 0x79, 0x22, 0x83, 0x5d, 0x45, 0xa3, 0x55, 0x6f, 0x75, 0xaa, 0x7a, 0x1f, - 0x02, 0x64, 0x8c, 0xa6, 0x6c, 0xe0, 0x53, 0x86, 0xbc, 0x24, 0xcd, 0x03, 0xd3, 0x16, 0x5d, 0x69, - 0x17, 0x5d, 0x69, 0x3f, 0x2a, 0xba, 0xf2, 0x68, 0xf5, 0xd9, 0x1f, 0xbb, 0x86, 0xdb, 0xe0, 0x31, - 0xf7, 0x29, 0x43, 0xf2, 0x01, 0xac, 0x61, 0xec, 0x8b, 0xf0, 0xda, 0x82, 0xe1, 0x75, 0x8c, 0xfd, - 0x3c, 0xd8, 0xfc, 0xc9, 0x80, 0x96, 0xa6, 0x9a, 0xbc, 0x06, 0x8d, 0x14, 0xbd, 0x70, 0x1c, 0x62, - 0xcc, 0x8a, 0x32, 0x2b, 0x07, 0xd9, 0x83, 0x0d, 0x96, 0x52, 0x9f, 0x0e, 0x47, 0x38, 0xa0, 0x51, - 0x72, 0x16, 0x33, 0x59, 0xc0, 0xf5, 0xc2, 0x7d, 0x8f, 0x7b, 0xc9, 0xeb, 0xb0, 0x9e, 0x22, 0x0b, - 0x53, 0xf4, 0x0b, 0x5c, 0x95, 0xe3, 0x5a, 0xd2, 0x2b, 0x61, 0x0e, 0x6c, 0x09, 0x47, 0x84, 0xf1, - 0xb5, 0xf6, 0x21, 0x57, 0x8f, 0x8a, 0x0e, 0xb2, 0x0e, 0x27, 0x6e, 0x01, 0x17, 0xae, 0x1a, 0x64, - 0x17, 0x9a, 0xc3, 0xdc, 0x31, 0xf0, 0x31, 0x4e, 0x22, 0x29, 0x1d, 0xb8, 0xeb, 0x7e, 0xee, 0xb1, - 0x9e, 0x57, 0xa0, 0xde, 0xcf, 0x82, 0x87, 0x18, 0xfb, 0x79, 0x6f, 0x64, 0x18, 0xfb, 0x57, 0xbd, - 0x21, 0x2c, 0x3d, 0xfb, 0xca, 0x74, 0xf6, 0x1f, 0x41, 0x5d, 0x34, 0x40, 0x26, 0x3b, 0xe3, 0xcd, - 0x79, 0x9d, 0x91, 0x1f, 0x64, 0xe7, 0x1f, 0xc7, 0x22, 0xc6, 0x2d, 0x82, 0xcd, 0x9f, 0x0d, 0x68, - 0x4e, 0x3c, 0x28, 0x95, 0xfe, 0xdf, 0x97, 0xfd, 0x26, 0x6c, 0xc8, 0x8c, 0x8a, 0x7a, 0x5b, 0xbf, - 0x19, 0xd0, 0xe8, 0x67, 0x81, 0xcb, 0xc1, 0x79, 0x41, 0x4f, 0x93, 0xd1, 0x44, 0x41, 0x85, 0x45, - 0x3e, 0xbe, 0x2a, 0x59, 0x85, 0x97, 0xec, 0xed, 0x79, 0x25, 0x13, 0x64, 0xb6, 0xf8, 0x9a, 0x2e, - 0x5b, 0x7e, 0x8d, 0x94, 0x54, 0x91, 0x96, 0xb2, 0xcd, 0x07, 0xd0, 0xd2, 0xa2, 0xca, 0x6b, 0xba, - 0x0d, 0x35, 0xad, 0x94, 0xd2, 0xb2, 0xb6, 0xe0, 0xa6, 0x52, 0xa2, 0x92, 0x7d, 0x2e, 0x92, 0x3d, - 0xce, 0xaf, 0xc8, 0xe8, 0x5f, 0x4a, 0x56, 0x90, 0xd9, 0xe2, 0xeb, 0x5a, 0x8f, 0x3c, 0x80, 0x96, - 0xf6, 0xe4, 0x9f, 0x26, 0x24, 0xc8, 0x54, 0x42, 0x1e, 0x6c, 0xf5, 0xb3, 0xe0, 0x8b, 0xb1, 0x5f, - 0x6c, 0x93, 0x7b, 0x7c, 0x89, 0xcd, 0x5e, 0x6d, 0x73, 0x16, 0xc3, 0x6d, 0x68, 0xc4, 0x78, 0x3e, - 0x10, 0x41, 0xf2, 0x47, 0x89, 0xf1, 0x9c, 0xb3, 0x59, 0x3b, 0x70, 0x7b, 0xc6, 0x21, 0x4a, 0xc3, - 0x10, 0xfe, 0xaf, 0x3f, 0x3e, 0x91, 0x0b, 0x73, 0x69, 0x15, 0x13, 0xbb, 0xb7, 0xaa, 0xed, 0x5e, - 0x6b, 0x17, 0x76, 0x66, 0x9e, 0xa1, 0x44, 0x20, 0x1f, 0x28, 0x13, 0x80, 0x7e, 0x31, 0x99, 0x97, - 0x56, 0x31, 0x67, 0x49, 0x5a, 0x5d, 0xe8, 0xcc, 0x3e, 0xa6, 0x10, 0x72, 0xf0, 0x4b, 0x1d, 0xaa, - 0xfd, 0x2c, 0x20, 0x01, 0x34, 0x27, 0x5f, 0x36, 0xf6, 0xca, 0x97, 0x0f, 0x07, 0x9a, 0xce, 0x82, - 0x40, 0x35, 0x30, 0x23, 0x68, 0xe9, 0xef, 0x05, 0x77, 0xca, 0x19, 0x24, 0xd4, 0xdc, 0x5f, 0x18, - 0xaa, 0x8e, 0x53, 0x79, 0x89, 0xed, 0xbc, 0xb7, 0xe0, 0x52, 0x5d, 0x24, 0x2f, 0x7d, 0x11, 0xb8, - 0xb0, 0xca, 0x67, 0x7c, 0xb7, 0x6c, 0x38, 0x9b, 0xbd, 0x32, 0x84, 0xe2, 0xfc, 0x12, 0x6a, 0x72, - 0xd0, 0x59, 0xe5, 0xf3, 0xcb, 0x7c, 0xa3, 0x1c, 0x33, 0xc9, 0x2c, 0xa7, 0x8a, 0x55, 0x3e, 0x2c, - 0xe6, 0x33, 0xeb, 0x57, 0x9c, 0x3c, 0x86, 0xcd, 0x6b, 0xf7, 0x7b, 0xee, 0xc2, 0x9a, 0x46, 0x9b, - 0xef, 0x2c, 0x83, 0x56, 0xe7, 0x7e, 0x07, 0x64, 0xc6, 0x9d, 0xb6, 0x17, 0xe4, 0x92, 0x78, 0xf3, - 0xbd, 0xe5, 0xf0, 0xea, 0xf4, 0xef, 0x61, 0x6b, 0xd6, 0x65, 0x76, 0x16, 0xa4, 0x2b, 0x02, 0xcc, - 0xf7, 0x97, 0x0c, 0x28, 0x04, 0x1c, 0x3d, 0xfc, 0xf5, 0xa2, 0x63, 0xbc, 0xb8, 0xe8, 0x18, 0x7f, - 0x5e, 0x74, 0x8c, 0x67, 0x97, 0x9d, 0x95, 0x17, 0x97, 0x9d, 0x95, 0xdf, 0x2f, 0x3b, 0x2b, 0x5f, - 0x1d, 0x06, 0x21, 0x3b, 0x3d, 0x1b, 0xda, 0x5e, 0x12, 0x39, 0x9c, 0xfc, 0xad, 0x18, 0xd9, 0x79, - 0x92, 0x7e, 0x2b, 0xad, 0x11, 0xfa, 0x01, 0xa6, 0xce, 0x93, 0xeb, 0xff, 0xde, 0x0c, 0x6b, 0xfc, - 0x55, 0xee, 0xee, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xce, 0x80, 0xf6, 0x00, 0x0d, 0x00, - 0x00, + // 1008 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0xaf, 0x93, 0x34, 0x69, 0x5e, 0x48, 0xdb, 0x9d, 0xee, 0x96, 0xe0, 0xa5, 0x69, 0x64, 0x09, + 0x35, 0x8b, 0xc0, 0xa6, 0xe5, 0x9f, 0x10, 0x07, 0xb4, 0xed, 0x0a, 0x6d, 0x56, 0x04, 0x15, 0xef, + 0x22, 0x21, 0x2e, 0xd1, 0xc4, 0x7e, 0xb8, 0x86, 0xd8, 0x13, 0xd9, 0xd3, 0xcd, 0xae, 0x84, 0xc4, + 0x8d, 0xf3, 0x7e, 0x0f, 0x24, 0x38, 0xef, 0x07, 0x40, 0xe2, 0xb8, 0x17, 0x24, 0x6e, 0xa0, 0x56, + 0x7c, 0x0f, 0xe4, 0x99, 0xb1, 0x1b, 0xa7, 0xd9, 0x38, 0x11, 0x48, 0x5c, 0xe2, 0xbe, 0x37, 0xbf, + 0xf7, 0x9b, 0xdf, 0x7b, 0x7e, 0x33, 0xcf, 0x85, 0x4e, 0x84, 0x1e, 0x86, 0x16, 0x3a, 0xcc, 0x89, + 0xd0, 0xf5, 0xb9, 0xf5, 0xf8, 0x70, 0x88, 0x9c, 0x1e, 0x5a, 0xfc, 0x89, 0x39, 0x8e, 0x18, 0x67, + 0xe4, 0x55, 0x81, 0x30, 0x33, 0x84, 0xa9, 0x10, 0xfa, 0x4d, 0x8f, 0x79, 0x4c, 0x60, 0xac, 0xe4, + 0x2f, 0x09, 0xd7, 0xf7, 0x3d, 0xc6, 0xbc, 0x11, 0x5a, 0xc2, 0x1a, 0x9e, 0x7f, 0x63, 0x71, 0x3f, + 0xc0, 0x98, 0xd3, 0x60, 0x2c, 0x01, 0xc6, 0x8f, 0x1a, 0x6c, 0xf6, 0x63, 0xef, 0x24, 0x42, 0xca, + 0xf1, 0x64, 0x44, 0xe3, 0x98, 0xdc, 0x84, 0x75, 0xea, 0x06, 0x7e, 0xd8, 0xd2, 0x3a, 0x5a, 0xb7, + 0x6e, 0x4b, 0x83, 0xb4, 0xa0, 0xe6, 0xc7, 0xf1, 0x39, 0x46, 0x71, 0xab, 0xd4, 0x29, 0x77, 0xeb, + 0x76, 0x6a, 0x12, 0x1d, 0x36, 0x02, 0xe4, 0xd4, 0xa5, 0x9c, 0xb6, 0xca, 0x1d, 0xad, 0xfb, 0x8a, + 0x9d, 0xd9, 0xa4, 0x0b, 0xdb, 0x52, 0xe7, 0x80, 0x3f, 0x1d, 0xe3, 0x20, 0xa4, 0x01, 0xb6, 0x2a, + 0x82, 0x76, 0x53, 0xfa, 0x1f, 0x3d, 0x1d, 0xe3, 0xe7, 0x34, 0x40, 0xe3, 0x01, 0xec, 0xe6, 0x75, + 0xd8, 0x18, 0x8f, 0x59, 0x18, 0x23, 0xb9, 0x05, 0xd5, 0x88, 0x4d, 0x06, 0xbe, 0x2b, 0x04, 0x55, + 0xec, 0xf5, 0x88, 0x4d, 0x7a, 0x2e, 0x79, 0x0d, 0x36, 0x9c, 0x04, 0x97, 0x2c, 0x94, 0x04, 0x65, + 0x4d, 0xd8, 0x3d, 0xd7, 0xf8, 0x49, 0x83, 0xed, 0x8c, 0xec, 0x34, 0x62, 0xdf, 0xa2, 0xc3, 0xc9, + 0x2e, 0x54, 0xa5, 0x62, 0x95, 0x97, 0xb2, 0x16, 0xf0, 0x2c, 0xcc, 0xec, 0x0e, 0x6c, 0x8f, 0x25, + 0xf3, 0x60, 0xc4, 0x1c, 0xca, 0x7d, 0x16, 0xaa, 0xcc, 0xb6, 0x94, 0xff, 0x33, 0xe5, 0x26, 0x7b, + 0x00, 0x29, 0xd4, 0x77, 0x5b, 0xeb, 0x02, 0x54, 0x57, 0x9e, 0x9e, 0x6b, 0x9c, 0x42, 0x6b, 0x56, + 0x6c, 0x51, 0xee, 0x79, 0xc6, 0xd2, 0x2c, 0xe3, 0xdf, 0xe5, 0xa9, 0x97, 0x7a, 0x4c, 0xb9, 0x73, + 0xf6, 0xd2, 0xec, 0x17, 0x33, 0x91, 0x2f, 0x60, 0x23, 0x01, 0xd2, 0xd0, 0xc1, 0x56, 0xb9, 0x53, + 0xee, 0x36, 0x8e, 0xde, 0x37, 0x5f, 0xd2, 0x81, 0x66, 0x7e, 0x47, 0x53, 0xfc, 0xf6, 0x54, 0xb0, + 0x9d, 0xd1, 0xe4, 0x8a, 0x5a, 0x99, 0x29, 0xea, 0x27, 0x00, 0x31, 0xa7, 0x11, 0x1f, 0xb8, 0x94, + 0xa3, 0xa8, 0x54, 0xe3, 0x48, 0x37, 0x65, 0x0f, 0x9b, 0x69, 0x0f, 0x9b, 0x8f, 0xd2, 0x1e, 0x3e, + 0xae, 0x3c, 0xfb, 0x73, 0x5f, 0xb3, 0xeb, 0x22, 0xe6, 0x1e, 0xe5, 0x48, 0x3e, 0x86, 0x0d, 0x0c, + 0x5d, 0x19, 0x5e, 0x5d, 0x32, 0xbc, 0x86, 0xa1, 0x9b, 0x04, 0xeb, 0x3f, 0x6b, 0xd0, 0xcc, 0xa9, + 0x26, 0xaf, 0x43, 0x3d, 0x42, 0xc7, 0x1f, 0xfb, 0x18, 0x72, 0x55, 0xb8, 0x2b, 0x07, 0x39, 0x80, + 0x2d, 0x1e, 0x51, 0x97, 0x0e, 0x47, 0x38, 0xa0, 0x01, 0x3b, 0x0f, 0xb9, 0x2a, 0xe0, 0x66, 0xea, + 0xbe, 0x2b, 0xbc, 0xe4, 0x0d, 0xd8, 0x8c, 0x90, 0xfb, 0x11, 0xba, 0x29, 0xae, 0x2c, 0x70, 0x4d, + 0xe5, 0x55, 0x30, 0x0b, 0x76, 0xa4, 0x23, 0xc0, 0xf0, 0x5a, 0x57, 0x91, 0xab, 0xa5, 0xb4, 0xb1, + 0x8c, 0xd3, 0xa9, 0x33, 0x23, 0x84, 0x17, 0xf5, 0xcd, 0x3e, 0x34, 0x86, 0x09, 0x6e, 0xe0, 0x62, + 0xc8, 0x02, 0xa5, 0x16, 0x84, 0xeb, 0x5e, 0xe2, 0x31, 0x9e, 0x97, 0xa0, 0xd6, 0x8f, 0xbd, 0x87, + 0x18, 0xba, 0x49, 0xcb, 0xc4, 0x18, 0xba, 0x57, 0x2d, 0x23, 0xad, 0x7c, 0x51, 0x4a, 0xb3, 0x45, + 0xf9, 0x14, 0x6a, 0xb2, 0x2f, 0x62, 0xd5, 0x30, 0x6f, 0x2d, 0x6a, 0x98, 0x64, 0x23, 0x33, 0xf9, + 0x39, 0x91, 0x31, 0x76, 0x1a, 0xac, 0xff, 0xa2, 0x41, 0x63, 0x6a, 0x61, 0x56, 0xba, 0x36, 0x2b, + 0xfd, 0xff, 0x7f, 0x1b, 0x37, 0x60, 0x4b, 0x65, 0x94, 0xbe, 0x06, 0xe3, 0x77, 0x0d, 0xea, 0xfd, + 0xd8, 0xb3, 0x05, 0x38, 0x29, 0xe8, 0x19, 0x1b, 0x4d, 0x15, 0x54, 0x5a, 0xe4, 0xc1, 0x55, 0xc9, + 0x4a, 0xa2, 0x64, 0xef, 0x2c, 0x2a, 0x99, 0x24, 0x33, 0xe5, 0x63, 0xb6, 0x6c, 0xc9, 0xe9, 0xca, + 0xa4, 0xca, 0xb4, 0x32, 0x5b, 0xbf, 0x0f, 0xcd, 0x5c, 0x54, 0x71, 0x4d, 0x77, 0xa1, 0x9a, 0x2b, + 0xa5, 0xb2, 0x8c, 0x1d, 0xb8, 0x91, 0x29, 0xc9, 0x92, 0x7d, 0x2e, 0x93, 0x3d, 0x49, 0x4e, 0xce, + 0xe8, 0x3f, 0x4a, 0x56, 0x92, 0x99, 0xf2, 0x71, 0xad, 0x47, 0xee, 0x43, 0x33, 0xb7, 0xf2, 0x6f, + 0x13, 0x92, 0x64, 0x59, 0x42, 0x0e, 0xec, 0xf4, 0x63, 0xef, 0xcb, 0xb1, 0x9b, 0x8e, 0xa4, 0xbb, + 0x62, 0x12, 0xce, 0x9f, 0x8f, 0x0b, 0xc6, 0xc8, 0x6d, 0xa8, 0x87, 0x38, 0x19, 0xc8, 0x20, 0xf5, + 0x52, 0x42, 0x9c, 0x08, 0x36, 0x63, 0x0f, 0x6e, 0xcf, 0xd9, 0x24, 0xd3, 0x30, 0x84, 0x5b, 0xf9, + 0xe5, 0x9e, 0x9a, 0xba, 0x2b, 0xab, 0x98, 0x1a, 0xe0, 0xe5, 0xdc, 0x00, 0x37, 0xf6, 0x61, 0x6f, + 0xee, 0x1e, 0x99, 0x08, 0x14, 0xf7, 0xcc, 0x14, 0xa0, 0x9f, 0x5e, 0xd8, 0x2b, 0xab, 0x58, 0x30, + 0x52, 0x8d, 0x0e, 0xb4, 0xe7, 0x6f, 0x93, 0x0a, 0x39, 0xfa, 0xb5, 0x06, 0xe5, 0x7e, 0xec, 0x11, + 0x0f, 0x1a, 0xd3, 0x5f, 0x2c, 0x07, 0xc5, 0x33, 0x49, 0x00, 0x75, 0x6b, 0x49, 0x60, 0x76, 0x8f, + 0x06, 0xd0, 0xcc, 0x7f, 0x45, 0xdc, 0x29, 0x66, 0x50, 0x50, 0xfd, 0x70, 0x69, 0x68, 0xb6, 0x5d, + 0x96, 0x97, 0x1c, 0xda, 0x07, 0x4b, 0xce, 0xda, 0x65, 0xf2, 0xca, 0xcf, 0x07, 0x1b, 0x2a, 0xe2, + 0x8e, 0xef, 0x14, 0x5d, 0xce, 0x7a, 0xb7, 0x08, 0x91, 0x71, 0x7e, 0x05, 0x55, 0x75, 0xd1, 0x19, + 0xc5, 0xf7, 0x97, 0xfe, 0x66, 0x31, 0x66, 0x9a, 0x59, 0xdd, 0x2a, 0x46, 0xf1, 0x65, 0xb1, 0x98, + 0x39, 0x7f, 0xc4, 0xc9, 0x63, 0xd8, 0xbe, 0x76, 0xbe, 0x17, 0x0e, 0xac, 0x59, 0xb4, 0xfe, 0xde, + 0x2a, 0xe8, 0x6c, 0xdf, 0xef, 0x81, 0xcc, 0x39, 0xd3, 0xe6, 0x92, 0x5c, 0x0a, 0xaf, 0x7f, 0xb0, + 0x1a, 0x3e, 0xdb, 0xfd, 0x07, 0xd8, 0x99, 0x77, 0x98, 0xad, 0x25, 0xe9, 0xd2, 0x00, 0xfd, 0xc3, + 0x15, 0x03, 0x52, 0x01, 0xc7, 0x0f, 0x7f, 0xbb, 0x68, 0x6b, 0x2f, 0x2e, 0xda, 0xda, 0x5f, 0x17, + 0x6d, 0xed, 0xd9, 0x65, 0x7b, 0xed, 0xc5, 0x65, 0x7b, 0xed, 0x8f, 0xcb, 0xf6, 0xda, 0xd7, 0x1f, + 0x79, 0x3e, 0x3f, 0x3b, 0x1f, 0x9a, 0x0e, 0x0b, 0x2c, 0x41, 0xfe, 0x76, 0x88, 0x7c, 0xc2, 0xa2, + 0xef, 0x94, 0x35, 0x42, 0xd7, 0xc3, 0xc8, 0x7a, 0x72, 0xfd, 0x7f, 0xa4, 0x61, 0x55, 0x7c, 0xe1, + 0xbd, 0xfb, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x29, 0x06, 0x13, 0xc8, 0x45, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1880,7 +1907,12 @@ func (m *MsgCreateClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) copy(dAtA[i:], m.ClassId) i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if m.RowId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RowId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -1968,7 +2000,12 @@ func (m *MsgCreateProjectResponse) MarshalToSizedBuffer(dAtA []byte) (int, error copy(dAtA[i:], m.ProjectId) i = encodeVarintTx(dAtA, i, uint64(len(m.ProjectId))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if m.RowId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RowId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -2127,7 +2164,12 @@ func (m *MsgCreateBatchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) copy(dAtA[i:], m.BatchDenom) i = encodeVarintTx(dAtA, i, uint64(len(m.BatchDenom))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + if m.RowId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RowId)) + i-- + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -2719,6 +2761,9 @@ func (m *MsgCreateClassResponse) Size() (n int) { } var l int _ = l + if m.RowId != 0 { + n += 1 + sovTx(uint64(m.RowId)) + } l = len(m.ClassId) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -2761,6 +2806,9 @@ func (m *MsgCreateProjectResponse) Size() (n int) { } var l int _ = l + if m.RowId != 0 { + n += 1 + sovTx(uint64(m.RowId)) + } l = len(m.ProjectId) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -2834,6 +2882,9 @@ func (m *MsgCreateBatchResponse) Size() (n int) { } var l int _ = l + if m.RowId != 0 { + n += 1 + sovTx(uint64(m.RowId)) + } l = len(m.BatchDenom) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -3303,6 +3354,25 @@ func (m *MsgCreateClassResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + m.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -3603,6 +3673,25 @@ func (m *MsgCreateProjectResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + m.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -4126,6 +4215,25 @@ func (m *MsgCreateBatchResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) + } + m.RowId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RowId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) } From 8b83dd1701707a0ffd146cd076e708d514991901 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 14:14:20 -0800 Subject: [PATCH 06/31] fix: formatclassid compatability --- x/ecocredit/denom_test.go | 4 ++-- x/ecocredit/server/msg_server.go | 2 +- x/ecocredit/simulation/genesis.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/x/ecocredit/denom_test.go b/x/ecocredit/denom_test.go index 253f52cee9..163d7a7706 100644 --- a/x/ecocredit/denom_test.go +++ b/x/ecocredit/denom_test.go @@ -20,7 +20,7 @@ func testValidateFormatClassID(t *rapid.T) { creditType := genCreditType.Draw(t, "creditType").(*CreditType) classSeqNo := rapid.Uint64().Draw(t, "classSeqNo").(uint64) - classId := FormatClassID(*creditType, classSeqNo) + classId := FormatClassID(creditType.Abbreviation, classSeqNo) err := ValidateClassID(classId) require.NoError(t, err) @@ -39,7 +39,7 @@ func testValidateFormatDenom(t *rapid.T) { startDate := genTime.Draw(t, "startDate").(*time.Time) endDate := genTime.Draw(t, "endDate").(*time.Time) - classId := FormatClassID(*creditType, classSeqNo) + classId := FormatClassID(creditType.Abbreviation, classSeqNo) denom, err := FormatDenom(classId, batchSeqNo, startDate, endDate) require.NoError(t, err) diff --git a/x/ecocredit/server/msg_server.go b/x/ecocredit/server/msg_server.go index ca9b1b7c75..e9874facd9 100644 --- a/x/ecocredit/server/msg_server.go +++ b/x/ecocredit/server/msg_server.go @@ -52,7 +52,7 @@ func (s serverImpl) CreateClass(goCtx context.Context, req *ecocredit.MsgCreateC return nil, err } - classID := ecocredit.FormatClassID(creditType, classSeqNo) + classID := ecocredit.FormatClassID(creditType.Abbreviation, classSeqNo) err = s.classInfoTable.Create(ctx, &ecocredit.ClassInfo{ ClassId: classID, diff --git a/x/ecocredit/simulation/genesis.go b/x/ecocredit/simulation/genesis.go index c9baaa2da6..bdc3dcffb3 100644 --- a/x/ecocredit/simulation/genesis.go +++ b/x/ecocredit/simulation/genesis.go @@ -72,7 +72,7 @@ func genClasses(r *rand.Rand, accounts []simtypes.Account, creditTypes []*ecocre for i := 1; i < 4; i++ { creditType := creditTypes[r.Intn(len(creditTypes))] classes[i-1] = &ecocredit.ClassInfo{ - ClassId: ecocredit.FormatClassID(*creditType, uint64(i)), + ClassId: ecocredit.FormatClassID(creditType.Abbreviation, uint64(i)), Admin: accounts[0].Address.String(), Issuers: []string{accounts[0].Address.String(), accounts[1].Address.String(), accounts[2].Address.String()}, Metadata: []byte(simtypes.RandStringOfLength(r, simtypes.RandIntBetween(r, 10, 100))), From 1e0a2b983562231a58bafdc4db95d73f5521f3e4 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Mon, 7 Feb 2022 22:19:52 -0800 Subject: [PATCH 07/31] Update x/ecocredit/server/core/msg_server.go Co-authored-by: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> --- x/ecocredit/server/core/msg_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index 90f5ef1e8a..73aee8f04e 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -916,7 +916,7 @@ func (s serverImpl) isCreatorAllowListed(ctx types.Context, allowlist []string, return false } -// AssertClassIssuer makes sure that the issuer is part of issuers of given classID. +// assertClassIssuer makes sure that the issuer is part of issuers of given classID. // Returns ErrUnauthorized otherwise. func (s serverImpl) assertClassIssuer(goCtx context.Context, classID, issuer string) error { it, err := s.stateStore.ClassIssuerStore().List(goCtx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classID)) From 20695f8b260b3b738107f25c93d8f82a5d6a3602 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 22:29:58 -0800 Subject: [PATCH 08/31] chore: address review + switch remaining string addr to bytes --- .../ecocredit/v1beta1/state.cosmos_orm.go | 12 +- api/regen/ecocredit/v1beta1/state.pulsar.go | 72 +++++---- proto/regen/ecocredit/v1beta1/state.proto | 4 +- x/data/go.mod | 3 +- x/data/go.sum | 11 +- x/ecocredit/server/core/msg_server.go | 49 +++--- x/ecocredit/v1beta1/state.pb.go | 151 +++++++++--------- 7 files changed, 162 insertions(+), 140 deletions(-) diff --git a/api/regen/ecocredit/v1beta1/state.cosmos_orm.go b/api/regen/ecocredit/v1beta1/state.cosmos_orm.go index 350610ef0c..b7f941922d 100644 --- a/api/regen/ecocredit/v1beta1/state.cosmos_orm.go +++ b/api/regen/ecocredit/v1beta1/state.cosmos_orm.go @@ -233,7 +233,7 @@ func (x ClassInfoAdminIndexKey) id() uint32 { return 2 } func (x ClassInfoAdminIndexKey) values() []interface{} { return x.vs } func (x ClassInfoAdminIndexKey) classInfoIndexKey() {} -func (this ClassInfoAdminIndexKey) WithAdmin(admin string) ClassInfoAdminIndexKey { +func (this ClassInfoAdminIndexKey) WithAdmin(admin []byte) ClassInfoAdminIndexKey { this.vs = []interface{}{admin} return this } @@ -346,9 +346,9 @@ type ClassIssuerStore interface { Update(ctx context.Context, classIssuer *ClassIssuer) error Save(ctx context.Context, classIssuer *ClassIssuer) error Delete(ctx context.Context, classIssuer *ClassIssuer) error - Has(ctx context.Context, class_id string, issuer string) (found bool, err error) + Has(ctx context.Context, class_id string, issuer []byte) (found bool, err error) // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. - Get(ctx context.Context, class_id string, issuer string) (*ClassIssuer, error) + Get(ctx context.Context, class_id string, issuer []byte) (*ClassIssuer, error) List(ctx context.Context, prefixKey ClassIssuerIndexKey, opts ...ormlist.Option) (ClassIssuerIterator, error) ListRange(ctx context.Context, from, to ClassIssuerIndexKey, opts ...ormlist.Option) (ClassIssuerIterator, error) DeleteBy(ctx context.Context, prefixKey ClassIssuerIndexKey) error @@ -389,7 +389,7 @@ func (this ClassIssuerClassIdIssuerIndexKey) WithClassId(class_id string) ClassI return this } -func (this ClassIssuerClassIdIssuerIndexKey) WithClassIdIssuer(class_id string, issuer string) ClassIssuerClassIdIssuerIndexKey { +func (this ClassIssuerClassIdIssuerIndexKey) WithClassIdIssuer(class_id string, issuer []byte) ClassIssuerClassIdIssuerIndexKey { this.vs = []interface{}{class_id, issuer} return this } @@ -414,11 +414,11 @@ func (this classIssuerStore) Delete(ctx context.Context, classIssuer *ClassIssue return this.table.Delete(ctx, classIssuer) } -func (this classIssuerStore) Has(ctx context.Context, class_id string, issuer string) (found bool, err error) { +func (this classIssuerStore) Has(ctx context.Context, class_id string, issuer []byte) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, class_id, issuer) } -func (this classIssuerStore) Get(ctx context.Context, class_id string, issuer string) (*ClassIssuer, error) { +func (this classIssuerStore) Get(ctx context.Context, class_id string, issuer []byte) (*ClassIssuer, error) { var classIssuer ClassIssuer found, err := this.table.PrimaryKey().Get(ctx, &classIssuer, class_id, issuer) if err != nil { diff --git a/api/regen/ecocredit/v1beta1/state.pulsar.go b/api/regen/ecocredit/v1beta1/state.pulsar.go index b07815e055..0e5df0f167 100644 --- a/api/regen/ecocredit/v1beta1/state.pulsar.go +++ b/api/regen/ecocredit/v1beta1/state.pulsar.go @@ -706,8 +706,8 @@ func (x *fastReflection_ClassInfo) Range(f func(protoreflect.FieldDescriptor, pr return } } - if x.Admin != "" { - value := protoreflect.ValueOfString(x.Admin) + if len(x.Admin) != 0 { + value := protoreflect.ValueOfBytes(x.Admin) if !f(fd_ClassInfo_admin, value) { return } @@ -744,7 +744,7 @@ func (x *fastReflection_ClassInfo) Has(fd protoreflect.FieldDescriptor) bool { case "regen.ecocredit.v1beta1.ClassInfo.name": return x.Name != "" case "regen.ecocredit.v1beta1.ClassInfo.admin": - return x.Admin != "" + return len(x.Admin) != 0 case "regen.ecocredit.v1beta1.ClassInfo.metadata": return len(x.Metadata) != 0 case "regen.ecocredit.v1beta1.ClassInfo.credit_type": @@ -770,7 +770,7 @@ func (x *fastReflection_ClassInfo) Clear(fd protoreflect.FieldDescriptor) { case "regen.ecocredit.v1beta1.ClassInfo.name": x.Name = "" case "regen.ecocredit.v1beta1.ClassInfo.admin": - x.Admin = "" + x.Admin = nil case "regen.ecocredit.v1beta1.ClassInfo.metadata": x.Metadata = nil case "regen.ecocredit.v1beta1.ClassInfo.credit_type": @@ -799,7 +799,7 @@ func (x *fastReflection_ClassInfo) Get(descriptor protoreflect.FieldDescriptor) return protoreflect.ValueOfString(value) case "regen.ecocredit.v1beta1.ClassInfo.admin": value := x.Admin - return protoreflect.ValueOfString(value) + return protoreflect.ValueOfBytes(value) case "regen.ecocredit.v1beta1.ClassInfo.metadata": value := x.Metadata return protoreflect.ValueOfBytes(value) @@ -831,7 +831,7 @@ func (x *fastReflection_ClassInfo) Set(fd protoreflect.FieldDescriptor, value pr case "regen.ecocredit.v1beta1.ClassInfo.name": x.Name = value.Interface().(string) case "regen.ecocredit.v1beta1.ClassInfo.admin": - x.Admin = value.Interface().(string) + x.Admin = value.Bytes() case "regen.ecocredit.v1beta1.ClassInfo.metadata": x.Metadata = value.Bytes() case "regen.ecocredit.v1beta1.ClassInfo.credit_type": @@ -884,7 +884,7 @@ func (x *fastReflection_ClassInfo) NewField(fd protoreflect.FieldDescriptor) pro case "regen.ecocredit.v1beta1.ClassInfo.name": return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.ClassInfo.admin": - return protoreflect.ValueOfString("") + return protoreflect.ValueOfBytes(nil) case "regen.ecocredit.v1beta1.ClassInfo.metadata": return protoreflect.ValueOfBytes(nil) case "regen.ecocredit.v1beta1.ClassInfo.credit_type": @@ -1143,7 +1143,7 @@ func (x *fastReflection_ClassInfo) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1153,23 +1153,25 @@ func (x *fastReflection_ClassInfo) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen 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.Admin = string(dAtA[iNdEx:postIndex]) + x.Admin = append(x.Admin[:0], dAtA[iNdEx:postIndex]...) + if x.Admin == nil { + x.Admin = []byte{} + } iNdEx = postIndex case 4: if wireType != 2 { @@ -1356,8 +1358,8 @@ func (x *fastReflection_ClassIssuer) Range(f func(protoreflect.FieldDescriptor, return } } - if x.Issuer != "" { - value := protoreflect.ValueOfString(x.Issuer) + if len(x.Issuer) != 0 { + value := protoreflect.ValueOfBytes(x.Issuer) if !f(fd_ClassIssuer_issuer, value) { return } @@ -1380,7 +1382,7 @@ func (x *fastReflection_ClassIssuer) Has(fd protoreflect.FieldDescriptor) bool { case "regen.ecocredit.v1beta1.ClassIssuer.class_id": return x.ClassId != "" case "regen.ecocredit.v1beta1.ClassIssuer.issuer": - return x.Issuer != "" + return len(x.Issuer) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.ClassIssuer")) @@ -1400,7 +1402,7 @@ func (x *fastReflection_ClassIssuer) Clear(fd protoreflect.FieldDescriptor) { case "regen.ecocredit.v1beta1.ClassIssuer.class_id": x.ClassId = "" case "regen.ecocredit.v1beta1.ClassIssuer.issuer": - x.Issuer = "" + x.Issuer = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.ClassIssuer")) @@ -1422,7 +1424,7 @@ func (x *fastReflection_ClassIssuer) Get(descriptor protoreflect.FieldDescriptor return protoreflect.ValueOfString(value) case "regen.ecocredit.v1beta1.ClassIssuer.issuer": value := x.Issuer - return protoreflect.ValueOfString(value) + return protoreflect.ValueOfBytes(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.ClassIssuer")) @@ -1446,7 +1448,7 @@ func (x *fastReflection_ClassIssuer) Set(fd protoreflect.FieldDescriptor, value case "regen.ecocredit.v1beta1.ClassIssuer.class_id": x.ClassId = value.Interface().(string) case "regen.ecocredit.v1beta1.ClassIssuer.issuer": - x.Issuer = value.Interface().(string) + x.Issuer = value.Bytes() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.ClassIssuer")) @@ -1487,7 +1489,7 @@ func (x *fastReflection_ClassIssuer) NewField(fd protoreflect.FieldDescriptor) p case "regen.ecocredit.v1beta1.ClassIssuer.class_id": return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.ClassIssuer.issuer": - return protoreflect.ValueOfString("") + return protoreflect.ValueOfBytes(nil) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.ClassIssuer")) @@ -1693,7 +1695,7 @@ func (x *fastReflection_ClassIssuer) ProtoMethods() *protoiface.Methods { if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1703,23 +1705,25 @@ func (x *fastReflection_ClassIssuer) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen 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.Issuer = string(dAtA[iNdEx:postIndex]) + x.Issuer = append(x.Issuer[:0], dAtA[iNdEx:postIndex]...) + if x.Issuer == nil { + x.Issuer = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex @@ -5815,7 +5819,7 @@ type ClassInfo struct { // and an auto-generated integer. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // admin is the admin of the credit class. - Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` + Admin []byte `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` // metadata is any arbitrary metadata to attached to the credit class. Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` // credit_type is the abbreviation of the credit type. @@ -5856,11 +5860,11 @@ func (x *ClassInfo) GetName() string { return "" } -func (x *ClassInfo) GetAdmin() string { +func (x *ClassInfo) GetAdmin() []byte { if x != nil { return x.Admin } - return "" + return nil } func (x *ClassInfo) GetMetadata() []byte { @@ -5886,7 +5890,7 @@ type ClassIssuer struct { // class_id is the unique ID of credit class. ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // issuer is the approved issuer of the credit class. - Issuer string `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer []byte `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` } func (x *ClassIssuer) Reset() { @@ -5916,11 +5920,11 @@ func (x *ClassIssuer) GetClassId() string { return "" } -func (x *ClassIssuer) GetIssuer() string { +func (x *ClassIssuer) GetIssuer() []byte { if x != nil { return x.Issuer } - return "" + return nil } // ProjectInfo represents the high-level on-chain information for a project. @@ -6380,7 +6384,7 @@ var file_regen_ecocredit_v1beta1_state_proto_rawDesc = []byte{ 0x0a, 0x09, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, @@ -6392,7 +6396,7 @@ var file_regen_ecocredit_v1beta1_state_proto_rawDesc = []byte{ 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x3a, 0x1b, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x3a, 0x1b, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x15, 0x0a, 0x11, 0x0a, 0x0f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x2c, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x03, 0x22, 0xc6, 0x01, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, diff --git a/proto/regen/ecocredit/v1beta1/state.proto b/proto/regen/ecocredit/v1beta1/state.proto index 654a08eb54..2023187f7e 100644 --- a/proto/regen/ecocredit/v1beta1/state.proto +++ b/proto/regen/ecocredit/v1beta1/state.proto @@ -48,7 +48,7 @@ message ClassInfo { string name = 2; // admin is the admin of the credit class. - string admin = 3; + bytes admin = 3; // metadata is any arbitrary metadata to attached to the credit class. bytes metadata = 4; @@ -68,7 +68,7 @@ message ClassIssuer { string class_id = 1; // issuer is the approved issuer of the credit class. - string issuer = 2; + bytes issuer = 2; } // ProjectInfo represents the high-level on-chain information for a project. diff --git a/x/data/go.mod b/x/data/go.mod index 53064f75dd..f7d5d5757e 100644 --- a/x/data/go.mod +++ b/x/data/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.7.0 github.com/tendermint/tendermint v0.34.13 google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 ) require ( @@ -52,6 +52,7 @@ require ( github.com/gogo/gateway v1.1.0 // indirect github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 // indirect github.com/google/btree v1.0.0 // indirect + github.com/google/go-cmp v0.5.6 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.4.2 // indirect diff --git a/x/data/go.sum b/x/data/go.sum index cad1f5363a..69666c2fdc 100644 --- a/x/data/go.sum +++ b/x/data/go.sum @@ -220,9 +220,11 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/cosmos-proto v1.0.0-alpha6/go.mod h1:msdDWOvfStHLG+Z2y2SJ0dcqimZ2vc8M1MPnZ4jOF7U= +github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3/go.mod h1:Ht15guGn9F8b0lv8NkjXE9/asAvVUOt2n4gvQ4q5MyU= +github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.1/go.mod h1:5mhtuO1SxHkN7nQqC41YIIIOEURJ5NieEMqlbsG5IYs= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7/go.mod h1:woV5EBAWmTaXKs7YXioQsYheXSZkmZIgLPq+Koi/GB8= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -449,8 +451,9 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= @@ -572,6 +575,7 @@ github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63 github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/huin/goupnp v1.0.0/go.mod h1:n9v9KO1tAxYH82qOn+UTIFQDmx5n1Zxd/ClZDMX7Bnc= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.4/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -1583,8 +1587,9 @@ google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index 90f5ef1e8a..433bc9dfaf 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -26,7 +26,6 @@ const gasCostPerIteration = uint64(10) // the global parameter CreditClassFee, which can be updated through the // governance process. func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass) (*v1beta1.MsgCreateClassResponse, error) { - regenCtx := types.UnwrapSDKContext(ctx) sdkCtx := sdk.UnwrapSDKContext(ctx) // Charge the admin a fee to create the credit class adminAddress, err := sdk.AccAddressFromBech32(req.Admin) @@ -35,12 +34,12 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } var params ecocredit.Params - s.paramSpace.GetParamSet(regenCtx.Context, ¶ms) - if params.AllowlistEnabled && !s.isCreatorAllowListed(regenCtx, params.AllowedClassCreators, adminAddress) { + s.paramSpace.GetParamSet(sdkCtx, ¶ms) + if params.AllowlistEnabled && !s.isCreatorAllowListed(sdkCtx, params.AllowedClassCreators, adminAddress) { return nil, sdkerrors.ErrUnauthorized.Wrapf("%s is not allowed to create credit classes", adminAddress.String()) } - err = s.chargeCreditClassFee(regenCtx.Context, adminAddress) + err = s.chargeCreditClassFee(sdkCtx, adminAddress) if err != nil { return nil, err } @@ -58,7 +57,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass rowID, err := s.stateStore.ClassInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ Name: classID, - Admin: req.Admin, + Admin: adminAddress, Metadata: req.Metadata, CreditType: req.CreditTypeName, }) @@ -67,6 +66,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } for _, issuer := range req.Issuers { + issuer, _ := sdk.AccAddressFromBech32(issuer) if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ ClassId: classID, Issuer: issuer, @@ -75,7 +75,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } } - err = regenCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateClass{ + err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateClass{ RowId: rowID, ClassId: classID, Admin: req.Admin, @@ -146,7 +146,6 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro // CreateBatch creates a new batch of credits. // Credits in the batch must not have more decimal places than the credit type's specified precision. func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch) (*v1beta1.MsgCreateBatchResponse, error) { - regenCtx := types.UnwrapSDKContext(ctx) sdkCtx := sdk.UnwrapSDKContext(ctx) projectID := req.ProjectId @@ -192,7 +191,6 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch if err != nil { return nil, err } - newBatchID := rowID tradableSupply, retiredSupply := math.NewDecFromInt64(0), math.NewDecFromInt64(0) @@ -215,7 +213,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch if err != nil { return nil, err } - if err = regenCtx.EventManager().EmitTypedEvent(&v1beta1.EventRetire{ + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventRetire{ Retirer: recipient.String(), BatchDenom: batchDenom, Amount: retired.String(), @@ -226,14 +224,14 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch } if err = s.stateStore.BatchBalanceStore().Insert(ctx, &ecocreditv1beta1.BatchBalance{ Address: recipient, - BatchId: newBatchID, + BatchId: rowID, Tradable: tradable.String(), Retired: retired.String(), }); err != nil { return nil, err } - if err = regenCtx.EventManager().EmitTypedEvent(&v1beta1.EventReceive{ + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventReceive{ Recipient: recipient.String(), BatchDenom: batchDenom, RetiredAmount: tradable.String(), @@ -242,11 +240,11 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch return nil, err } - regenCtx.GasMeter().ConsumeGas(gasCostPerIteration, "batch issuance") + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "batch issuance") } if err = s.stateStore.BatchSupplyStore().Insert(ctx, &ecocreditv1beta1.BatchSupply{ - BatchId: newBatchID, + BatchId: rowID, TradableAmount: tradableSupply.String(), RetiredAmount: retiredSupply.String(), CancelledAmount: math.NewDecFromInt64(0).String(), @@ -444,10 +442,12 @@ func (s serverImpl) UpdateClassAdmin(ctx context.Context, req *v1beta1.MsgUpdate if err != nil { return nil, err } - if classInfo.Admin != req.Admin { + reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) + classAdmin := sdk.AccAddress(classInfo.Admin) + if !classAdmin.Equals(reqAddr) { return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) } - classInfo.Admin = req.NewAdmin + classInfo.Admin = reqAddr if err = s.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { return nil, err } @@ -459,7 +459,9 @@ func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpda if err != nil { return nil, err } - if class.Admin != req.Admin { + reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) + admin := sdk.AccAddress(class.Admin) + if !reqAddr.Equals(admin) { return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", class.Admin, req.Admin) } @@ -470,9 +472,10 @@ func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpda // add the new issuers for _, issuer := range req.Issuers { + iAddr, _ := sdk.AccAddressFromBech32(issuer) if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ ClassId: req.ClassId, - Issuer: issuer, + Issuer: iAddr, }); err != nil { return nil, err } @@ -485,7 +488,9 @@ func (s serverImpl) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpd if err != nil { return nil, err } - if classInfo.Admin != req.Admin { + reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) + admin := sdk.AccAddress(classInfo.Admin) + if !reqAddr.Equals(admin) { return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) } classInfo.Metadata = req.Metadata @@ -905,7 +910,7 @@ func (s serverImpl) PickFromBasket(ctx context.Context, basket *basketv1beta1.Ms // ------- UTILITIES ------ // Checks if the given address is in the allowlist of credit class creators -func (s serverImpl) isCreatorAllowListed(ctx types.Context, allowlist []string, designer sdk.Address) bool { +func (s serverImpl) isCreatorAllowListed(ctx sdk.Context, allowlist []string, designer sdk.Address) bool { for _, addr := range allowlist { ctx.GasMeter().ConsumeGas(gasCostPerIteration, "credit class creators allowlist") allowListedAddr, _ := sdk.AccAddressFromBech32(addr) @@ -916,7 +921,7 @@ func (s serverImpl) isCreatorAllowListed(ctx types.Context, allowlist []string, return false } -// AssertClassIssuer makes sure that the issuer is part of issuers of given classID. +// assertClassIssuer makes sure that the issuer is part of issuers of given classID. // Returns ErrUnauthorized otherwise. func (s serverImpl) assertClassIssuer(goCtx context.Context, classID, issuer string) error { it, err := s.stateStore.ClassIssuerStore().List(goCtx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classID)) @@ -924,13 +929,15 @@ func (s serverImpl) assertClassIssuer(goCtx context.Context, classID, issuer str return err } + iAddr, _ := sdk.AccAddressFromBech32(issuer) + defer it.Close() for it.Next() { v, err := it.Value() if err != nil { return err } - if v.Issuer == issuer { + if iAddr.Equals(sdk.AccAddress(v.Issuer)) { return nil } } diff --git a/x/ecocredit/v1beta1/state.pb.go b/x/ecocredit/v1beta1/state.pb.go index a57623b5e8..be4ccf0d8d 100644 --- a/x/ecocredit/v1beta1/state.pb.go +++ b/x/ecocredit/v1beta1/state.pb.go @@ -107,7 +107,7 @@ type ClassInfo struct { // and an auto-generated integer. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // admin is the admin of the credit class. - Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` + Admin []byte `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` // metadata is any arbitrary metadata to attached to the credit class. Metadata []byte `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` // credit_type is the abbreviation of the credit type. @@ -161,11 +161,11 @@ func (m *ClassInfo) GetName() string { return "" } -func (m *ClassInfo) GetAdmin() string { +func (m *ClassInfo) GetAdmin() []byte { if m != nil { return m.Admin } - return "" + return nil } func (m *ClassInfo) GetMetadata() []byte { @@ -187,7 +187,7 @@ type ClassIssuer struct { // class_id is the unique ID of credit class. ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // issuer is the approved issuer of the credit class. - Issuer string `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer []byte `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` } func (m *ClassIssuer) Reset() { *m = ClassIssuer{} } @@ -230,11 +230,11 @@ func (m *ClassIssuer) GetClassId() string { return "" } -func (m *ClassIssuer) GetIssuer() string { +func (m *ClassIssuer) GetIssuer() []byte { if m != nil { return m.Issuer } - return "" + return nil } // ProjectInfo represents the high-level on-chain information for a project. @@ -751,61 +751,62 @@ func init() { } var fileDescriptor_8079a0bb712cbff1 = []byte{ - // 862 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcd, 0x6e, 0xdc, 0x54, - 0x14, 0xce, 0xf5, 0x24, 0x33, 0xf1, 0x99, 0x3f, 0xe7, 0x12, 0x5a, 0x13, 0xe8, 0xb4, 0x32, 0x7f, - 0xad, 0x08, 0x63, 0x4d, 0x10, 0x12, 0xb5, 0xc4, 0x82, 0xa4, 0x9b, 0x48, 0x2c, 0xd0, 0xb4, 0x2b, - 0x24, 0x34, 0xba, 0xf6, 0xbd, 0x9d, 0x38, 0xf8, 0x0f, 0xfb, 0x4e, 0x68, 0x5e, 0x02, 0xf1, 0x00, - 0x88, 0x37, 0x80, 0x3d, 0x12, 0x6b, 0xc4, 0xb2, 0x12, 0x1b, 0x96, 0x28, 0x79, 0x03, 0x9e, 0x00, - 0xdd, 0x73, 0xaf, 0x9d, 0xf1, 0x34, 0x2a, 0x3b, 0x9f, 0xcf, 0xe7, 0x9c, 0xef, 0x3b, 0x7f, 0x36, - 0xbc, 0x5b, 0x8a, 0xa5, 0xc8, 0x7c, 0x11, 0xe5, 0x51, 0x29, 0x78, 0x2c, 0xfd, 0x8b, 0x59, 0x28, - 0x24, 0x9b, 0xf9, 0x95, 0x64, 0x52, 0x4c, 0x8b, 0x32, 0x97, 0x39, 0xbd, 0x8b, 0x4e, 0xd3, 0xc6, - 0x69, 0x6a, 0x9c, 0x0e, 0xee, 0x45, 0x79, 0x95, 0xe6, 0x95, 0x9f, 0x97, 0xa9, 0x7f, 0x31, 0x63, - 0x49, 0x71, 0xc6, 0x66, 0xca, 0xd0, 0x71, 0x07, 0xf7, 0x97, 0x79, 0xbe, 0x4c, 0x84, 0x8f, 0x56, - 0xb8, 0x7a, 0xee, 0xcb, 0x38, 0x15, 0x95, 0x64, 0x69, 0xa1, 0x1d, 0xbc, 0x9f, 0x08, 0xc0, 0x09, - 0xa6, 0x7c, 0x76, 0x59, 0x08, 0xea, 0xc1, 0x80, 0x85, 0x61, 0x29, 0x2e, 0x62, 0x26, 0xe3, 0x3c, - 0x73, 0xc9, 0x03, 0xf2, 0xd0, 0x9e, 0xb7, 0x30, 0x4a, 0x61, 0x3b, 0x63, 0xa9, 0x70, 0x2d, 0x7c, - 0x87, 0xcf, 0x0a, 0x5b, 0x65, 0xb1, 0x74, 0x3b, 0x1a, 0x53, 0xcf, 0xf4, 0x1d, 0xb0, 0x8b, 0x52, - 0x44, 0x71, 0xa5, 0x12, 0x6d, 0x3f, 0x20, 0x0f, 0x87, 0xf3, 0x1b, 0x20, 0x78, 0xef, 0xdf, 0x9f, - 0xff, 0xfa, 0xa1, 0x33, 0x81, 0x51, 0x9b, 0x91, 0x82, 0xce, 0xee, 0x10, 0x97, 0xb8, 0xc4, 0xfb, - 0x9d, 0x80, 0x7d, 0x92, 0xb0, 0xaa, 0x3a, 0xcd, 0x9e, 0xe7, 0x74, 0x04, 0x56, 0xcc, 0x51, 0xd3, - 0xf6, 0xdc, 0x8a, 0xf9, 0xad, 0x4a, 0xf6, 0x61, 0x87, 0xf1, 0x34, 0xce, 0x8c, 0x14, 0x6d, 0xd0, - 0x03, 0xd8, 0x4d, 0x85, 0x64, 0x9c, 0x49, 0x86, 0x52, 0x06, 0xf3, 0xc6, 0xa6, 0xf7, 0xa1, 0xaf, - 0x9b, 0xba, 0x90, 0x97, 0x85, 0x70, 0x77, 0x30, 0x0e, 0xa2, 0xa6, 0x29, 0xc1, 0x67, 0x28, 0xf5, - 0x08, 0xba, 0x8a, 0xde, 0x21, 0xeb, 0x12, 0xa9, 0x6d, 0xe8, 0x1c, 0x8b, 0x8e, 0x5b, 0x79, 0x9c, - 0x8e, 0x6b, 0x79, 0xdf, 0x40, 0x5f, 0xab, 0xaf, 0xaa, 0x95, 0x28, 0xe9, 0x5b, 0xb0, 0x1b, 0x29, - 0x73, 0x61, 0xaa, 0xb0, 0xe7, 0x3d, 0xb4, 0x4f, 0x39, 0xbd, 0x03, 0xdd, 0x18, 0x9d, 0x4c, 0x31, - 0xc6, 0x0a, 0xde, 0x46, 0xee, 0x37, 0x61, 0x0f, 0xc6, 0x75, 0xe8, 0xa1, 0x71, 0xec, 0x78, 0x7f, - 0x10, 0xe8, 0x7f, 0x55, 0xe6, 0xe7, 0x22, 0x92, 0xaf, 0xed, 0x4f, 0x67, 0xad, 0x3f, 0xeb, 0x1a, - 0x2c, 0xf4, 0x6c, 0x34, 0x3c, 0x02, 0xa7, 0xd0, 0xd9, 0x16, 0x49, 0x1e, 0xe9, 0x05, 0xd8, 0xc6, - 0xd0, 0xb1, 0xc1, 0xbf, 0x34, 0x70, 0xab, 0x9f, 0x3b, 0xed, 0x7e, 0x06, 0x33, 0x94, 0xfc, 0xd1, - 0xad, 0xed, 0x7a, 0x03, 0x86, 0x4d, 0x19, 0x08, 0x5a, 0x2e, 0x71, 0xb7, 0xbd, 0x5f, 0x2d, 0xb0, - 0x8f, 0x99, 0x8c, 0xce, 0x6e, 0x2d, 0xe3, 0x1e, 0x40, 0xad, 0xab, 0x11, 0x6d, 0x1b, 0xe4, 0x94, - 0xab, 0xf9, 0x85, 0x2a, 0x76, 0xc1, 0x45, 0x96, 0xa7, 0xa6, 0x58, 0x40, 0xe8, 0x89, 0x42, 0x5e, - 0x3b, 0xfc, 0xc7, 0x00, 0x95, 0x64, 0xa5, 0x5c, 0x70, 0x26, 0xf5, 0xec, 0xfb, 0x47, 0x07, 0x53, - 0x7d, 0x35, 0xd3, 0xfa, 0x6a, 0xa6, 0xcf, 0xea, 0xab, 0x99, 0xdb, 0xe8, 0xfd, 0x84, 0x49, 0x41, - 0x3f, 0x85, 0x5d, 0x91, 0x71, 0x1d, 0xd8, 0xfd, 0xdf, 0xc0, 0x9e, 0xc8, 0xb8, 0x0a, 0x0b, 0x4e, - 0xb0, 0x3d, 0x9f, 0x37, 0xed, 0xd9, 0x6b, 0xc9, 0xc7, 0x2e, 0x8d, 0xd6, 0x0b, 0x76, 0x2c, 0x65, - 0xdf, 0x88, 0x74, 0x3a, 0xee, 0x8e, 0x97, 0xc2, 0x10, 0x17, 0xeb, 0xa9, 0xf8, 0x6e, 0x25, 0xb2, - 0x48, 0x6c, 0x2e, 0x31, 0xd9, 0x5c, 0x62, 0xea, 0xc1, 0x30, 0x13, 0x2f, 0xe4, 0x62, 0x63, 0xf8, - 0x7d, 0x05, 0xea, 0x1d, 0xe5, 0xc1, 0x5d, 0x94, 0xb6, 0x07, 0xc3, 0x76, 0xb2, 0xae, 0x77, 0x0e, - 0x63, 0xb3, 0x67, 0x0d, 0xe1, 0xe6, 0x2e, 0xaf, 0xed, 0xd1, 0x07, 0x30, 0x46, 0xaa, 0x57, 0x86, - 0x86, 0x0a, 0xea, 0x85, 0xe5, 0xc1, 0x3e, 0xd2, 0x8d, 0x00, 0xd6, 0x52, 0xf5, 0xbc, 0x73, 0x18, - 0xe2, 0x2a, 0x34, 0x4c, 0xed, 0xf1, 0xeb, 0xca, 0xd6, 0xc6, 0x5f, 0x17, 0xa6, 0x9b, 0xd8, 0x2e, - 0x4c, 0xef, 0x14, 0x0f, 0xee, 0x20, 0x93, 0x03, 0x83, 0x56, 0xaa, 0x5d, 0xef, 0x17, 0x02, 0x03, - 0xf4, 0x39, 0x66, 0x09, 0x53, 0x5c, 0x2e, 0xf4, 0x18, 0xe7, 0xa5, 0xa8, 0x2a, 0x24, 0x1a, 0xcc, - 0x6b, 0x53, 0xd5, 0xbb, 0xc1, 0xd0, 0x0b, 0x75, 0x76, 0xb5, 0x5f, 0xb2, 0x64, 0x9c, 0x85, 0x49, - 0x7d, 0x6a, 0x8d, 0xad, 0x12, 0x96, 0x42, 0xc6, 0xa5, 0xe0, 0xe6, 0x94, 0x6a, 0x33, 0x38, 0x42, - 0x4d, 0x87, 0x40, 0xc1, 0x31, 0x1c, 0x87, 0x35, 0x01, 0xdd, 0x07, 0xa7, 0x7e, 0x3e, 0x34, 0x2f, - 0x1d, 0xe2, 0xda, 0xde, 0x6f, 0x04, 0xfa, 0xba, 0x39, 0xab, 0xa2, 0x48, 0x2e, 0x5b, 0xa2, 0x48, - 0x5b, 0xd4, 0x87, 0x30, 0xae, 0x45, 0x2c, 0x58, 0x9a, 0xaf, 0x32, 0x69, 0xbe, 0x2c, 0xa3, 0x1a, - 0xfe, 0x02, 0x51, 0xfa, 0x3e, 0x8c, 0x8c, 0xa4, 0xda, 0x4f, 0xd7, 0x30, 0x34, 0xa8, 0x71, 0x7b, - 0x04, 0x4e, 0xa4, 0x5a, 0x94, 0x24, 0x37, 0x8e, 0xe6, 0xe3, 0xd0, 0xe0, 0xda, 0x75, 0x7d, 0xae, - 0x8d, 0x3a, 0x38, 0x7e, 0xfa, 0xe7, 0xd5, 0x84, 0xbc, 0xbc, 0x9a, 0x90, 0x7f, 0xae, 0x26, 0xe4, - 0xc7, 0xeb, 0xc9, 0xd6, 0xcb, 0xeb, 0xc9, 0xd6, 0xdf, 0xd7, 0x93, 0xad, 0xaf, 0x1f, 0x2f, 0x63, - 0x79, 0xb6, 0x0a, 0xa7, 0x51, 0x9e, 0xfa, 0xf8, 0x9f, 0xfb, 0x38, 0x13, 0xf2, 0xfb, 0xbc, 0xfc, - 0xd6, 0x58, 0x89, 0xe0, 0x4b, 0x51, 0xfa, 0x2f, 0x5e, 0xfd, 0x47, 0x86, 0x5d, 0xbc, 0xb4, 0x4f, - 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xae, 0x94, 0x25, 0x04, 0x45, 0x07, 0x00, 0x00, + // 867 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcd, 0x6e, 0xe4, 0x44, + 0x10, 0x4e, 0x7b, 0x26, 0x33, 0x71, 0xcd, 0x9f, 0xd3, 0x84, 0x5d, 0x13, 0xd8, 0xd9, 0x95, 0xf9, + 0xdb, 0x15, 0xc3, 0x58, 0x13, 0x84, 0xc4, 0x5a, 0xe2, 0x40, 0xb2, 0x97, 0x48, 0x1c, 0x90, 0x77, + 0x4f, 0x48, 0x68, 0xd4, 0x76, 0xf7, 0x4e, 0x1c, 0xfc, 0x87, 0xdd, 0x13, 0x36, 0x2f, 0x81, 0x78, + 0x00, 0xc4, 0x1b, 0xc0, 0x1d, 0x89, 0x33, 0xe2, 0xb8, 0x12, 0x17, 0x8e, 0x28, 0x79, 0x03, 0x9e, + 0x00, 0xb9, 0xba, 0xed, 0x8c, 0x67, 0xa3, 0xe5, 0xe6, 0xfa, 0x5c, 0x5d, 0xdf, 0x57, 0x5f, 0x55, + 0xdb, 0xf0, 0x6e, 0x21, 0x56, 0x22, 0x75, 0x45, 0x98, 0x85, 0x85, 0xe0, 0x91, 0x74, 0x2f, 0x16, + 0x81, 0x90, 0x6c, 0xe1, 0x96, 0x92, 0x49, 0x31, 0xcf, 0x8b, 0x4c, 0x66, 0xf4, 0x2e, 0x26, 0xcd, + 0x9b, 0xa4, 0xb9, 0x4e, 0x3a, 0xbc, 0x17, 0x66, 0x65, 0x92, 0x95, 0x6e, 0x56, 0x24, 0xee, 0xc5, + 0x82, 0xc5, 0xf9, 0x19, 0x5b, 0x54, 0x81, 0x3a, 0x77, 0x78, 0x7f, 0x95, 0x65, 0xab, 0x58, 0xb8, + 0x18, 0x05, 0xeb, 0xe7, 0xae, 0x8c, 0x12, 0x51, 0x4a, 0x96, 0xe4, 0x2a, 0xc1, 0xf9, 0x89, 0x00, + 0x9c, 0x60, 0xc9, 0x67, 0x97, 0xb9, 0xa0, 0x0e, 0x0c, 0x59, 0x10, 0x14, 0xe2, 0x22, 0x62, 0x32, + 0xca, 0x52, 0x9b, 0x3c, 0x20, 0x0f, 0x4d, 0xbf, 0x85, 0x51, 0x0a, 0xdd, 0x94, 0x25, 0xc2, 0x36, + 0xf0, 0x1d, 0x3e, 0x57, 0xd8, 0x3a, 0x8d, 0xa4, 0xdd, 0x51, 0x58, 0xf5, 0x4c, 0xdf, 0x01, 0x33, + 0x2f, 0x44, 0x18, 0x95, 0x55, 0xa1, 0xee, 0x03, 0xf2, 0x70, 0xe4, 0xdf, 0x00, 0xde, 0x7b, 0xff, + 0xfe, 0xfc, 0xd7, 0x0f, 0x9d, 0x29, 0x8c, 0xdb, 0x8c, 0x14, 0x54, 0x75, 0x8b, 0xd8, 0xc4, 0x26, + 0xce, 0xef, 0x04, 0xcc, 0x93, 0x98, 0x95, 0xe5, 0x69, 0xfa, 0x3c, 0xa3, 0x63, 0x30, 0x22, 0x8e, + 0x9a, 0xba, 0xbe, 0x11, 0xf1, 0x5b, 0x95, 0x1c, 0xc0, 0x2e, 0xe3, 0x49, 0x94, 0xa2, 0x94, 0xa1, + 0xaf, 0x02, 0x7a, 0x08, 0x7b, 0x89, 0x90, 0x8c, 0x33, 0xc9, 0x50, 0xca, 0xd0, 0x6f, 0x62, 0x7a, + 0x1f, 0x06, 0xca, 0xd4, 0xa5, 0xbc, 0xcc, 0x85, 0xbd, 0x8b, 0xc5, 0x20, 0x6c, 0x4c, 0xf1, 0x3e, + 0x43, 0xa9, 0x47, 0xd0, 0xab, 0xe8, 0x2d, 0xb2, 0x29, 0x91, 0x9a, 0x9a, 0xce, 0x32, 0xe8, 0xa4, + 0x55, 0xc7, 0xea, 0xd8, 0x86, 0xf3, 0x0d, 0x0c, 0x94, 0xfa, 0xb2, 0x5c, 0x8b, 0x82, 0xbe, 0x05, + 0x7b, 0x61, 0x15, 0x2e, 0x75, 0x17, 0xa6, 0xdf, 0xc7, 0xf8, 0x94, 0xd3, 0x3b, 0xd0, 0x8b, 0x30, + 0x09, 0x9b, 0x19, 0xfa, 0x3a, 0xf2, 0xde, 0x46, 0xee, 0x37, 0x61, 0x1f, 0x26, 0xf5, 0xd1, 0x99, + 0x4e, 0xec, 0x38, 0x7f, 0x10, 0x18, 0x7c, 0x55, 0x64, 0xe7, 0x22, 0x94, 0xaf, 0xf5, 0xa7, 0xb3, + 0xe1, 0xcf, 0xa6, 0x06, 0x03, 0x33, 0x1b, 0x0d, 0x8f, 0xc0, 0xca, 0x55, 0xb5, 0x65, 0x9c, 0x85, + 0x6a, 0x01, 0xba, 0x78, 0x74, 0xa2, 0xf1, 0x2f, 0x35, 0xdc, 0xf2, 0x73, 0xb7, 0xed, 0xa7, 0xb7, + 0x40, 0xc9, 0x1f, 0xdd, 0x6a, 0xd7, 0x1b, 0x30, 0x6a, 0xda, 0x40, 0xd0, 0xb0, 0x89, 0xdd, 0x75, + 0x7e, 0x35, 0xc0, 0x3c, 0x66, 0x32, 0x3c, 0xbb, 0xb5, 0x8d, 0x7b, 0x00, 0xb5, 0xae, 0x46, 0xb4, + 0xa9, 0x91, 0x53, 0x5e, 0xcd, 0x2f, 0xa8, 0xce, 0x2e, 0xb9, 0x48, 0xb3, 0x44, 0x37, 0x0b, 0x08, + 0x3d, 0xa9, 0x90, 0xd7, 0x0e, 0xff, 0x31, 0x40, 0x29, 0x59, 0x21, 0x97, 0x9c, 0x49, 0x35, 0xfb, + 0xc1, 0xd1, 0xe1, 0x5c, 0xdd, 0x9a, 0x79, 0x7d, 0x6b, 0xe6, 0xcf, 0xea, 0x5b, 0xe3, 0x9b, 0x98, + 0xfd, 0x84, 0x49, 0x41, 0x3f, 0x85, 0x3d, 0x91, 0x72, 0x75, 0xb0, 0xf7, 0xbf, 0x07, 0xfb, 0x22, + 0xe5, 0xd5, 0x31, 0xef, 0x04, 0xed, 0xf9, 0xbc, 0xb1, 0x67, 0xbf, 0x25, 0x1f, 0x5d, 0x1a, 0x6f, + 0x36, 0x6c, 0x19, 0x55, 0x7c, 0x23, 0xd2, 0xea, 0xd8, 0xbb, 0x4e, 0x02, 0x23, 0x5c, 0xac, 0xa7, + 0xe2, 0xbb, 0xb5, 0x48, 0x43, 0xb1, 0xbd, 0xc4, 0x64, 0x7b, 0x89, 0xa9, 0x03, 0xa3, 0x54, 0xbc, + 0x90, 0xcb, 0xad, 0xe1, 0x0f, 0x2a, 0x50, 0xed, 0x28, 0xf7, 0xee, 0xa2, 0xb4, 0x7d, 0x18, 0xb5, + 0x8b, 0xf5, 0x9c, 0x73, 0x98, 0xe8, 0x3d, 0x6b, 0x08, 0xb7, 0x77, 0x79, 0x63, 0x8f, 0x3e, 0x80, + 0x09, 0x52, 0xbd, 0x32, 0x34, 0x54, 0x50, 0x2f, 0x2c, 0xf7, 0x0e, 0x90, 0x6e, 0x0c, 0xb0, 0x51, + 0xaa, 0xef, 0x9c, 0xc3, 0x08, 0x57, 0xa1, 0x61, 0x6a, 0x8f, 0x5f, 0x75, 0xb6, 0x31, 0xfe, 0xba, + 0x31, 0x65, 0x62, 0xbb, 0x31, 0xb5, 0x53, 0xdc, 0xbb, 0x83, 0x4c, 0x16, 0x0c, 0x5b, 0xa5, 0xf6, + 0x9c, 0x5f, 0x08, 0x0c, 0x31, 0xe7, 0x98, 0xc5, 0xac, 0xe2, 0xb2, 0xa1, 0xcf, 0x38, 0x2f, 0x44, + 0x59, 0x22, 0xd1, 0xd0, 0xaf, 0xc3, 0xaa, 0xdf, 0x2d, 0x86, 0x7e, 0xa0, 0xaa, 0x57, 0xfb, 0x25, + 0x0b, 0xc6, 0x59, 0x10, 0xd7, 0x57, 0xad, 0x89, 0xab, 0x82, 0x85, 0x90, 0x51, 0x21, 0xb8, 0xbe, + 0x4a, 0x75, 0xe8, 0x1d, 0xa1, 0xa6, 0x19, 0x50, 0xb0, 0x34, 0xc7, 0xac, 0x26, 0xa0, 0x07, 0x60, + 0xd5, 0xcf, 0x33, 0xfd, 0xd2, 0x22, 0xb6, 0xe9, 0xfc, 0x46, 0x60, 0xa0, 0xcc, 0x59, 0xe7, 0x79, + 0x7c, 0xd9, 0x12, 0x45, 0xda, 0xa2, 0x3e, 0x84, 0x49, 0x2d, 0x62, 0xc9, 0x92, 0x6c, 0x9d, 0x4a, + 0xfd, 0x99, 0x1c, 0xd7, 0xf0, 0x17, 0x88, 0xd2, 0xf7, 0x61, 0xac, 0x25, 0xd5, 0x79, 0xaa, 0x87, + 0x91, 0x46, 0x75, 0xda, 0x23, 0xb0, 0xc2, 0xca, 0xa2, 0x38, 0xbe, 0x49, 0xd4, 0x1f, 0x87, 0x06, + 0x57, 0xa9, 0x9b, 0x73, 0x6d, 0xd4, 0xc1, 0xf1, 0xd3, 0x3f, 0xaf, 0xa6, 0xe4, 0xe5, 0xd5, 0x94, + 0xfc, 0x73, 0x35, 0x25, 0x3f, 0x5e, 0x4f, 0x77, 0x5e, 0x5e, 0x4f, 0x77, 0xfe, 0xbe, 0x9e, 0xee, + 0x7c, 0xfd, 0x78, 0x15, 0xc9, 0xb3, 0x75, 0x30, 0x0f, 0xb3, 0xc4, 0xc5, 0xff, 0xdc, 0xc7, 0xa9, + 0x90, 0xdf, 0x67, 0xc5, 0xb7, 0x3a, 0x8a, 0x05, 0x5f, 0x89, 0xc2, 0x7d, 0xf1, 0xea, 0x3f, 0x32, + 0xe8, 0xe1, 0x4d, 0xfb, 0xe4, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0x7c, 0x35, 0x81, 0x45, + 0x07, 0x00, 0x00, } func (m *CreditType) Marshal() (dAtA []byte, err error) { @@ -1767,7 +1768,7 @@ func (m *ClassInfo) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowState @@ -1777,23 +1778,25 @@ func (m *ClassInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthState } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthState } if postIndex > l { return io.ErrUnexpectedEOF } - m.Admin = string(dAtA[iNdEx:postIndex]) + m.Admin = append(m.Admin[:0], dAtA[iNdEx:postIndex]...) + if m.Admin == nil { + m.Admin = []byte{} + } iNdEx = postIndex case 4: if wireType != 2 { @@ -1950,7 +1953,7 @@ func (m *ClassIssuer) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowState @@ -1960,23 +1963,25 @@ func (m *ClassIssuer) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthState } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthState } if postIndex > l { return io.ErrUnexpectedEOF } - m.Issuer = string(dAtA[iNdEx:postIndex]) + m.Issuer = append(m.Issuer[:0], dAtA[iNdEx:postIndex]...) + if m.Issuer == nil { + m.Issuer = []byte{} + } iNdEx = postIndex default: iNdEx = preIndex From d1f1b0da4ee59f630813f49c20e4c3d30c4b65c8 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 22:57:31 -0800 Subject: [PATCH 09/31] fix: query byte addrs --- x/ecocredit/server/core/query_server.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index 1efe981858..d845eb2c4b 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -64,7 +64,7 @@ func (s serverImpl) ClassInfo(ctx context.Context, request *v1beta1.QueryClassIn return nil, err } - issuers := make([]string, 0) + issuers := make([]sdk.AccAddress, 0) it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId)) if err != nil { return nil, err @@ -115,7 +115,8 @@ func (s serverImpl) ClassIssuers(ctx context.Context, request *v1beta1.QueryClas if err != nil { return nil, err } - issuers = append(issuers, issuer.Issuer) + + issuers = append(issuers, string(issuer.Issuer)) } pr := it.PageResponse() From df492effa5b46a94676916a1eeceee36af6a7790 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Mon, 7 Feb 2022 23:05:55 -0800 Subject: [PATCH 10/31] chore: issue link --- x/ecocredit/server/core/msg_server.go | 10 +++++----- x/ecocredit/server/core/operations.go | 2 +- x/ecocredit/server/core/query_server.go | 18 ++++++++---------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index 433bc9dfaf..a5d2502cd2 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -501,7 +501,7 @@ func (s serverImpl) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpd } // Sell creates new sell orders for credits -// TODO: update this function with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) Sell(ctx context.Context, sell *marketplacev1beta1.MsgSell) (*marketplacev1beta1.MsgSellResponse, error) { panic("implement me") //ctx := types.UnwrapSDKContext(goCtx) @@ -553,7 +553,7 @@ func (s serverImpl) Sell(ctx context.Context, sell *marketplacev1beta1.MsgSell) //return &ecocredit.MsgSellResponse{SellOrderIds: sellOrderIds}, nil } -// TODO: implement this with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) createSellOrder(ctx types.Context, owner string, o *marketplacev1beta1.MsgSell_Order) (uint64, error) { panic("impl me!") //orderID := s.sellOrderTable.Sequence().PeekNextVal(ctx) @@ -570,7 +570,7 @@ func (s serverImpl) createSellOrder(ctx types.Context, owner string, o *marketpl } // UpdateSellOrders updates existing sell orders for credits -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) UpdateSellOrders(ctx context.Context, orders *marketplacev1beta1.MsgUpdateSellOrders) (*marketplacev1beta1.MsgUpdateSellOrdersResponse, error) { panic("implement me") //ctx := types.UnwrapSDKContext(goCtx) @@ -836,7 +836,7 @@ func (s serverImpl) Buy(ctx context.Context, buy *marketplacev1beta1.MsgBuy) (*m //return &ecocredit.MsgBuyResponse{BuyOrderIds: buyOrderIds}, nil } -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) createBuyOrder(ctx types.Context, buyer string, o *marketplacev1beta1.MsgBuy_Order) (uint64, error) { panic("impl me!") //orderID := s.buyOrderTable.Sequence().PeekNextVal(ctx) @@ -859,7 +859,7 @@ func (s serverImpl) createBuyOrder(ctx types.Context, buyer string, o *marketpla } // AllowAskDenom adds a new ask denom -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) AllowAskDenom(ctx context.Context, denom *marketplacev1beta1.MsgAllowAskDenom) (*marketplacev1beta1.MsgAllowAskDenomResponse, error) { panic("implement me") // ctx := types.UnwrapSDKContext(goCtx) diff --git a/x/ecocredit/server/core/operations.go b/x/ecocredit/server/core/operations.go index a6e5722ab6..826dd492c1 100644 --- a/x/ecocredit/server/core/operations.go +++ b/x/ecocredit/server/core/operations.go @@ -6,7 +6,7 @@ import ( ) // WeightedOperations returns all the ecocredit module operations with their respective weights. -// TODO: sim refactor PR +// TODO: sim refactor PR https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { //key := s.storeKey.(servermodule.RootModuleKey) //queryClient := ecocredit.NewQueryClient(key) diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index d845eb2c4b..7a86583998 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -370,7 +370,6 @@ func (s serverImpl) Supply(ctx context.Context, request *v1beta1.QuerySupplyRequ } // CreditTypes queries the list of allowed types that credit classes can have. -// TODO: migrate to v1beta1 func (s serverImpl) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypesRequest) (*v1beta1.QueryCreditTypesResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) creditTypes := s.getAllCreditTypes(sdkCtx) @@ -378,7 +377,6 @@ func (s serverImpl) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypes } // Params queries the ecocredit module parameters. -// TODO: refactor to v1beta1 func (s serverImpl) Params(ctx context.Context, _ *v1beta1.QueryParamsRequest) (*v1beta1.QueryParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) var params ecocredit.Params @@ -402,7 +400,7 @@ func (s serverImpl) Params(ctx context.Context, _ *v1beta1.QueryParamsRequest) ( } // SellOrder queries for information about a sell order by its ID -// TODO: impl with ORM, integrate sell order? +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) SellOrder(goCtx context.Context, request *ecocredit.QuerySellOrderRequest) (*ecocredit.QuerySellOrderResponse, error) { panic("impl me!") //if request == nil { @@ -419,7 +417,7 @@ func (s serverImpl) SellOrder(goCtx context.Context, request *ecocredit.QuerySel } // SellOrders queries for all sell orders with pagination. -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) SellOrders(goCtx context.Context, request *ecocredit.QuerySellOrdersRequest) (*ecocredit.QuerySellOrdersResponse, error) { panic("impl me!") //if request == nil { @@ -445,7 +443,7 @@ func (s serverImpl) SellOrders(goCtx context.Context, request *ecocredit.QuerySe } // SellOrdersByAddress queries for all sell orders by address with pagination. -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) SellOrdersByAddress(goCtx context.Context, request *ecocredit.QuerySellOrdersByAddressRequest) (*ecocredit.QuerySellOrdersByAddressResponse, error) { panic("impl me!") //if request == nil { @@ -476,7 +474,7 @@ func (s serverImpl) SellOrdersByAddress(goCtx context.Context, request *ecocredi } // SellOrdersByBatchDenom queries for all sell orders by address with pagination. -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) SellOrdersByBatchDenom(goCtx context.Context, request *ecocredit.QuerySellOrdersByBatchDenomRequest) (*ecocredit.QuerySellOrdersByBatchDenomResponse, error) { panic("impl me!") //if request == nil { @@ -506,7 +504,7 @@ func (s serverImpl) SellOrdersByBatchDenom(goCtx context.Context, request *ecocr } // BuyOrder queries for information about a buy order by its ID -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) BuyOrder(goCtx context.Context, request *ecocredit.QueryBuyOrderRequest) (*ecocredit.QueryBuyOrderResponse, error) { panic("impl me!") //if request == nil { @@ -523,7 +521,7 @@ func (s serverImpl) BuyOrder(goCtx context.Context, request *ecocredit.QueryBuyO } // BuyOrders queries for all buy orders with pagination. -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) BuyOrders(goCtx context.Context, request *ecocredit.QueryBuyOrdersRequest) (*ecocredit.QueryBuyOrdersResponse, error) { panic("impl me!") //if request == nil { @@ -549,7 +547,7 @@ func (s serverImpl) BuyOrders(goCtx context.Context, request *ecocredit.QueryBuy } // BuyOrdersByAddress queries for all buy orders by address with pagination. -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) BuyOrdersByAddress(goCtx context.Context, request *ecocredit.QueryBuyOrdersByAddressRequest) (*ecocredit.QueryBuyOrdersByAddressResponse, error) { panic("impl me!") //if request == nil { @@ -580,7 +578,7 @@ func (s serverImpl) BuyOrdersByAddress(goCtx context.Context, request *ecocredit } // AllowedAskDenoms queries for all allowed ask denoms with pagination. -// TODO: impl with ORM +// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 func (s serverImpl) AllowedAskDenoms(goCtx context.Context, request *ecocredit.QueryAllowedAskDenomsRequest) (*ecocredit.QueryAllowedAskDenomsResponse, error) { panic("impl me!") //if request == nil { From 4dd9cf600722a09cbef456b47ea7db3d495f6f0f Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 08:26:54 -0800 Subject: [PATCH 11/31] chore: invariants test use test memory backend --- x/ecocredit/server/core/invariants_test.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/x/ecocredit/server/core/invariants_test.go b/x/ecocredit/server/core/invariants_test.go index 561c6b85ed..71619ee442 100644 --- a/x/ecocredit/server/core/invariants_test.go +++ b/x/ecocredit/server/core/invariants_test.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/orm/model/ormdb" "github.com/cosmos/cosmos-sdk/orm/model/ormtable" + "github.com/cosmos/cosmos-sdk/orm/testing/ormtest" sdk "github.com/cosmos/cosmos-sdk/types" ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" "github.com/regen-network/regen-ledger/types/math" @@ -12,7 +13,6 @@ import ( "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/known/timestamppb" "testing" @@ -21,18 +21,12 @@ import ( func setupStore(t *testing.T) ormdb.ModuleDB { interfaceRegistry := types.NewInterfaceRegistry() ecocredit.RegisterTypes(interfaceRegistry) - db := dbm.NewMemDB() - var moduleSchema = ormdb.ModuleSchema{ FileDescriptors: map[uint32]protoreflect.FileDescriptor{ 1: ecocreditv1beta1.File_regen_ecocredit_v1beta1_state_proto, }, } - backend := ormtable.NewBackend(ormtable.BackendOptions{ - CommitmentStore: db, - IndexStore: nil, - Hooks: nil, - }) + backend := ormtest.NewMemoryBackend() modDB, err := ormdb.NewModuleDB(moduleSchema, ormdb.ModuleDBOptions{ TypeResolver: nil, FileResolver: nil, From a99bff337d92695648c27fc62208149514baec28 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 08:30:31 -0800 Subject: [PATCH 12/31] test: add GetClassIdFromBatchDenom test --- x/ecocredit/denom_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/x/ecocredit/denom_test.go b/x/ecocredit/denom_test.go index 163d7a7706..db210a05d0 100644 --- a/x/ecocredit/denom_test.go +++ b/x/ecocredit/denom_test.go @@ -84,3 +84,12 @@ var genInvalidBatchDenom = rapid.OneOf( genInvalidClassID, rapid.StringMatching(`[A-Z]{1,3}[0-9]*-[a-zA-Z\-]*`), ) + +func TestGetClassIdFromBatchDenom(t *testing.T) { + denom := "BIO01-00000000-00000000-001" + expected := "BIO01" + + got := GetClassIdFromBatchDenom(denom) + + require.Equal(t, expected, got) +} \ No newline at end of file From cdb7edcc588a44ad0f67b9f85961ca227dc5f3ad Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 08:35:09 -0800 Subject: [PATCH 13/31] fix: change assertClassIssuer to use has --- x/ecocredit/server/core/msg_server.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index a5d2502cd2..3ee8c8de07 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -924,24 +924,15 @@ func (s serverImpl) isCreatorAllowListed(ctx sdk.Context, allowlist []string, de // assertClassIssuer makes sure that the issuer is part of issuers of given classID. // Returns ErrUnauthorized otherwise. func (s serverImpl) assertClassIssuer(goCtx context.Context, classID, issuer string) error { - it, err := s.stateStore.ClassIssuerStore().List(goCtx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classID)) + addr, _ := sdk.AccAddressFromBech32(issuer) + found, err := s.stateStore.ClassIssuerStore().Has(goCtx, classID, addr) if err != nil { return err } - - iAddr, _ := sdk.AccAddressFromBech32(issuer) - - defer it.Close() - for it.Next() { - v, err := it.Value() - if err != nil { - return err - } - if iAddr.Equals(sdk.AccAddress(v.Issuer)) { - return nil - } + if !found { + return sdkerrors.ErrUnauthorized.Wrapf("%s is not an issuer for class %s", issuer, classID) } - return sdkerrors.ErrUnauthorized.Wrapf("%s is not an issuer for class %s", issuer, classID) + return nil } func (s serverImpl) genProjectID(ctx context.Context, classRowID uint64, classID string) (string, error) { From dd29c44488b443729730eb17a33b4df81133fff4 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 08:39:18 -0800 Subject: [PATCH 14/31] chore: remove row_id from response/events --- api/regen/ecocredit/v1beta1/events.pulsar.go | 397 ++++--------- api/regen/ecocredit/v1beta1/tx.pulsar.go | 575 +++++++------------ proto/regen/ecocredit/v1beta1/events.proto | 37 +- proto/regen/ecocredit/v1beta1/tx.proto | 15 +- x/ecocredit/server/core/msg_server.go | 17 +- x/ecocredit/v1beta1/events.pb.go | 251 +++----- x/ecocredit/v1beta1/tx.pb.go | 248 +++----- 7 files changed, 475 insertions(+), 1065 deletions(-) diff --git a/api/regen/ecocredit/v1beta1/events.pulsar.go b/api/regen/ecocredit/v1beta1/events.pulsar.go index 2d2e91e6b2..309f62eef2 100644 --- a/api/regen/ecocredit/v1beta1/events.pulsar.go +++ b/api/regen/ecocredit/v1beta1/events.pulsar.go @@ -14,7 +14,6 @@ import ( var ( md_EventCreateClass protoreflect.MessageDescriptor - fd_EventCreateClass_row_id protoreflect.FieldDescriptor fd_EventCreateClass_class_id protoreflect.FieldDescriptor fd_EventCreateClass_admin protoreflect.FieldDescriptor ) @@ -22,7 +21,6 @@ var ( func init() { file_regen_ecocredit_v1beta1_events_proto_init() md_EventCreateClass = File_regen_ecocredit_v1beta1_events_proto.Messages().ByName("EventCreateClass") - fd_EventCreateClass_row_id = md_EventCreateClass.Fields().ByName("row_id") fd_EventCreateClass_class_id = md_EventCreateClass.Fields().ByName("class_id") fd_EventCreateClass_admin = md_EventCreateClass.Fields().ByName("admin") } @@ -92,12 +90,6 @@ func (x *fastReflection_EventCreateClass) Interface() protoreflect.ProtoMessage // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_EventCreateClass) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.RowId != uint64(0) { - value := protoreflect.ValueOfUint64(x.RowId) - if !f(fd_EventCreateClass_row_id, value) { - return - } - } if x.ClassId != "" { value := protoreflect.ValueOfString(x.ClassId) if !f(fd_EventCreateClass_class_id, value) { @@ -125,8 +117,6 @@ func (x *fastReflection_EventCreateClass) Range(f func(protoreflect.FieldDescrip // a repeated field is populated if it is non-empty. func (x *fastReflection_EventCreateClass) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateClass.row_id": - return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": return x.ClassId != "" case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -147,8 +137,6 @@ func (x *fastReflection_EventCreateClass) Has(fd protoreflect.FieldDescriptor) b // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateClass) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateClass.row_id": - x.RowId = uint64(0) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": x.ClassId = "" case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -169,9 +157,6 @@ func (x *fastReflection_EventCreateClass) Clear(fd protoreflect.FieldDescriptor) // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_EventCreateClass) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "regen.ecocredit.v1beta1.EventCreateClass.row_id": - value := x.RowId - return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": value := x.ClassId return protoreflect.ValueOfString(value) @@ -198,8 +183,6 @@ func (x *fastReflection_EventCreateClass) Get(descriptor protoreflect.FieldDescr // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateClass) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateClass.row_id": - x.RowId = value.Uint() case "regen.ecocredit.v1beta1.EventCreateClass.class_id": x.ClassId = value.Interface().(string) case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -224,8 +207,6 @@ func (x *fastReflection_EventCreateClass) Set(fd protoreflect.FieldDescriptor, v // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateClass) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateClass.row_id": - panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.EventCreateClass is not mutable")) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": panic(fmt.Errorf("field class_id of message regen.ecocredit.v1beta1.EventCreateClass is not mutable")) case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -243,8 +224,6 @@ func (x *fastReflection_EventCreateClass) Mutable(fd protoreflect.FieldDescripto // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_EventCreateClass) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateClass.row_id": - return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.EventCreateClass.class_id": return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.EventCreateClass.admin": @@ -318,9 +297,6 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.RowId != 0 { - n += 1 + runtime.Sov(uint64(x.RowId)) - } l = len(x.ClassId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -363,19 +339,14 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.Admin) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Admin))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(x.ClassId) > 0 { i -= len(x.ClassId) copy(dAtA[i:], x.ClassId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) i-- - dAtA[i] = 0x12 - } - if x.RowId != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -427,25 +398,6 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - x.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -477,7 +429,7 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { } x.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } @@ -546,7 +498,6 @@ func (x *fastReflection_EventCreateClass) ProtoMethods() *protoiface.Methods { var ( md_EventCreateProject protoreflect.MessageDescriptor - fd_EventCreateProject_row_id protoreflect.FieldDescriptor fd_EventCreateProject_project_id protoreflect.FieldDescriptor fd_EventCreateProject_class_id protoreflect.FieldDescriptor fd_EventCreateProject_issuer protoreflect.FieldDescriptor @@ -556,7 +507,6 @@ var ( func init() { file_regen_ecocredit_v1beta1_events_proto_init() md_EventCreateProject = File_regen_ecocredit_v1beta1_events_proto.Messages().ByName("EventCreateProject") - fd_EventCreateProject_row_id = md_EventCreateProject.Fields().ByName("row_id") fd_EventCreateProject_project_id = md_EventCreateProject.Fields().ByName("project_id") fd_EventCreateProject_class_id = md_EventCreateProject.Fields().ByName("class_id") fd_EventCreateProject_issuer = md_EventCreateProject.Fields().ByName("issuer") @@ -628,12 +578,6 @@ func (x *fastReflection_EventCreateProject) Interface() protoreflect.ProtoMessag // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_EventCreateProject) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.RowId != uint64(0) { - value := protoreflect.ValueOfUint64(x.RowId) - if !f(fd_EventCreateProject_row_id, value) { - return - } - } if x.ProjectId != "" { value := protoreflect.ValueOfString(x.ProjectId) if !f(fd_EventCreateProject_project_id, value) { @@ -673,8 +617,6 @@ func (x *fastReflection_EventCreateProject) Range(f func(protoreflect.FieldDescr // a repeated field is populated if it is non-empty. func (x *fastReflection_EventCreateProject) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateProject.row_id": - return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": return x.ProjectId != "" case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -699,8 +641,6 @@ func (x *fastReflection_EventCreateProject) Has(fd protoreflect.FieldDescriptor) // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateProject) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateProject.row_id": - x.RowId = uint64(0) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": x.ProjectId = "" case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -725,9 +665,6 @@ func (x *fastReflection_EventCreateProject) Clear(fd protoreflect.FieldDescripto // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_EventCreateProject) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "regen.ecocredit.v1beta1.EventCreateProject.row_id": - value := x.RowId - return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": value := x.ProjectId return protoreflect.ValueOfString(value) @@ -760,8 +697,6 @@ func (x *fastReflection_EventCreateProject) Get(descriptor protoreflect.FieldDes // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateProject) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateProject.row_id": - x.RowId = value.Uint() case "regen.ecocredit.v1beta1.EventCreateProject.project_id": x.ProjectId = value.Interface().(string) case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -790,8 +725,6 @@ func (x *fastReflection_EventCreateProject) Set(fd protoreflect.FieldDescriptor, // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateProject) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateProject.row_id": - panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.EventCreateProject is not mutable")) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": panic(fmt.Errorf("field project_id of message regen.ecocredit.v1beta1.EventCreateProject is not mutable")) case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -813,8 +746,6 @@ func (x *fastReflection_EventCreateProject) Mutable(fd protoreflect.FieldDescrip // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_EventCreateProject) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateProject.row_id": - return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.EventCreateProject.project_id": return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.EventCreateProject.class_id": @@ -892,9 +823,6 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.RowId != 0 { - n += 1 + runtime.Sov(uint64(x.RowId)) - } l = len(x.ProjectId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -945,33 +873,28 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.ProjectLocation) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectLocation))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(x.Issuer) > 0 { i -= len(x.Issuer) copy(dAtA[i:], x.Issuer) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Issuer))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(x.ClassId) > 0 { i -= len(x.ClassId) copy(dAtA[i:], x.ClassId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(x.ProjectId) > 0 { i -= len(x.ProjectId) copy(dAtA[i:], x.ProjectId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectId))) i-- - dAtA[i] = 0x12 - } - if x.RowId != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1023,25 +946,6 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - x.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -1073,7 +977,7 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { } x.ProjectId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1105,7 +1009,7 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { } x.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } @@ -1137,7 +1041,7 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { } x.Issuer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) } @@ -1206,7 +1110,6 @@ func (x *fastReflection_EventCreateProject) ProtoMethods() *protoiface.Methods { var ( md_EventCreateBatch protoreflect.MessageDescriptor - fd_EventCreateBatch_row_id protoreflect.FieldDescriptor fd_EventCreateBatch_class_id protoreflect.FieldDescriptor fd_EventCreateBatch_batch_denom protoreflect.FieldDescriptor fd_EventCreateBatch_issuer protoreflect.FieldDescriptor @@ -1220,7 +1123,6 @@ var ( func init() { file_regen_ecocredit_v1beta1_events_proto_init() md_EventCreateBatch = File_regen_ecocredit_v1beta1_events_proto.Messages().ByName("EventCreateBatch") - fd_EventCreateBatch_row_id = md_EventCreateBatch.Fields().ByName("row_id") fd_EventCreateBatch_class_id = md_EventCreateBatch.Fields().ByName("class_id") fd_EventCreateBatch_batch_denom = md_EventCreateBatch.Fields().ByName("batch_denom") fd_EventCreateBatch_issuer = md_EventCreateBatch.Fields().ByName("issuer") @@ -1296,12 +1198,6 @@ func (x *fastReflection_EventCreateBatch) Interface() protoreflect.ProtoMessage // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_EventCreateBatch) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.RowId != uint64(0) { - value := protoreflect.ValueOfUint64(x.RowId) - if !f(fd_EventCreateBatch_row_id, value) { - return - } - } if x.ClassId != "" { value := protoreflect.ValueOfString(x.ClassId) if !f(fd_EventCreateBatch_class_id, value) { @@ -1365,8 +1261,6 @@ func (x *fastReflection_EventCreateBatch) Range(f func(protoreflect.FieldDescrip // a repeated field is populated if it is non-empty. func (x *fastReflection_EventCreateBatch) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": - return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": return x.ClassId != "" case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1399,8 +1293,6 @@ func (x *fastReflection_EventCreateBatch) Has(fd protoreflect.FieldDescriptor) b // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateBatch) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": - x.RowId = uint64(0) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": x.ClassId = "" case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1433,9 +1325,6 @@ func (x *fastReflection_EventCreateBatch) Clear(fd protoreflect.FieldDescriptor) // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_EventCreateBatch) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": - value := x.RowId - return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": value := x.ClassId return protoreflect.ValueOfString(value) @@ -1480,8 +1369,6 @@ func (x *fastReflection_EventCreateBatch) Get(descriptor protoreflect.FieldDescr // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateBatch) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": - x.RowId = value.Uint() case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": x.ClassId = value.Interface().(string) case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1518,8 +1405,6 @@ func (x *fastReflection_EventCreateBatch) Set(fd protoreflect.FieldDescriptor, v // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_EventCreateBatch) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": - panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.EventCreateBatch is not mutable")) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": panic(fmt.Errorf("field class_id of message regen.ecocredit.v1beta1.EventCreateBatch is not mutable")) case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1549,8 +1434,6 @@ func (x *fastReflection_EventCreateBatch) Mutable(fd protoreflect.FieldDescripto // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_EventCreateBatch) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.EventCreateBatch.row_id": - return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.EventCreateBatch.class_id": return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.EventCreateBatch.batch_denom": @@ -1636,9 +1519,6 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.RowId != 0 { - n += 1 + runtime.Sov(uint64(x.RowId)) - } l = len(x.ClassId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -1705,61 +1585,56 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.ProjectId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectId))) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 } if len(x.ProjectLocation) > 0 { i -= len(x.ProjectLocation) copy(dAtA[i:], x.ProjectLocation) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectLocation))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a } if len(x.EndDate) > 0 { i -= len(x.EndDate) copy(dAtA[i:], x.EndDate) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.EndDate))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if len(x.StartDate) > 0 { i -= len(x.StartDate) copy(dAtA[i:], x.StartDate) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.StartDate))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(x.TotalAmount) > 0 { i -= len(x.TotalAmount) copy(dAtA[i:], x.TotalAmount) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.TotalAmount))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(x.Issuer) > 0 { i -= len(x.Issuer) copy(dAtA[i:], x.Issuer) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Issuer))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(x.BatchDenom) > 0 { i -= len(x.BatchDenom) copy(dAtA[i:], x.BatchDenom) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.BatchDenom))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(x.ClassId) > 0 { i -= len(x.ClassId) copy(dAtA[i:], x.ClassId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) i-- - dAtA[i] = 0x12 - } - if x.RowId != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1811,25 +1686,6 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - x.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1861,7 +1717,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) } @@ -1893,7 +1749,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.BatchDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } @@ -1925,7 +1781,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.Issuer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field TotalAmount", wireType) } @@ -1957,7 +1813,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.TotalAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field StartDate", wireType) } @@ -1989,7 +1845,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.StartDate = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field EndDate", wireType) } @@ -2021,7 +1877,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.EndDate = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) } @@ -2053,7 +1909,7 @@ func (x *fastReflection_EventCreateBatch) ProtoMethods() *protoiface.Methods { } x.ProjectLocation = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 9: + case 8: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -3975,12 +3831,10 @@ type EventCreateClass struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // admin is the admin of the credit class. - Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` + Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` } func (x *EventCreateClass) Reset() { @@ -4003,13 +3857,6 @@ func (*EventCreateClass) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_events_proto_rawDescGZIP(), []int{0} } -func (x *EventCreateClass) GetRowId() uint64 { - if x != nil { - return x.RowId - } - return 0 -} - func (x *EventCreateClass) GetClassId() string { if x != nil { return x.ClassId @@ -4030,17 +3877,15 @@ type EventCreateProject struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // project_id is the unique ID of the project. - ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` // class_id is the unique ID of credit class for this project. - ClassId string `protobuf:"bytes,3,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // issuer is the issuer of the credit batches for this project. - Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - ProjectLocation string `protobuf:"bytes,5,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` + ProjectLocation string `protobuf:"bytes,4,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` } func (x *EventCreateProject) Reset() { @@ -4063,13 +3908,6 @@ func (*EventCreateProject) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_events_proto_rawDescGZIP(), []int{1} } -func (x *EventCreateProject) GetRowId() uint64 { - if x != nil { - return x.RowId - } - return 0 -} - func (x *EventCreateProject) GetProjectId() string { if x != nil { return x.ProjectId @@ -4104,27 +3942,25 @@ type EventCreateBatch struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // batch_denom is the unique ID of credit batch. - BatchDenom string `protobuf:"bytes,3,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` // issuer is the account address of the issuer of the credit batch. - Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` // total_amount is the total number of credits in the credit batch. - TotalAmount string `protobuf:"bytes,5,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` + TotalAmount string `protobuf:"bytes,4,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` // start_date is the beginning of the period during which this credit batch // was quantified and verified. - StartDate string `protobuf:"bytes,6,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` + StartDate string `protobuf:"bytes,5,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` // end_date is the end of the period during which this credit batch was // quantified and verified. - EndDate string `protobuf:"bytes,7,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` + EndDate string `protobuf:"bytes,6,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - ProjectLocation string `protobuf:"bytes,8,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` + ProjectLocation string `protobuf:"bytes,7,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` // project_id is the unique ID of the project this batch belongs to. - ProjectId string `protobuf:"bytes,9,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` } func (x *EventCreateBatch) Reset() { @@ -4147,13 +3983,6 @@ func (*EventCreateBatch) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_events_proto_rawDescGZIP(), []int{2} } -func (x *EventCreateBatch) GetRowId() uint64 { - if x != nil { - return x.RowId - } - return 0 -} - func (x *EventCreateBatch) GetClassId() string { if x != nil { return x.ClassId @@ -4424,83 +4253,79 @@ var file_regen_ecocredit_v1beta1_events_proto_rawDesc = []byte{ 0x74, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x17, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x22, - 0x5a, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, + 0x43, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x91, 0x01, 0x0a, 0x12, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0xa8, 0x01, 0x0a, 0x12, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, - 0x73, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, - 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x6f, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xa4, 0x02, 0x0a, 0x10, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x72, - 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, - 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1f, 0x0a, - 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, - 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, - 0x64, 0x61, 0x74, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, - 0x61, 0x74, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, - 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, - 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0xb5, 0x01, - 0x0a, 0x0c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, - 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, - 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, - 0x6e, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, - 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, - 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, - 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, - 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x7c, 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, - 0x74, 0x69, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x72, 0x12, 0x1f, - 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, - 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x64, 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6e, 0x63, - 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x72, - 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, - 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xfc, 0x01, 0x0a, 0x1b, 0x63, 0x6f, - 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x52, 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, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, - 0x45, 0x58, 0xaa, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, - 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, - 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, - 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, - 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x29, 0x0a, + 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8d, 0x02, 0x0a, 0x10, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x19, 0x0a, + 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, + 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, + 0x75, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, + 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x41, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, + 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, + 0x61, 0x74, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x12, 0x29, + 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, + 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0xb5, 0x01, 0x0a, 0x0c, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, + 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, + 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, + 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, + 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x7c, 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, + 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x64, + 0x0a, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x1c, 0x0a, + 0x09, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x62, + 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x42, 0xfc, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x42, 0x0b, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x50, 0x01, 0x5a, 0x52, 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, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, + 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, + 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xe2, 0x02, 0x23, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, + 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/regen/ecocredit/v1beta1/tx.pulsar.go b/api/regen/ecocredit/v1beta1/tx.pulsar.go index d05005f871..771d4fae1a 100644 --- a/api/regen/ecocredit/v1beta1/tx.pulsar.go +++ b/api/regen/ecocredit/v1beta1/tx.pulsar.go @@ -690,14 +690,12 @@ func (x *fastReflection_MsgCreateClass) ProtoMethods() *protoiface.Methods { var ( md_MsgCreateClassResponse protoreflect.MessageDescriptor - fd_MsgCreateClassResponse_row_id protoreflect.FieldDescriptor fd_MsgCreateClassResponse_class_id protoreflect.FieldDescriptor ) func init() { file_regen_ecocredit_v1beta1_tx_proto_init() md_MsgCreateClassResponse = File_regen_ecocredit_v1beta1_tx_proto.Messages().ByName("MsgCreateClassResponse") - fd_MsgCreateClassResponse_row_id = md_MsgCreateClassResponse.Fields().ByName("row_id") fd_MsgCreateClassResponse_class_id = md_MsgCreateClassResponse.Fields().ByName("class_id") } @@ -766,12 +764,6 @@ func (x *fastReflection_MsgCreateClassResponse) Interface() protoreflect.ProtoMe // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgCreateClassResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.RowId != uint64(0) { - value := protoreflect.ValueOfUint64(x.RowId) - if !f(fd_MsgCreateClassResponse_row_id, value) { - return - } - } if x.ClassId != "" { value := protoreflect.ValueOfString(x.ClassId) if !f(fd_MsgCreateClassResponse_class_id, value) { @@ -793,8 +785,6 @@ func (x *fastReflection_MsgCreateClassResponse) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgCreateClassResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": - return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": return x.ClassId != "" default: @@ -813,8 +803,6 @@ func (x *fastReflection_MsgCreateClassResponse) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClassResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": - x.RowId = uint64(0) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": x.ClassId = "" default: @@ -833,9 +821,6 @@ func (x *fastReflection_MsgCreateClassResponse) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgCreateClassResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": - value := x.RowId - return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": value := x.ClassId return protoreflect.ValueOfString(value) @@ -859,8 +844,6 @@ func (x *fastReflection_MsgCreateClassResponse) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClassResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": - x.RowId = value.Uint() case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": x.ClassId = value.Interface().(string) default: @@ -883,8 +866,6 @@ func (x *fastReflection_MsgCreateClassResponse) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateClassResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": - panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.MsgCreateClassResponse is not mutable")) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": panic(fmt.Errorf("field class_id of message regen.ecocredit.v1beta1.MsgCreateClassResponse is not mutable")) default: @@ -900,8 +881,6 @@ func (x *fastReflection_MsgCreateClassResponse) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgCreateClassResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateClassResponse.row_id": - return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.MsgCreateClassResponse.class_id": return protoreflect.ValueOfString("") default: @@ -973,9 +952,6 @@ func (x *fastReflection_MsgCreateClassResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l - if x.RowId != 0 { - n += 1 + runtime.Sov(uint64(x.RowId)) - } l = len(x.ClassId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -1014,12 +990,7 @@ func (x *fastReflection_MsgCreateClassResponse) ProtoMethods() *protoiface.Metho copy(dAtA[i:], x.ClassId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) i-- - dAtA[i] = 0x12 - } - if x.RowId != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1071,25 +1042,6 @@ func (x *fastReflection_MsgCreateClassResponse) ProtoMethods() *protoiface.Metho } switch fieldNum { case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - x.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1836,14 +1788,12 @@ func (x *fastReflection_MsgCreateProject) ProtoMethods() *protoiface.Methods { var ( md_MsgCreateProjectResponse protoreflect.MessageDescriptor - fd_MsgCreateProjectResponse_row_id protoreflect.FieldDescriptor fd_MsgCreateProjectResponse_project_id protoreflect.FieldDescriptor ) func init() { file_regen_ecocredit_v1beta1_tx_proto_init() md_MsgCreateProjectResponse = File_regen_ecocredit_v1beta1_tx_proto.Messages().ByName("MsgCreateProjectResponse") - fd_MsgCreateProjectResponse_row_id = md_MsgCreateProjectResponse.Fields().ByName("row_id") fd_MsgCreateProjectResponse_project_id = md_MsgCreateProjectResponse.Fields().ByName("project_id") } @@ -1912,12 +1862,6 @@ func (x *fastReflection_MsgCreateProjectResponse) Interface() protoreflect.Proto // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgCreateProjectResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.RowId != uint64(0) { - value := protoreflect.ValueOfUint64(x.RowId) - if !f(fd_MsgCreateProjectResponse_row_id, value) { - return - } - } if x.ProjectId != "" { value := protoreflect.ValueOfString(x.ProjectId) if !f(fd_MsgCreateProjectResponse_project_id, value) { @@ -1939,8 +1883,6 @@ func (x *fastReflection_MsgCreateProjectResponse) Range(f func(protoreflect.Fiel // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgCreateProjectResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": - return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": return x.ProjectId != "" default: @@ -1959,8 +1901,6 @@ func (x *fastReflection_MsgCreateProjectResponse) Has(fd protoreflect.FieldDescr // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateProjectResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": - x.RowId = uint64(0) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": x.ProjectId = "" default: @@ -1979,9 +1919,6 @@ func (x *fastReflection_MsgCreateProjectResponse) Clear(fd protoreflect.FieldDes // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgCreateProjectResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": - value := x.RowId - return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": value := x.ProjectId return protoreflect.ValueOfString(value) @@ -2005,8 +1942,6 @@ func (x *fastReflection_MsgCreateProjectResponse) Get(descriptor protoreflect.Fi // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateProjectResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": - x.RowId = value.Uint() case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": x.ProjectId = value.Interface().(string) default: @@ -2029,8 +1964,6 @@ func (x *fastReflection_MsgCreateProjectResponse) Set(fd protoreflect.FieldDescr // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateProjectResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": - panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.MsgCreateProjectResponse is not mutable")) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": panic(fmt.Errorf("field project_id of message regen.ecocredit.v1beta1.MsgCreateProjectResponse is not mutable")) default: @@ -2046,8 +1979,6 @@ func (x *fastReflection_MsgCreateProjectResponse) Mutable(fd protoreflect.FieldD // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgCreateProjectResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.row_id": - return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.MsgCreateProjectResponse.project_id": return protoreflect.ValueOfString("") default: @@ -2119,9 +2050,6 @@ func (x *fastReflection_MsgCreateProjectResponse) ProtoMethods() *protoiface.Met var n int var l int _ = l - if x.RowId != 0 { - n += 1 + runtime.Sov(uint64(x.RowId)) - } l = len(x.ProjectId) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -2160,12 +2088,7 @@ func (x *fastReflection_MsgCreateProjectResponse) ProtoMethods() *protoiface.Met copy(dAtA[i:], x.ProjectId) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ProjectId))) i-- - dAtA[i] = 0x12 - } - if x.RowId != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -2217,25 +2140,6 @@ func (x *fastReflection_MsgCreateProjectResponse) ProtoMethods() *protoiface.Met } switch fieldNum { case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - x.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -3762,14 +3666,12 @@ func (x *fastReflection_MsgCreateBatch_BatchIssuance) ProtoMethods() *protoiface var ( md_MsgCreateBatchResponse protoreflect.MessageDescriptor - fd_MsgCreateBatchResponse_row_id protoreflect.FieldDescriptor fd_MsgCreateBatchResponse_batch_denom protoreflect.FieldDescriptor ) func init() { file_regen_ecocredit_v1beta1_tx_proto_init() md_MsgCreateBatchResponse = File_regen_ecocredit_v1beta1_tx_proto.Messages().ByName("MsgCreateBatchResponse") - fd_MsgCreateBatchResponse_row_id = md_MsgCreateBatchResponse.Fields().ByName("row_id") fd_MsgCreateBatchResponse_batch_denom = md_MsgCreateBatchResponse.Fields().ByName("batch_denom") } @@ -3838,12 +3740,6 @@ func (x *fastReflection_MsgCreateBatchResponse) Interface() protoreflect.ProtoMe // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_MsgCreateBatchResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.RowId != uint64(0) { - value := protoreflect.ValueOfUint64(x.RowId) - if !f(fd_MsgCreateBatchResponse_row_id, value) { - return - } - } if x.BatchDenom != "" { value := protoreflect.ValueOfString(x.BatchDenom) if !f(fd_MsgCreateBatchResponse_batch_denom, value) { @@ -3865,8 +3761,6 @@ func (x *fastReflection_MsgCreateBatchResponse) Range(f func(protoreflect.FieldD // a repeated field is populated if it is non-empty. func (x *fastReflection_MsgCreateBatchResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": - return x.RowId != uint64(0) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": return x.BatchDenom != "" default: @@ -3885,8 +3779,6 @@ func (x *fastReflection_MsgCreateBatchResponse) Has(fd protoreflect.FieldDescrip // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateBatchResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": - x.RowId = uint64(0) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": x.BatchDenom = "" default: @@ -3905,9 +3797,6 @@ func (x *fastReflection_MsgCreateBatchResponse) Clear(fd protoreflect.FieldDescr // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_MsgCreateBatchResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": - value := x.RowId - return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": value := x.BatchDenom return protoreflect.ValueOfString(value) @@ -3931,8 +3820,6 @@ func (x *fastReflection_MsgCreateBatchResponse) Get(descriptor protoreflect.Fiel // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateBatchResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": - x.RowId = value.Uint() case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": x.BatchDenom = value.Interface().(string) default: @@ -3955,8 +3842,6 @@ func (x *fastReflection_MsgCreateBatchResponse) Set(fd protoreflect.FieldDescrip // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgCreateBatchResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": - panic(fmt.Errorf("field row_id of message regen.ecocredit.v1beta1.MsgCreateBatchResponse is not mutable")) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": panic(fmt.Errorf("field batch_denom of message regen.ecocredit.v1beta1.MsgCreateBatchResponse is not mutable")) default: @@ -3972,8 +3857,6 @@ func (x *fastReflection_MsgCreateBatchResponse) Mutable(fd protoreflect.FieldDes // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_MsgCreateBatchResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.row_id": - return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.MsgCreateBatchResponse.batch_denom": return protoreflect.ValueOfString("") default: @@ -4045,9 +3928,6 @@ func (x *fastReflection_MsgCreateBatchResponse) ProtoMethods() *protoiface.Metho var n int var l int _ = l - if x.RowId != 0 { - n += 1 + runtime.Sov(uint64(x.RowId)) - } l = len(x.BatchDenom) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -4086,12 +3966,7 @@ func (x *fastReflection_MsgCreateBatchResponse) ProtoMethods() *protoiface.Metho copy(dAtA[i:], x.BatchDenom) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.BatchDenom))) i-- - dAtA[i] = 0x12 - } - if x.RowId != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -4143,25 +4018,6 @@ func (x *fastReflection_MsgCreateBatchResponse) ProtoMethods() *protoiface.Metho } switch fieldNum { case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - x.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) } @@ -11535,10 +11391,8 @@ type MsgCreateClassResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of the newly created credit class. - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } func (x *MsgCreateClassResponse) Reset() { @@ -11561,13 +11415,6 @@ func (*MsgCreateClassResponse) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_tx_proto_rawDescGZIP(), []int{1} } -func (x *MsgCreateClassResponse) GetRowId() uint64 { - if x != nil { - return x.RowId - } - return 0 -} - func (x *MsgCreateClassResponse) GetClassId() string { if x != nil { return x.ClassId @@ -11665,10 +11512,8 @@ type MsgCreateProjectResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // project_id is the ID of the newly created project. - ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` } func (x *MsgCreateProjectResponse) Reset() { @@ -11691,13 +11536,6 @@ func (*MsgCreateProjectResponse) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_tx_proto_rawDescGZIP(), []int{3} } -func (x *MsgCreateProjectResponse) GetRowId() uint64 { - if x != nil { - return x.RowId - } - return 0 -} - func (x *MsgCreateProjectResponse) GetProjectId() string { if x != nil { return x.ProjectId @@ -11795,10 +11633,8 @@ type MsgCreateBatchResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // batch_denom is the unique denomination ID of the newly created batch. - BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + BatchDenom string `protobuf:"bytes,1,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` } func (x *MsgCreateBatchResponse) Reset() { @@ -11821,13 +11657,6 @@ func (*MsgCreateBatchResponse) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_tx_proto_rawDescGZIP(), []int{5} } -func (x *MsgCreateBatchResponse) GetRowId() uint64 { - if x != nil { - return x.RowId - } - return 0 -} - func (x *MsgCreateBatchResponse) GetBatchDenom() string { if x != nil { return x.BatchDenom @@ -12584,214 +12413,210 @@ var file_regen_ecocredit_v1beta1_tx_proto_rawDesc = []byte{ 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x10, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x4a, 0x0a, 0x16, 0x4d, + 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x33, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x22, 0xab, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, + 0x22, 0xab, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, + 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, + 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x39, + 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0xe5, 0x03, 0x0a, 0x0e, 0x4d, 0x73, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, - 0x73, 0x75, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x29, 0x0a, 0x10, 0x70, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x6f, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x50, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0xe5, 0x03, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, - 0x73, 0x75, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, - 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, - 0x64, 0x12, 0x51, 0x0a, 0x08, 0x69, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x42, 0x61, 0x74, - 0x63, 0x68, 0x49, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x69, 0x73, 0x73, 0x75, - 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x3f, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, - 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, - 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, 0x1a, 0xae, - 0x01, 0x0a, 0x0d, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x27, - 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, - 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, - 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2f, - 0x0a, 0x13, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x63, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, 0x65, 0x74, - 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0x50, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, - 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x72, 0x6f, 0x77, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x72, 0x6f, 0x77, 0x49, 0x64, - 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, - 0x6d, 0x22, 0xb9, 0x02, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, - 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, - 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x1a, 0xaf, 0x01, 0x0a, 0x0b, - 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x62, + 0x73, 0x75, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x49, 0x64, 0x12, 0x51, 0x0a, 0x08, 0x69, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, + 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x2e, 0x42, + 0x61, 0x74, 0x63, 0x68, 0x49, 0x73, 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x08, 0x69, 0x73, + 0x73, 0x75, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x12, 0x3f, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x44, + 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x42, 0x04, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x65, + 0x1a, 0xae, 0x01, 0x0a, 0x0d, 0x42, 0x61, 0x74, 0x63, 0x68, 0x49, 0x73, 0x73, 0x75, 0x61, 0x6e, + 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, + 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, + 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, + 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x2f, 0x0a, 0x13, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, + 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, + 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x22, 0x39, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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, 0x22, 0xb9, 0x02, 0x0a, + 0x07, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x46, + 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, + 0x64, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x52, 0x07, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x1a, 0xaf, 0x01, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x43, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 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, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x64, 0x61, + 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, + 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x13, 0x72, 0x65, 0x74, 0x69, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x11, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x53, + 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xd5, 0x01, 0x0a, 0x09, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x6f, 0x6c, + 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x6c, 0x64, 0x65, + 0x72, 0x12, 0x4a, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x43, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x12, 0x1a, 0x0a, + 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x48, 0x0a, 0x0d, 0x52, 0x65, 0x74, + 0x69, 0x72, 0x65, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 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, 0x12, 0x16, 0x0a, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xb9, 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, + 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x4a, + 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, + 0x63, 0x65, 0x6c, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x1a, 0x48, 0x0a, 0x0d, 0x43, 0x61, + 0x6e, 0x63, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 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, 0x12, 0x27, 0x0a, 0x0f, - 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x64, 0x61, 0x62, 0x6c, 0x65, 0x41, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, - 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x72, - 0x65, 0x74, 0x69, 0x72, 0x65, 0x64, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x13, - 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x6f, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x72, 0x65, 0x74, 0x69, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x11, 0x0a, - 0x0f, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0xd5, 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x68, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x74, 0x69, - 0x72, 0x65, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x48, - 0x0a, 0x0d, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 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, - 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x52, - 0x65, 0x74, 0x69, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xb9, 0x01, - 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x68, - 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x6f, 0x6c, - 0x64, 0x65, 0x72, 0x12, 0x4a, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, - 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x1a, - 0x48, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, - 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, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x63, - 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x64, - 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x41, 0x64, - 0x6d, 0x69, 0x6e, 0x22, 0x1d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x62, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, - 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, - 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69, - 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x65, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, - 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, - 0x0a, 0x1e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x32, 0xc5, 0x07, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x6d, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x12, 0x29, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, + 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x63, 0x0a, 0x13, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, + 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, + 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x1d, + 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x62, 0x0a, + 0x15, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, + 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x73, 0x75, 0x65, + 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, + 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x65, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, + 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1a, 0x0a, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, 0x0a, 0x1e, 0x4d, 0x73, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc5, 0x07, 0x0a, 0x03, + 0x4d, 0x73, 0x67, 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x31, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x1a, 0x2f, 0x2e, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x0d, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x29, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, - 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, - 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x04, 0x53, 0x65, 0x6e, - 0x64, 0x12, 0x20, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, - 0x65, 0x6e, 0x64, 0x1a, 0x28, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, - 0x06, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x1a, 0x2a, 0x2e, 0x72, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, - 0x6c, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, - 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, - 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x76, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, - 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, - 0x6d, 0x69, 0x6e, 0x1a, 0x34, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0b, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, - 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, - 0x2e, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x1a, - 0x36, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2f, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x20, 0x2e, 0x72, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x1a, 0x28, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, - 0x37, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xf8, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x52, 0x65, 0x74, 0x69, + 0x72, 0x65, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, + 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x22, 0x2e, 0x72, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, + 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x10, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, + 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, + 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x1a, 0x34, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x52, 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, 0x62, 0x65, 0x74, 0x61, 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, - 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, - 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0xe2, 0x02, 0x23, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, - 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, - 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x2e, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x1a, 0x36, 0x2e, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, + 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x37, 0x2e, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0xf8, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, + 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x52, + 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, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, + 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x52, + 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/regen/ecocredit/v1beta1/events.proto b/proto/regen/ecocredit/v1beta1/events.proto index f1ab966b61..bc154e2883 100644 --- a/proto/regen/ecocredit/v1beta1/events.proto +++ b/proto/regen/ecocredit/v1beta1/events.proto @@ -6,66 +6,57 @@ option go_package = "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1"; // EventCreateClass is an event emitted when a credit class is created. message EventCreateClass { - // row_id is the id of the database row entry - uint64 row_id = 1; - // class_id is the unique ID of credit class. - string class_id = 2; + string class_id = 1; // admin is the admin of the credit class. - string admin = 3; + string admin = 2; } // EventCreateProject is an event emitted when a project is created. message EventCreateProject { - // row_id is the id of the database row entry - uint64 row_id = 1; - // project_id is the unique ID of the project. - string project_id = 2; + string project_id = 1; // class_id is the unique ID of credit class for this project. - string class_id = 3; + string class_id = 2; // issuer is the issuer of the credit batches for this project. - string issuer = 4; + string issuer = 3; // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - string project_location = 5; + string project_location = 4; } // EventCreateBatch is an event emitted when a credit batch is created. message EventCreateBatch { - // row_id is the id of the database row entry - uint64 row_id = 1; - // class_id is the unique ID of credit class. - string class_id = 2; + string class_id = 1; // batch_denom is the unique ID of credit batch. - string batch_denom = 3; + string batch_denom = 2; // issuer is the account address of the issuer of the credit batch. - string issuer = 4; + string issuer = 3; // total_amount is the total number of credits in the credit batch. - string total_amount = 5; + string total_amount = 4; // start_date is the beginning of the period during which this credit batch // was quantified and verified. - string start_date = 6; + string start_date = 5; // end_date is the end of the period during which this credit batch was // quantified and verified. - string end_date = 7; + string end_date = 6; // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - string project_location = 8; + string project_location = 7; // project_id is the unique ID of the project this batch belongs to. - string project_id = 9; + string project_id = 8; } // EventReceive is an event emitted when credits are received either upon diff --git a/proto/regen/ecocredit/v1beta1/tx.proto b/proto/regen/ecocredit/v1beta1/tx.proto index 9fe9b23db2..2d41919577 100644 --- a/proto/regen/ecocredit/v1beta1/tx.proto +++ b/proto/regen/ecocredit/v1beta1/tx.proto @@ -61,11 +61,8 @@ message MsgCreateClass { // MsgCreateClassResponse is the Msg/CreateClass response type. message MsgCreateClassResponse { - // row_id is the id of the database row entry - uint64 row_id = 1; - // class_id is the unique ID of the newly created credit class. - string class_id = 2; + string class_id = 1; } // MsgCreateProjectResponse is the Msg/CreateProject request type. @@ -99,11 +96,8 @@ message MsgCreateProject { // MsgCreateProjectResponse is the Msg/CreateProject response type. message MsgCreateProjectResponse { - // row_id is the id of the database row entry - uint64 row_id = 1; - // project_id is the ID of the newly created project. - string project_id = 2; + string project_id = 1; } // MsgCreateBatch is the Msg/CreateBatch request type. @@ -157,11 +151,8 @@ message MsgCreateBatch { // MsgCreateBatchResponse is the Msg/CreateBatch response type. message MsgCreateBatchResponse { - // row_id is the id of the database row entry - uint64 row_id = 1; - // batch_denom is the unique denomination ID of the newly created batch. - string batch_denom = 2; + string batch_denom = 1; } // MsgSend is the Msg/Send request type. diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index 3ee8c8de07..c9f0b33e66 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -55,13 +55,12 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } classID := ecocredit.FormatClassID(creditType.Abbreviation, classSeq) - rowID, err := s.stateStore.ClassInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ + if err = s.stateStore.ClassInfoStore().Insert(ctx, &ecocreditv1beta1.ClassInfo{ Name: classID, Admin: adminAddress, Metadata: req.Metadata, CreditType: req.CreditTypeName, - }) - if err != nil { + }); err != nil { return nil, err } @@ -76,7 +75,6 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateClass{ - RowId: rowID, ClassId: classID, Admin: req.Admin, }) @@ -84,7 +82,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass return nil, err } - return &v1beta1.MsgCreateClassResponse{RowId: rowID, ClassId: classID}, nil + return &v1beta1.MsgCreateClassResponse{ClassId: classID}, nil } // CreateProject creates a new project. @@ -117,18 +115,16 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro } } - rowID, err := s.stateStore.ProjectInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ProjectInfo{ + if err = s.stateStore.ProjectInfoStore().Insert(ctx, &ecocreditv1beta1.ProjectInfo{ Name: projectID, ClassId: classInfo.Id, ProjectLocation: req.ProjectLocation, Metadata: req.Metadata, - }) - if err != nil { + }); err != nil { return nil, err } if err := sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateProject{ - RowId: rowID, ClassId: classID, ProjectId: projectID, Issuer: req.Issuer, @@ -138,7 +134,6 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro } return &v1beta1.MsgCreateProjectResponse{ - RowId: rowID, ProjectId: projectID, }, nil } @@ -252,7 +247,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch return nil, err } - return &v1beta1.MsgCreateBatchResponse{RowId: rowID, BatchDenom: batchDenom}, nil + return &v1beta1.MsgCreateBatchResponse{BatchDenom: batchDenom}, nil } // Send sends credits to a recipient. diff --git a/x/ecocredit/v1beta1/events.pb.go b/x/ecocredit/v1beta1/events.pb.go index c95a95ff64..2d60f2d525 100644 --- a/x/ecocredit/v1beta1/events.pb.go +++ b/x/ecocredit/v1beta1/events.pb.go @@ -24,12 +24,10 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // EventCreateClass is an event emitted when a credit class is created. type EventCreateClass struct { - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // admin is the admin of the credit class. - Admin string `protobuf:"bytes,3,opt,name=admin,proto3" json:"admin,omitempty"` + Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` } func (m *EventCreateClass) Reset() { *m = EventCreateClass{} } @@ -65,13 +63,6 @@ func (m *EventCreateClass) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateClass proto.InternalMessageInfo -func (m *EventCreateClass) GetRowId() uint64 { - if m != nil { - return m.RowId - } - return 0 -} - func (m *EventCreateClass) GetClassId() string { if m != nil { return m.ClassId @@ -88,17 +79,15 @@ func (m *EventCreateClass) GetAdmin() string { // EventCreateProject is an event emitted when a project is created. type EventCreateProject struct { - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // project_id is the unique ID of the project. - ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` // class_id is the unique ID of credit class for this project. - ClassId string `protobuf:"bytes,3,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // issuer is the issuer of the credit batches for this project. - Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - ProjectLocation string `protobuf:"bytes,5,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` + ProjectLocation string `protobuf:"bytes,4,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` } func (m *EventCreateProject) Reset() { *m = EventCreateProject{} } @@ -134,13 +123,6 @@ func (m *EventCreateProject) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateProject proto.InternalMessageInfo -func (m *EventCreateProject) GetRowId() uint64 { - if m != nil { - return m.RowId - } - return 0 -} - func (m *EventCreateProject) GetProjectId() string { if m != nil { return m.ProjectId @@ -171,27 +153,25 @@ func (m *EventCreateProject) GetProjectLocation() string { // EventCreateBatch is an event emitted when a credit batch is created. type EventCreateBatch struct { - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // batch_denom is the unique ID of credit batch. - BatchDenom string `protobuf:"bytes,3,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` // issuer is the account address of the issuer of the credit batch. - Issuer string `protobuf:"bytes,4,opt,name=issuer,proto3" json:"issuer,omitempty"` + Issuer string `protobuf:"bytes,3,opt,name=issuer,proto3" json:"issuer,omitempty"` // total_amount is the total number of credits in the credit batch. - TotalAmount string `protobuf:"bytes,5,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` + TotalAmount string `protobuf:"bytes,4,opt,name=total_amount,json=totalAmount,proto3" json:"total_amount,omitempty"` // start_date is the beginning of the period during which this credit batch // was quantified and verified. - StartDate string `protobuf:"bytes,6,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` + StartDate string `protobuf:"bytes,5,opt,name=start_date,json=startDate,proto3" json:"start_date,omitempty"` // end_date is the end of the period during which this credit batch was // quantified and verified. - EndDate string `protobuf:"bytes,7,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` + EndDate string `protobuf:"bytes,6,opt,name=end_date,json=endDate,proto3" json:"end_date,omitempty"` // project_location is the location of the project. // Full documentation can be found in MsgCreateProject.project_location. - ProjectLocation string `protobuf:"bytes,8,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` + ProjectLocation string `protobuf:"bytes,7,opt,name=project_location,json=projectLocation,proto3" json:"project_location,omitempty"` // project_id is the unique ID of the project this batch belongs to. - ProjectId string `protobuf:"bytes,9,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,8,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` } func (m *EventCreateBatch) Reset() { *m = EventCreateBatch{} } @@ -227,13 +207,6 @@ func (m *EventCreateBatch) XXX_DiscardUnknown() { var xxx_messageInfo_EventCreateBatch proto.InternalMessageInfo -func (m *EventCreateBatch) GetRowId() uint64 { - if m != nil { - return m.RowId - } - return 0 -} - func (m *EventCreateBatch) GetClassId() string { if m != nil { return m.ClassId @@ -538,39 +511,38 @@ func init() { } var fileDescriptor_ead360ced581abaa = []byte{ - // 508 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xbd, 0x6e, 0x13, 0x41, - 0x14, 0x85, 0xb3, 0x4e, 0xfc, 0x77, 0x1d, 0x92, 0x68, 0xc5, 0xcf, 0x82, 0x60, 0x09, 0x2b, 0x10, - 0xa1, 0xc0, 0x56, 0x44, 0x45, 0x49, 0x1c, 0x8a, 0x48, 0x14, 0xc8, 0x74, 0x69, 0xac, 0xf1, 0xcc, - 0x95, 0x33, 0xb0, 0x9e, 0xb1, 0x66, 0xaf, 0x6d, 0x0a, 0x1e, 0x82, 0x87, 0xa0, 0xe0, 0x05, 0x78, - 0x07, 0xca, 0x94, 0x94, 0xc8, 0x7e, 0x11, 0x34, 0x3f, 0xeb, 0x60, 0xe3, 0x08, 0x29, 0x9d, 0xcf, - 0xb9, 0xc7, 0x73, 0xcf, 0x7e, 0x23, 0x0d, 0x3c, 0x35, 0x38, 0x44, 0xd5, 0x41, 0xae, 0xb9, 0x41, - 0x21, 0xa9, 0x33, 0x3d, 0x1e, 0x20, 0xb1, 0xe3, 0x0e, 0x4e, 0x51, 0x51, 0xd1, 0x1e, 0x1b, 0x4d, - 0x3a, 0xbe, 0xe7, 0x52, 0xed, 0x65, 0xaa, 0x1d, 0x52, 0xd9, 0x39, 0x1c, 0xbc, 0xb5, 0xc1, 0xae, - 0x41, 0x46, 0xd8, 0xcd, 0x59, 0x51, 0xc4, 0x77, 0xa0, 0x66, 0xf4, 0xac, 0x2f, 0x45, 0x12, 0x1d, - 0x46, 0x47, 0x3b, 0xbd, 0xaa, 0xd1, 0xb3, 0x33, 0x11, 0xdf, 0x87, 0x06, 0xb7, 0x73, 0x3b, 0xa8, - 0x1c, 0x46, 0x47, 0xcd, 0x5e, 0xdd, 0xe9, 0x33, 0x11, 0xdf, 0x86, 0x2a, 0x13, 0x23, 0xa9, 0x92, - 0x6d, 0xe7, 0x7b, 0x91, 0x7d, 0x8f, 0x20, 0xfe, 0xeb, 0xf0, 0xf7, 0x46, 0x7f, 0x44, 0x4e, 0xd7, - 0x1d, 0xff, 0x08, 0x60, 0xec, 0x13, 0x57, 0x0b, 0x9a, 0xc1, 0x59, 0xdb, 0xbe, 0xbd, 0xba, 0xfd, - 0x2e, 0xd4, 0x64, 0x51, 0x4c, 0xd0, 0x24, 0x3b, 0x6e, 0x10, 0x54, 0xfc, 0x02, 0x0e, 0xca, 0x13, - 0x73, 0xcd, 0x19, 0x49, 0xad, 0x92, 0xaa, 0x4b, 0xec, 0x07, 0xff, 0x5d, 0xb0, 0xb3, 0x6f, 0x95, - 0x15, 0x0e, 0x27, 0x8c, 0xf8, 0xc5, 0x0d, 0x38, 0x3c, 0x86, 0xd6, 0xc0, 0xfe, 0xb5, 0x2f, 0x50, - 0xe9, 0x51, 0xe8, 0x09, 0xce, 0x3a, 0xb5, 0xce, 0xb5, 0x55, 0x9f, 0xc0, 0x2e, 0x69, 0x62, 0x79, - 0x9f, 0x8d, 0xf4, 0x44, 0x51, 0xa8, 0xd9, 0x72, 0xde, 0x1b, 0x67, 0x59, 0x3e, 0x05, 0x31, 0x43, - 0x7d, 0xc1, 0x08, 0x93, 0x9a, 0xe7, 0xe3, 0x9c, 0x53, 0x46, 0x68, 0x5b, 0xa1, 0x12, 0x7e, 0x58, - 0xf7, 0xad, 0x50, 0x09, 0x37, 0xda, 0xc4, 0xa1, 0xb1, 0x91, 0xc3, 0xda, 0x25, 0x34, 0xd7, 0x2e, - 0x21, 0xfb, 0x11, 0xc1, 0xae, 0xc3, 0xd4, 0x43, 0x8e, 0x72, 0x8a, 0xf6, 0x7b, 0x0a, 0x54, 0x02, - 0x8d, 0x43, 0xd4, 0xec, 0x05, 0x15, 0x3f, 0x84, 0xa6, 0x41, 0x2e, 0xc7, 0x12, 0x15, 0x95, 0x77, - 0xb9, 0x34, 0xfe, 0x8f, 0xe9, 0x39, 0xec, 0x93, 0x61, 0x82, 0x0d, 0x72, 0x2c, 0x89, 0x78, 0x5e, - 0x7b, 0xa5, 0x1d, 0xa0, 0x3c, 0x83, 0x3d, 0x83, 0x24, 0x0d, 0x8a, 0x55, 0x72, 0xb7, 0x82, 0xeb, - 0x63, 0xd9, 0x17, 0x68, 0x85, 0xda, 0xd6, 0x8d, 0x13, 0xa8, 0xfb, 0x79, 0x59, 0xbb, 0x94, 0xeb, - 0xcd, 0x2a, 0x9b, 0x2e, 0x30, 0x2c, 0xf2, 0xad, 0x83, 0x8a, 0x1f, 0x40, 0x63, 0xc9, 0xd6, 0x57, - 0x5d, 0xea, 0x4c, 0x84, 0xed, 0x5d, 0xa6, 0x38, 0xe6, 0x96, 0x0d, 0x77, 0xbf, 0xf2, 0xe5, 0xfe, - 0x2b, 0xe3, 0xc6, 0x0d, 0x4e, 0x3e, 0xfc, 0x9c, 0xa7, 0xd1, 0xe5, 0x3c, 0x8d, 0x7e, 0xcf, 0xd3, - 0xe8, 0xeb, 0x22, 0xdd, 0xba, 0x5c, 0xa4, 0x5b, 0xbf, 0x16, 0xe9, 0xd6, 0xf9, 0xeb, 0xa1, 0xa4, - 0x8b, 0xc9, 0xa0, 0xcd, 0xf5, 0xa8, 0xe3, 0xde, 0x81, 0x97, 0x0a, 0x69, 0xa6, 0xcd, 0xa7, 0xa0, - 0x72, 0x14, 0x43, 0x34, 0x9d, 0xcf, 0xff, 0x3e, 0x22, 0x83, 0x9a, 0x7b, 0x3e, 0x5e, 0xfd, 0x09, - 0x00, 0x00, 0xff, 0xff, 0xe1, 0x8e, 0x71, 0x8c, 0x66, 0x04, 0x00, 0x00, + // 485 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xbf, 0x6e, 0x13, 0x41, + 0x10, 0xc6, 0x7d, 0x0e, 0xf1, 0x9f, 0x71, 0x48, 0xa2, 0x13, 0x82, 0x03, 0xc1, 0x01, 0x27, 0x10, + 0x50, 0xe0, 0x53, 0x44, 0x45, 0x49, 0x1c, 0x8a, 0x48, 0x14, 0x28, 0x74, 0x34, 0xd6, 0xde, 0xee, + 0xc8, 0x59, 0x38, 0xef, 0x5a, 0x7b, 0x63, 0x43, 0xc1, 0x2b, 0x20, 0xc1, 0xc3, 0xf0, 0x0e, 0x94, + 0x29, 0x29, 0x91, 0xfd, 0x22, 0x68, 0xff, 0x9c, 0x8d, 0x1d, 0x83, 0x10, 0xdd, 0xce, 0x6f, 0x3e, + 0xed, 0x7c, 0xf3, 0xdd, 0x2d, 0x3c, 0x30, 0x38, 0x42, 0x95, 0x23, 0xd7, 0xdc, 0xa0, 0x90, 0x94, + 0xcf, 0x8e, 0x0a, 0x24, 0x76, 0x94, 0xe3, 0x0c, 0x15, 0x55, 0xfd, 0x89, 0xd1, 0xa4, 0xe3, 0x1b, + 0x4e, 0xd5, 0x5f, 0xaa, 0xfa, 0x41, 0x95, 0x0d, 0xe0, 0xf0, 0xa5, 0x15, 0x0e, 0x0c, 0x32, 0xc2, + 0x41, 0xc9, 0xaa, 0x2a, 0xbe, 0x09, 0x1d, 0x6e, 0x0f, 0x43, 0x29, 0x92, 0xe8, 0x5e, 0xf4, 0xb8, + 0x7b, 0xd6, 0x76, 0xf5, 0xa9, 0x88, 0xaf, 0xc1, 0x2e, 0x13, 0x63, 0xa9, 0x92, 0xa6, 0xe3, 0xbe, + 0xc8, 0xbe, 0x46, 0x10, 0xff, 0x76, 0xcb, 0x6b, 0xa3, 0xdf, 0x21, 0xa7, 0xf8, 0x0e, 0xc0, 0xc4, + 0x1f, 0x57, 0x37, 0x75, 0x03, 0x39, 0x15, 0x6b, 0x63, 0x9a, 0xeb, 0x63, 0xae, 0x43, 0x4b, 0x56, + 0xd5, 0x14, 0x4d, 0xb2, 0xe3, 0x1a, 0xa1, 0x8a, 0x9f, 0xc0, 0x61, 0x7d, 0x63, 0xa9, 0x39, 0x23, + 0xa9, 0x55, 0x72, 0xc5, 0x29, 0x0e, 0x02, 0x7f, 0x15, 0x70, 0xf6, 0xb9, 0xb9, 0xb6, 0xd9, 0x31, + 0x23, 0x7e, 0xfe, 0xb7, 0xcd, 0xee, 0x42, 0xaf, 0xb0, 0x9a, 0xa1, 0x40, 0xa5, 0xc7, 0xc1, 0x10, + 0x38, 0x74, 0x62, 0xc9, 0x1f, 0x3d, 0xdd, 0x87, 0x3d, 0xd2, 0xc4, 0xca, 0x21, 0x1b, 0xeb, 0xa9, + 0xa2, 0xe0, 0xa7, 0xe7, 0xd8, 0x0b, 0x87, 0x6c, 0x10, 0x15, 0x31, 0x43, 0x43, 0xc1, 0x08, 0x93, + 0x5d, 0x1f, 0x84, 0x23, 0x27, 0x8c, 0xd0, 0xba, 0x42, 0x25, 0x7c, 0xb3, 0xe5, 0x5d, 0xa1, 0x12, + 0xae, 0xb5, 0x6d, 0xe1, 0xf6, 0xd6, 0x85, 0x37, 0xd2, 0xee, 0x6c, 0xa4, 0x9d, 0x7d, 0x8b, 0x60, + 0xcf, 0xe5, 0x71, 0x86, 0x1c, 0xe5, 0x0c, 0xed, 0x3e, 0x15, 0x2a, 0x81, 0x26, 0x24, 0x11, 0xaa, + 0xf8, 0x36, 0x74, 0x0d, 0x72, 0x39, 0x91, 0xa8, 0x28, 0xc4, 0xb0, 0x02, 0x9b, 0x31, 0xed, 0x5c, + 0x8a, 0xe9, 0x11, 0x1c, 0x90, 0x61, 0x82, 0x15, 0x25, 0xae, 0x27, 0xb2, 0x5f, 0xe3, 0x10, 0xca, + 0x43, 0xd8, 0x37, 0x48, 0xd2, 0xa0, 0xa8, 0x75, 0x3e, 0x98, 0xab, 0x81, 0x7a, 0x59, 0xf6, 0x09, + 0x7a, 0xc1, 0xb6, 0xa5, 0x71, 0x02, 0x6d, 0xdf, 0xaf, 0x6d, 0xd7, 0xe5, 0x3f, 0x7d, 0xc0, 0x30, + 0x28, 0x7c, 0x40, 0x5f, 0xc5, 0xb7, 0xa0, 0xb3, 0xf1, 0x33, 0x2d, 0xeb, 0x4c, 0x84, 0xe9, 0x03, + 0xa6, 0x38, 0x96, 0x36, 0x1b, 0xee, 0x4e, 0xe5, 0x72, 0xfe, 0x0a, 0xfc, 0xb7, 0x83, 0xe3, 0x37, + 0xdf, 0xe7, 0x69, 0x74, 0x31, 0x4f, 0xa3, 0x9f, 0xf3, 0x34, 0xfa, 0xb2, 0x48, 0x1b, 0x17, 0x8b, + 0xb4, 0xf1, 0x63, 0x91, 0x36, 0xde, 0x3e, 0x1f, 0x49, 0x3a, 0x9f, 0x16, 0x7d, 0xae, 0xc7, 0xb9, + 0x7b, 0xc2, 0x4f, 0x15, 0xd2, 0x07, 0x6d, 0xde, 0x87, 0xaa, 0x44, 0x31, 0x42, 0x93, 0x7f, 0xbc, + 0xfc, 0xfe, 0x8b, 0x96, 0x7b, 0xf9, 0xcf, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0xb6, 0xca, 0x79, + 0x8f, 0x21, 0x04, 0x00, 0x00, } func (m *EventCreateClass) Marshal() (dAtA []byte, err error) { @@ -598,19 +570,14 @@ func (m *EventCreateClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Admin) i = encodeVarintEvents(dAtA, i, uint64(len(m.Admin))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0x12 - } - if m.RowId != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -640,33 +607,28 @@ func (m *EventCreateProject) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ProjectLocation) i = encodeVarintEvents(dAtA, i, uint64(len(m.ProjectLocation))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(m.Issuer) > 0 { i -= len(m.Issuer) copy(dAtA[i:], m.Issuer) i = encodeVarintEvents(dAtA, i, uint64(len(m.Issuer))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(m.ProjectId) > 0 { i -= len(m.ProjectId) copy(dAtA[i:], m.ProjectId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ProjectId))) i-- - dAtA[i] = 0x12 - } - if m.RowId != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -696,61 +658,56 @@ func (m *EventCreateBatch) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ProjectId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ProjectId))) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 } if len(m.ProjectLocation) > 0 { i -= len(m.ProjectLocation) copy(dAtA[i:], m.ProjectLocation) i = encodeVarintEvents(dAtA, i, uint64(len(m.ProjectLocation))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a } if len(m.EndDate) > 0 { i -= len(m.EndDate) copy(dAtA[i:], m.EndDate) i = encodeVarintEvents(dAtA, i, uint64(len(m.EndDate))) i-- - dAtA[i] = 0x3a + dAtA[i] = 0x32 } if len(m.StartDate) > 0 { i -= len(m.StartDate) copy(dAtA[i:], m.StartDate) i = encodeVarintEvents(dAtA, i, uint64(len(m.StartDate))) i-- - dAtA[i] = 0x32 + dAtA[i] = 0x2a } if len(m.TotalAmount) > 0 { i -= len(m.TotalAmount) copy(dAtA[i:], m.TotalAmount) i = encodeVarintEvents(dAtA, i, uint64(len(m.TotalAmount))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } if len(m.Issuer) > 0 { i -= len(m.Issuer) copy(dAtA[i:], m.Issuer) i = encodeVarintEvents(dAtA, i, uint64(len(m.Issuer))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(m.BatchDenom) > 0 { i -= len(m.BatchDenom) copy(dAtA[i:], m.BatchDenom) i = encodeVarintEvents(dAtA, i, uint64(len(m.BatchDenom))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } if len(m.ClassId) > 0 { i -= len(m.ClassId) copy(dAtA[i:], m.ClassId) i = encodeVarintEvents(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0x12 - } - if m.RowId != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -925,9 +882,6 @@ func (m *EventCreateClass) Size() (n int) { } var l int _ = l - if m.RowId != 0 { - n += 1 + sovEvents(uint64(m.RowId)) - } l = len(m.ClassId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -945,9 +899,6 @@ func (m *EventCreateProject) Size() (n int) { } var l int _ = l - if m.RowId != 0 { - n += 1 + sovEvents(uint64(m.RowId)) - } l = len(m.ProjectId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -973,9 +924,6 @@ func (m *EventCreateBatch) Size() (n int) { } var l int _ = l - if m.RowId != 0 { - n += 1 + sovEvents(uint64(m.RowId)) - } l = len(m.ClassId) if l > 0 { n += 1 + l + sovEvents(uint64(l)) @@ -1122,25 +1070,6 @@ func (m *EventCreateClass) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - m.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1172,7 +1101,7 @@ func (m *EventCreateClass) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } @@ -1258,25 +1187,6 @@ func (m *EventCreateProject) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - m.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -1308,7 +1218,7 @@ func (m *EventCreateProject) Unmarshal(dAtA []byte) error { } m.ProjectId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1340,7 +1250,7 @@ func (m *EventCreateProject) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } @@ -1372,7 +1282,7 @@ func (m *EventCreateProject) Unmarshal(dAtA []byte) error { } m.Issuer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) } @@ -1458,25 +1368,6 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - m.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvents - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -1508,7 +1399,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.ClassId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) } @@ -1540,7 +1431,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.BatchDenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) } @@ -1572,7 +1463,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.Issuer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TotalAmount", wireType) } @@ -1604,7 +1495,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.TotalAmount = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field StartDate", wireType) } @@ -1636,7 +1527,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.StartDate = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EndDate", wireType) } @@ -1668,7 +1559,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.EndDate = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectLocation", wireType) } @@ -1700,7 +1591,7 @@ func (m *EventCreateBatch) Unmarshal(dAtA []byte) error { } m.ProjectLocation = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 9: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } diff --git a/x/ecocredit/v1beta1/tx.pb.go b/x/ecocredit/v1beta1/tx.pb.go index d2a7c914ed..17d0b0748b 100644 --- a/x/ecocredit/v1beta1/tx.pb.go +++ b/x/ecocredit/v1beta1/tx.pb.go @@ -107,10 +107,8 @@ func (m *MsgCreateClass) GetCreditTypeName() string { // MsgCreateClassResponse is the Msg/CreateClass response type. type MsgCreateClassResponse struct { - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // class_id is the unique ID of the newly created credit class. - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` } func (m *MsgCreateClassResponse) Reset() { *m = MsgCreateClassResponse{} } @@ -146,13 +144,6 @@ func (m *MsgCreateClassResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateClassResponse proto.InternalMessageInfo -func (m *MsgCreateClassResponse) GetRowId() uint64 { - if m != nil { - return m.RowId - } - return 0 -} - func (m *MsgCreateClassResponse) GetClassId() string { if m != nil { return m.ClassId @@ -255,10 +246,8 @@ func (m *MsgCreateProject) GetProjectId() string { // MsgCreateProjectResponse is the Msg/CreateProject response type. type MsgCreateProjectResponse struct { - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // project_id is the ID of the newly created project. - ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` } func (m *MsgCreateProjectResponse) Reset() { *m = MsgCreateProjectResponse{} } @@ -294,13 +283,6 @@ func (m *MsgCreateProjectResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateProjectResponse proto.InternalMessageInfo -func (m *MsgCreateProjectResponse) GetRowId() uint64 { - if m != nil { - return m.RowId - } - return 0 -} - func (m *MsgCreateProjectResponse) GetProjectId() string { if m != nil { return m.ProjectId @@ -485,10 +467,8 @@ func (m *MsgCreateBatch_BatchIssuance) GetRetirementLocation() string { // MsgCreateBatchResponse is the Msg/CreateBatch response type. type MsgCreateBatchResponse struct { - // row_id is the id of the database row entry - RowId uint64 `protobuf:"varint,1,opt,name=row_id,json=rowId,proto3" json:"row_id,omitempty"` // batch_denom is the unique denomination ID of the newly created batch. - BatchDenom string `protobuf:"bytes,2,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` + BatchDenom string `protobuf:"bytes,1,opt,name=batch_denom,json=batchDenom,proto3" json:"batch_denom,omitempty"` } func (m *MsgCreateBatchResponse) Reset() { *m = MsgCreateBatchResponse{} } @@ -524,13 +504,6 @@ func (m *MsgCreateBatchResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreateBatchResponse proto.InternalMessageInfo -func (m *MsgCreateBatchResponse) GetRowId() uint64 { - if m != nil { - return m.RowId - } - return 0 -} - func (m *MsgCreateBatchResponse) GetBatchDenom() string { if m != nil { return m.BatchDenom @@ -1365,70 +1338,70 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1beta1/tx.proto", fileDescriptor_a7efad3b6b8cd694) } var fileDescriptor_a7efad3b6b8cd694 = []byte{ - // 1008 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xaf, 0x93, 0x34, 0x69, 0x5e, 0x48, 0xdb, 0x9d, 0xee, 0x96, 0xe0, 0xa5, 0x69, 0x64, 0x09, - 0x35, 0x8b, 0xc0, 0xa6, 0xe5, 0x9f, 0x10, 0x07, 0xb4, 0xed, 0x0a, 0x6d, 0x56, 0x04, 0x15, 0xef, - 0x22, 0x21, 0x2e, 0xd1, 0xc4, 0x7e, 0xb8, 0x86, 0xd8, 0x13, 0xd9, 0xd3, 0xcd, 0xae, 0x84, 0xc4, - 0x8d, 0xf3, 0x7e, 0x0f, 0x24, 0x38, 0xef, 0x07, 0x40, 0xe2, 0xb8, 0x17, 0x24, 0x6e, 0xa0, 0x56, - 0x7c, 0x0f, 0xe4, 0x99, 0xb1, 0x1b, 0xa7, 0xd9, 0x38, 0x11, 0x48, 0x5c, 0xe2, 0xbe, 0x37, 0xbf, - 0xf7, 0x9b, 0xdf, 0x7b, 0x7e, 0x33, 0xcf, 0x85, 0x4e, 0x84, 0x1e, 0x86, 0x16, 0x3a, 0xcc, 0x89, - 0xd0, 0xf5, 0xb9, 0xf5, 0xf8, 0x70, 0x88, 0x9c, 0x1e, 0x5a, 0xfc, 0x89, 0x39, 0x8e, 0x18, 0x67, - 0xe4, 0x55, 0x81, 0x30, 0x33, 0x84, 0xa9, 0x10, 0xfa, 0x4d, 0x8f, 0x79, 0x4c, 0x60, 0xac, 0xe4, - 0x2f, 0x09, 0xd7, 0xf7, 0x3d, 0xc6, 0xbc, 0x11, 0x5a, 0xc2, 0x1a, 0x9e, 0x7f, 0x63, 0x71, 0x3f, - 0xc0, 0x98, 0xd3, 0x60, 0x2c, 0x01, 0xc6, 0x8f, 0x1a, 0x6c, 0xf6, 0x63, 0xef, 0x24, 0x42, 0xca, - 0xf1, 0x64, 0x44, 0xe3, 0x98, 0xdc, 0x84, 0x75, 0xea, 0x06, 0x7e, 0xd8, 0xd2, 0x3a, 0x5a, 0xb7, - 0x6e, 0x4b, 0x83, 0xb4, 0xa0, 0xe6, 0xc7, 0xf1, 0x39, 0x46, 0x71, 0xab, 0xd4, 0x29, 0x77, 0xeb, - 0x76, 0x6a, 0x12, 0x1d, 0x36, 0x02, 0xe4, 0xd4, 0xa5, 0x9c, 0xb6, 0xca, 0x1d, 0xad, 0xfb, 0x8a, - 0x9d, 0xd9, 0xa4, 0x0b, 0xdb, 0x52, 0xe7, 0x80, 0x3f, 0x1d, 0xe3, 0x20, 0xa4, 0x01, 0xb6, 0x2a, - 0x82, 0x76, 0x53, 0xfa, 0x1f, 0x3d, 0x1d, 0xe3, 0xe7, 0x34, 0x40, 0xe3, 0x01, 0xec, 0xe6, 0x75, - 0xd8, 0x18, 0x8f, 0x59, 0x18, 0x23, 0xb9, 0x05, 0xd5, 0x88, 0x4d, 0x06, 0xbe, 0x2b, 0x04, 0x55, - 0xec, 0xf5, 0x88, 0x4d, 0x7a, 0x2e, 0x79, 0x0d, 0x36, 0x9c, 0x04, 0x97, 0x2c, 0x94, 0x04, 0x65, - 0x4d, 0xd8, 0x3d, 0xd7, 0xf8, 0x49, 0x83, 0xed, 0x8c, 0xec, 0x34, 0x62, 0xdf, 0xa2, 0xc3, 0xc9, - 0x2e, 0x54, 0xa5, 0x62, 0x95, 0x97, 0xb2, 0x16, 0xf0, 0x2c, 0xcc, 0xec, 0x0e, 0x6c, 0x8f, 0x25, - 0xf3, 0x60, 0xc4, 0x1c, 0xca, 0x7d, 0x16, 0xaa, 0xcc, 0xb6, 0x94, 0xff, 0x33, 0xe5, 0x26, 0x7b, - 0x00, 0x29, 0xd4, 0x77, 0x5b, 0xeb, 0x02, 0x54, 0x57, 0x9e, 0x9e, 0x6b, 0x9c, 0x42, 0x6b, 0x56, - 0x6c, 0x51, 0xee, 0x79, 0xc6, 0xd2, 0x2c, 0xe3, 0xdf, 0xe5, 0xa9, 0x97, 0x7a, 0x4c, 0xb9, 0x73, - 0xf6, 0xd2, 0xec, 0x17, 0x33, 0x91, 0x2f, 0x60, 0x23, 0x01, 0xd2, 0xd0, 0xc1, 0x56, 0xb9, 0x53, - 0xee, 0x36, 0x8e, 0xde, 0x37, 0x5f, 0xd2, 0x81, 0x66, 0x7e, 0x47, 0x53, 0xfc, 0xf6, 0x54, 0xb0, - 0x9d, 0xd1, 0xe4, 0x8a, 0x5a, 0x99, 0x29, 0xea, 0x27, 0x00, 0x31, 0xa7, 0x11, 0x1f, 0xb8, 0x94, - 0xa3, 0xa8, 0x54, 0xe3, 0x48, 0x37, 0x65, 0x0f, 0x9b, 0x69, 0x0f, 0x9b, 0x8f, 0xd2, 0x1e, 0x3e, - 0xae, 0x3c, 0xfb, 0x73, 0x5f, 0xb3, 0xeb, 0x22, 0xe6, 0x1e, 0xe5, 0x48, 0x3e, 0x86, 0x0d, 0x0c, - 0x5d, 0x19, 0x5e, 0x5d, 0x32, 0xbc, 0x86, 0xa1, 0x9b, 0x04, 0xeb, 0x3f, 0x6b, 0xd0, 0xcc, 0xa9, - 0x26, 0xaf, 0x43, 0x3d, 0x42, 0xc7, 0x1f, 0xfb, 0x18, 0x72, 0x55, 0xb8, 0x2b, 0x07, 0x39, 0x80, - 0x2d, 0x1e, 0x51, 0x97, 0x0e, 0x47, 0x38, 0xa0, 0x01, 0x3b, 0x0f, 0xb9, 0x2a, 0xe0, 0x66, 0xea, - 0xbe, 0x2b, 0xbc, 0xe4, 0x0d, 0xd8, 0x8c, 0x90, 0xfb, 0x11, 0xba, 0x29, 0xae, 0x2c, 0x70, 0x4d, - 0xe5, 0x55, 0x30, 0x0b, 0x76, 0xa4, 0x23, 0xc0, 0xf0, 0x5a, 0x57, 0x91, 0xab, 0xa5, 0xb4, 0xb1, - 0x8c, 0xd3, 0xa9, 0x33, 0x23, 0x84, 0x17, 0xf5, 0xcd, 0x3e, 0x34, 0x86, 0x09, 0x6e, 0xe0, 0x62, - 0xc8, 0x02, 0xa5, 0x16, 0x84, 0xeb, 0x5e, 0xe2, 0x31, 0x9e, 0x97, 0xa0, 0xd6, 0x8f, 0xbd, 0x87, - 0x18, 0xba, 0x49, 0xcb, 0xc4, 0x18, 0xba, 0x57, 0x2d, 0x23, 0xad, 0x7c, 0x51, 0x4a, 0xb3, 0x45, - 0xf9, 0x14, 0x6a, 0xb2, 0x2f, 0x62, 0xd5, 0x30, 0x6f, 0x2d, 0x6a, 0x98, 0x64, 0x23, 0x33, 0xf9, - 0x39, 0x91, 0x31, 0x76, 0x1a, 0xac, 0xff, 0xa2, 0x41, 0x63, 0x6a, 0x61, 0x56, 0xba, 0x36, 0x2b, - 0xfd, 0xff, 0x7f, 0x1b, 0x37, 0x60, 0x4b, 0x65, 0x94, 0xbe, 0x06, 0xe3, 0x77, 0x0d, 0xea, 0xfd, - 0xd8, 0xb3, 0x05, 0x38, 0x29, 0xe8, 0x19, 0x1b, 0x4d, 0x15, 0x54, 0x5a, 0xe4, 0xc1, 0x55, 0xc9, - 0x4a, 0xa2, 0x64, 0xef, 0x2c, 0x2a, 0x99, 0x24, 0x33, 0xe5, 0x63, 0xb6, 0x6c, 0xc9, 0xe9, 0xca, - 0xa4, 0xca, 0xb4, 0x32, 0x5b, 0xbf, 0x0f, 0xcd, 0x5c, 0x54, 0x71, 0x4d, 0x77, 0xa1, 0x9a, 0x2b, - 0xa5, 0xb2, 0x8c, 0x1d, 0xb8, 0x91, 0x29, 0xc9, 0x92, 0x7d, 0x2e, 0x93, 0x3d, 0x49, 0x4e, 0xce, - 0xe8, 0x3f, 0x4a, 0x56, 0x92, 0x99, 0xf2, 0x71, 0xad, 0x47, 0xee, 0x43, 0x33, 0xb7, 0xf2, 0x6f, - 0x13, 0x92, 0x64, 0x59, 0x42, 0x0e, 0xec, 0xf4, 0x63, 0xef, 0xcb, 0xb1, 0x9b, 0x8e, 0xa4, 0xbb, - 0x62, 0x12, 0xce, 0x9f, 0x8f, 0x0b, 0xc6, 0xc8, 0x6d, 0xa8, 0x87, 0x38, 0x19, 0xc8, 0x20, 0xf5, - 0x52, 0x42, 0x9c, 0x08, 0x36, 0x63, 0x0f, 0x6e, 0xcf, 0xd9, 0x24, 0xd3, 0x30, 0x84, 0x5b, 0xf9, - 0xe5, 0x9e, 0x9a, 0xba, 0x2b, 0xab, 0x98, 0x1a, 0xe0, 0xe5, 0xdc, 0x00, 0x37, 0xf6, 0x61, 0x6f, - 0xee, 0x1e, 0x99, 0x08, 0x14, 0xf7, 0xcc, 0x14, 0xa0, 0x9f, 0x5e, 0xd8, 0x2b, 0xab, 0x58, 0x30, - 0x52, 0x8d, 0x0e, 0xb4, 0xe7, 0x6f, 0x93, 0x0a, 0x39, 0xfa, 0xb5, 0x06, 0xe5, 0x7e, 0xec, 0x11, - 0x0f, 0x1a, 0xd3, 0x5f, 0x2c, 0x07, 0xc5, 0x33, 0x49, 0x00, 0x75, 0x6b, 0x49, 0x60, 0x76, 0x8f, - 0x06, 0xd0, 0xcc, 0x7f, 0x45, 0xdc, 0x29, 0x66, 0x50, 0x50, 0xfd, 0x70, 0x69, 0x68, 0xb6, 0x5d, - 0x96, 0x97, 0x1c, 0xda, 0x07, 0x4b, 0xce, 0xda, 0x65, 0xf2, 0xca, 0xcf, 0x07, 0x1b, 0x2a, 0xe2, - 0x8e, 0xef, 0x14, 0x5d, 0xce, 0x7a, 0xb7, 0x08, 0x91, 0x71, 0x7e, 0x05, 0x55, 0x75, 0xd1, 0x19, - 0xc5, 0xf7, 0x97, 0xfe, 0x66, 0x31, 0x66, 0x9a, 0x59, 0xdd, 0x2a, 0x46, 0xf1, 0x65, 0xb1, 0x98, - 0x39, 0x7f, 0xc4, 0xc9, 0x63, 0xd8, 0xbe, 0x76, 0xbe, 0x17, 0x0e, 0xac, 0x59, 0xb4, 0xfe, 0xde, - 0x2a, 0xe8, 0x6c, 0xdf, 0xef, 0x81, 0xcc, 0x39, 0xd3, 0xe6, 0x92, 0x5c, 0x0a, 0xaf, 0x7f, 0xb0, - 0x1a, 0x3e, 0xdb, 0xfd, 0x07, 0xd8, 0x99, 0x77, 0x98, 0xad, 0x25, 0xe9, 0xd2, 0x00, 0xfd, 0xc3, - 0x15, 0x03, 0x52, 0x01, 0xc7, 0x0f, 0x7f, 0xbb, 0x68, 0x6b, 0x2f, 0x2e, 0xda, 0xda, 0x5f, 0x17, - 0x6d, 0xed, 0xd9, 0x65, 0x7b, 0xed, 0xc5, 0x65, 0x7b, 0xed, 0x8f, 0xcb, 0xf6, 0xda, 0xd7, 0x1f, - 0x79, 0x3e, 0x3f, 0x3b, 0x1f, 0x9a, 0x0e, 0x0b, 0x2c, 0x41, 0xfe, 0x76, 0x88, 0x7c, 0xc2, 0xa2, - 0xef, 0x94, 0x35, 0x42, 0xd7, 0xc3, 0xc8, 0x7a, 0x72, 0xfd, 0x7f, 0xa4, 0x61, 0x55, 0x7c, 0xe1, - 0xbd, 0xfb, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x29, 0x06, 0x13, 0xc8, 0x45, 0x0d, 0x00, 0x00, + // 993 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xdf, 0x6f, 0xe3, 0xc4, + 0x13, 0xaf, 0x93, 0x5e, 0xd2, 0x4c, 0xbe, 0x69, 0x7b, 0xdb, 0xfb, 0x96, 0xe0, 0xa3, 0x69, 0x64, + 0x09, 0x35, 0x87, 0xc0, 0xa6, 0x3d, 0x7e, 0xa8, 0xe2, 0x01, 0x5d, 0x7b, 0x42, 0x57, 0x44, 0x10, + 0xf8, 0x0e, 0x09, 0xf1, 0x12, 0x6d, 0xec, 0xc1, 0x35, 0xc4, 0x76, 0x64, 0x6f, 0xaf, 0x77, 0x12, + 0x12, 0x6f, 0x3c, 0xdf, 0xff, 0x81, 0x04, 0xcf, 0xf7, 0x07, 0x20, 0xf1, 0x78, 0x2f, 0x48, 0xbc, + 0x81, 0x5a, 0xf1, 0x7f, 0x20, 0xef, 0xae, 0xb7, 0xd9, 0x34, 0x17, 0x27, 0x02, 0x89, 0x97, 0xa4, + 0x33, 0xfe, 0xcc, 0x67, 0x3f, 0x33, 0x99, 0x9d, 0x71, 0xa1, 0x9b, 0x62, 0x80, 0xb1, 0x83, 0x5e, + 0xe2, 0xa5, 0xe8, 0x87, 0xcc, 0x79, 0xbc, 0x3f, 0x44, 0x46, 0xf7, 0x1d, 0xf6, 0xc4, 0x1e, 0xa7, + 0x09, 0x4b, 0xc8, 0x2b, 0x1c, 0x61, 0x2b, 0x84, 0x2d, 0x11, 0xe6, 0xad, 0x20, 0x09, 0x12, 0x8e, + 0x71, 0xf2, 0xbf, 0x04, 0xdc, 0xdc, 0x0d, 0x92, 0x24, 0x18, 0xa1, 0xc3, 0xad, 0xe1, 0xd9, 0xd7, + 0x0e, 0x0b, 0x23, 0xcc, 0x18, 0x8d, 0xc6, 0x02, 0x60, 0xfd, 0x60, 0xc0, 0x7a, 0x3f, 0x0b, 0x8e, + 0x53, 0xa4, 0x0c, 0x8f, 0x47, 0x34, 0xcb, 0xc8, 0x2d, 0xb8, 0x41, 0xfd, 0x28, 0x8c, 0xdb, 0x46, + 0xd7, 0xe8, 0x35, 0x5c, 0x61, 0x90, 0x36, 0xd4, 0xc3, 0x2c, 0x3b, 0xc3, 0x34, 0x6b, 0x57, 0xba, + 0xd5, 0x5e, 0xc3, 0x2d, 0x4c, 0x62, 0xc2, 0x5a, 0x84, 0x8c, 0xfa, 0x94, 0xd1, 0x76, 0xb5, 0x6b, + 0xf4, 0xfe, 0xe7, 0x2a, 0x9b, 0xf4, 0x60, 0x53, 0xe8, 0x1c, 0xb0, 0xa7, 0x63, 0x1c, 0xc4, 0x34, + 0xc2, 0xf6, 0x2a, 0xa7, 0x5d, 0x17, 0xfe, 0x47, 0x4f, 0xc7, 0xf8, 0x29, 0x8d, 0xd0, 0xba, 0x0b, + 0xdb, 0xba, 0x0e, 0x17, 0xb3, 0x71, 0x12, 0x67, 0x48, 0x5e, 0x85, 0x35, 0x2f, 0x77, 0x0c, 0x42, + 0x5f, 0x4a, 0xaa, 0x73, 0xfb, 0xc4, 0xb7, 0x7e, 0x34, 0x60, 0x53, 0x45, 0x7d, 0x96, 0x26, 0xdf, + 0xa0, 0xc7, 0xc8, 0x36, 0xd4, 0x84, 0x34, 0x89, 0x96, 0x96, 0xc6, 0x53, 0xd1, 0x78, 0xe6, 0xa6, + 0x70, 0x07, 0x36, 0xc7, 0x82, 0x79, 0x30, 0x4a, 0x3c, 0xca, 0xc2, 0x24, 0x96, 0x29, 0x6c, 0x48, + 0xff, 0x27, 0xd2, 0x4d, 0x76, 0x00, 0x0a, 0x68, 0xe8, 0xb7, 0x6f, 0x70, 0x50, 0x43, 0x7a, 0x4e, + 0x7c, 0xeb, 0x10, 0xda, 0xd3, 0x62, 0x55, 0x92, 0x7a, 0xa8, 0x31, 0x1d, 0xfa, 0x57, 0x75, 0xe2, + 0x67, 0x3a, 0xa2, 0xcc, 0x3b, 0x7d, 0x69, 0x9a, 0x3a, 0x53, 0x65, 0x8a, 0x89, 0x7c, 0x0e, 0x6b, + 0x39, 0x90, 0xc6, 0x1e, 0xb6, 0xab, 0xdd, 0x6a, 0xaf, 0x79, 0xf0, 0xae, 0xfd, 0x92, 0x9e, 0xb2, + 0xf5, 0x13, 0x6d, 0xfe, 0x79, 0x22, 0x83, 0x5d, 0x45, 0xa3, 0x55, 0x6f, 0x75, 0xaa, 0x7a, 0x1f, + 0x02, 0x64, 0x8c, 0xa6, 0x6c, 0xe0, 0x53, 0x86, 0xbc, 0x24, 0xcd, 0x03, 0xd3, 0x16, 0x5d, 0x69, + 0x17, 0x5d, 0x69, 0x3f, 0x2a, 0xba, 0xf2, 0x68, 0xf5, 0xd9, 0x1f, 0xbb, 0x86, 0xdb, 0xe0, 0x31, + 0xf7, 0x29, 0x43, 0xf2, 0x01, 0xac, 0x61, 0xec, 0x8b, 0xf0, 0xda, 0x82, 0xe1, 0x75, 0x8c, 0xfd, + 0x3c, 0xd8, 0xfc, 0xc9, 0x80, 0x96, 0xa6, 0x9a, 0xbc, 0x06, 0x8d, 0x14, 0xbd, 0x70, 0x1c, 0x62, + 0xcc, 0x8a, 0x32, 0x2b, 0x07, 0xd9, 0x83, 0x0d, 0x96, 0x52, 0x9f, 0x0e, 0x47, 0x38, 0xa0, 0x51, + 0x72, 0x16, 0x33, 0x59, 0xc0, 0xf5, 0xc2, 0x7d, 0x8f, 0x7b, 0xc9, 0xeb, 0xb0, 0x9e, 0x22, 0x0b, + 0x53, 0xf4, 0x0b, 0x5c, 0x95, 0xe3, 0x5a, 0xd2, 0x2b, 0x61, 0x0e, 0x6c, 0x09, 0x47, 0x84, 0xf1, + 0xb5, 0xf6, 0x21, 0x57, 0x8f, 0x8a, 0x0e, 0xb2, 0x0e, 0x27, 0x6e, 0x01, 0x17, 0xae, 0x1a, 0x64, + 0x17, 0x9a, 0xc3, 0xdc, 0x31, 0xf0, 0x31, 0x4e, 0x22, 0x29, 0x1d, 0xb8, 0xeb, 0x7e, 0xee, 0xb1, + 0x9e, 0x57, 0xa0, 0xde, 0xcf, 0x82, 0x87, 0x18, 0xfb, 0x79, 0x6f, 0x64, 0x18, 0xfb, 0x57, 0xbd, + 0x21, 0x2c, 0x3d, 0xfb, 0xca, 0x74, 0xf6, 0x1f, 0x41, 0x5d, 0x34, 0x40, 0x26, 0x3b, 0xe3, 0xcd, + 0x79, 0x9d, 0x91, 0x1f, 0x64, 0xe7, 0x1f, 0xc7, 0x22, 0xc6, 0x2d, 0x82, 0xcd, 0x9f, 0x0d, 0x68, + 0x4e, 0x3c, 0x28, 0x95, 0xfe, 0xdf, 0x97, 0xfd, 0x26, 0x6c, 0xc8, 0x8c, 0x8a, 0x7a, 0x5b, 0xbf, + 0x19, 0xd0, 0xe8, 0x67, 0x81, 0xcb, 0xc1, 0x79, 0x41, 0x4f, 0x93, 0xd1, 0x44, 0x41, 0x85, 0x45, + 0x3e, 0xbe, 0x2a, 0x59, 0x85, 0x97, 0xec, 0xed, 0x79, 0x25, 0x13, 0x64, 0xb6, 0xf8, 0x9a, 0x2e, + 0x5b, 0x7e, 0x8d, 0x94, 0x54, 0x91, 0x96, 0xb2, 0xcd, 0x07, 0xd0, 0xd2, 0xa2, 0xca, 0x6b, 0xba, + 0x0d, 0x35, 0xad, 0x94, 0xd2, 0xb2, 0xb6, 0xe0, 0xa6, 0x52, 0xa2, 0x92, 0x7d, 0x2e, 0x92, 0x3d, + 0xce, 0xaf, 0xc8, 0xe8, 0x5f, 0x4a, 0x56, 0x90, 0xd9, 0xe2, 0xeb, 0x5a, 0x8f, 0x3c, 0x80, 0x96, + 0xf6, 0xe4, 0x9f, 0x26, 0x24, 0xc8, 0x54, 0x42, 0x1e, 0x6c, 0xf5, 0xb3, 0xe0, 0x8b, 0xb1, 0x5f, + 0x6c, 0x93, 0x7b, 0x7c, 0x89, 0xcd, 0x5e, 0x6d, 0x73, 0x16, 0xc3, 0x6d, 0x68, 0xc4, 0x78, 0x3e, + 0x10, 0x41, 0xf2, 0x47, 0x89, 0xf1, 0x9c, 0xb3, 0x59, 0x3b, 0x70, 0x7b, 0xc6, 0x21, 0x4a, 0xc3, + 0x10, 0xfe, 0xaf, 0x3f, 0x3e, 0x91, 0x0b, 0x73, 0x69, 0x15, 0x13, 0xbb, 0xb7, 0xaa, 0xed, 0x5e, + 0x6b, 0x17, 0x76, 0x66, 0x9e, 0xa1, 0x44, 0x20, 0x1f, 0x28, 0x13, 0x80, 0x7e, 0x31, 0x99, 0x97, + 0x56, 0x31, 0x67, 0x49, 0x5a, 0x5d, 0xe8, 0xcc, 0x3e, 0xa6, 0x10, 0x72, 0xf0, 0x4b, 0x1d, 0xaa, + 0xfd, 0x2c, 0x20, 0x01, 0x34, 0x27, 0x5f, 0x36, 0xf6, 0xca, 0x97, 0x0f, 0x07, 0x9a, 0xce, 0x82, + 0x40, 0x35, 0x30, 0x23, 0x68, 0xe9, 0xef, 0x05, 0x77, 0xca, 0x19, 0x24, 0xd4, 0xdc, 0x5f, 0x18, + 0xaa, 0x8e, 0x53, 0x79, 0x89, 0xed, 0xbc, 0xb7, 0xe0, 0x52, 0x5d, 0x24, 0x2f, 0x7d, 0x11, 0xb8, + 0xb0, 0xca, 0x67, 0x7c, 0xb7, 0x6c, 0x38, 0x9b, 0xbd, 0x32, 0x84, 0xe2, 0xfc, 0x12, 0x6a, 0x72, + 0xd0, 0x59, 0xe5, 0xf3, 0xcb, 0x7c, 0xa3, 0x1c, 0x33, 0xc9, 0x2c, 0xa7, 0x8a, 0x55, 0x3e, 0x2c, + 0xe6, 0x33, 0xeb, 0x57, 0x9c, 0x3c, 0x86, 0xcd, 0x6b, 0xf7, 0x7b, 0xee, 0xc2, 0x9a, 0x46, 0x9b, + 0xef, 0x2c, 0x83, 0x56, 0xe7, 0x7e, 0x07, 0x64, 0xc6, 0x9d, 0xb6, 0x17, 0xe4, 0x92, 0x78, 0xf3, + 0xbd, 0xe5, 0xf0, 0xea, 0xf4, 0xef, 0x61, 0x6b, 0xd6, 0x65, 0x76, 0x16, 0xa4, 0x2b, 0x02, 0xcc, + 0xf7, 0x97, 0x0c, 0x28, 0x04, 0x1c, 0x3d, 0xfc, 0xf5, 0xa2, 0x63, 0xbc, 0xb8, 0xe8, 0x18, 0x7f, + 0x5e, 0x74, 0x8c, 0x67, 0x97, 0x9d, 0x95, 0x17, 0x97, 0x9d, 0x95, 0xdf, 0x2f, 0x3b, 0x2b, 0x5f, + 0x1d, 0x06, 0x21, 0x3b, 0x3d, 0x1b, 0xda, 0x5e, 0x12, 0x39, 0x9c, 0xfc, 0xad, 0x18, 0xd9, 0x79, + 0x92, 0x7e, 0x2b, 0xad, 0x11, 0xfa, 0x01, 0xa6, 0xce, 0x93, 0xeb, 0xff, 0xde, 0x0c, 0x6b, 0xfc, + 0x55, 0xee, 0xee, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xce, 0x80, 0xf6, 0x00, 0x0d, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1907,12 +1880,7 @@ func (m *MsgCreateClassResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) copy(dAtA[i:], m.ClassId) i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) i-- - dAtA[i] = 0x12 - } - if m.RowId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2000,12 +1968,7 @@ func (m *MsgCreateProjectResponse) MarshalToSizedBuffer(dAtA []byte) (int, error copy(dAtA[i:], m.ProjectId) i = encodeVarintTx(dAtA, i, uint64(len(m.ProjectId))) i-- - dAtA[i] = 0x12 - } - if m.RowId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2164,12 +2127,7 @@ func (m *MsgCreateBatchResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) copy(dAtA[i:], m.BatchDenom) i = encodeVarintTx(dAtA, i, uint64(len(m.BatchDenom))) i-- - dAtA[i] = 0x12 - } - if m.RowId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.RowId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2761,9 +2719,6 @@ func (m *MsgCreateClassResponse) Size() (n int) { } var l int _ = l - if m.RowId != 0 { - n += 1 + sovTx(uint64(m.RowId)) - } l = len(m.ClassId) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -2806,9 +2761,6 @@ func (m *MsgCreateProjectResponse) Size() (n int) { } var l int _ = l - if m.RowId != 0 { - n += 1 + sovTx(uint64(m.RowId)) - } l = len(m.ProjectId) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -2882,9 +2834,6 @@ func (m *MsgCreateBatchResponse) Size() (n int) { } var l int _ = l - if m.RowId != 0 { - n += 1 + sovTx(uint64(m.RowId)) - } l = len(m.BatchDenom) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -3354,25 +3303,6 @@ func (m *MsgCreateClassResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - m.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } @@ -3673,25 +3603,6 @@ func (m *MsgCreateProjectResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - m.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProjectId", wireType) } @@ -4215,25 +4126,6 @@ func (m *MsgCreateBatchResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RowId", wireType) - } - m.RowId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RowId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BatchDenom", wireType) } From 7186b2e4aa6c96d7c20952fd22b40a8b87a27931 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 08:52:04 -0800 Subject: [PATCH 15/31] refactor: use class row id for class issuer table --- .../ecocredit/v1beta1/state.cosmos_orm.go | 12 +- api/regen/ecocredit/v1beta1/state.pulsar.go | 56 +++---- proto/regen/ecocredit/v1beta1/state.proto | 4 +- x/ecocredit/server/core/msg_server.go | 17 +- x/ecocredit/server/core/query_server.go | 9 +- x/ecocredit/v1beta1/state.pb.go | 149 ++++++++---------- 6 files changed, 110 insertions(+), 137 deletions(-) diff --git a/api/regen/ecocredit/v1beta1/state.cosmos_orm.go b/api/regen/ecocredit/v1beta1/state.cosmos_orm.go index b7f941922d..49bbf24a1b 100644 --- a/api/regen/ecocredit/v1beta1/state.cosmos_orm.go +++ b/api/regen/ecocredit/v1beta1/state.cosmos_orm.go @@ -346,9 +346,9 @@ type ClassIssuerStore interface { Update(ctx context.Context, classIssuer *ClassIssuer) error Save(ctx context.Context, classIssuer *ClassIssuer) error Delete(ctx context.Context, classIssuer *ClassIssuer) error - Has(ctx context.Context, class_id string, issuer []byte) (found bool, err error) + Has(ctx context.Context, class_id uint64, issuer []byte) (found bool, err error) // Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found. - Get(ctx context.Context, class_id string, issuer []byte) (*ClassIssuer, error) + Get(ctx context.Context, class_id uint64, issuer []byte) (*ClassIssuer, error) List(ctx context.Context, prefixKey ClassIssuerIndexKey, opts ...ormlist.Option) (ClassIssuerIterator, error) ListRange(ctx context.Context, from, to ClassIssuerIndexKey, opts ...ormlist.Option) (ClassIssuerIterator, error) DeleteBy(ctx context.Context, prefixKey ClassIssuerIndexKey) error @@ -384,12 +384,12 @@ func (x ClassIssuerClassIdIssuerIndexKey) id() uint32 { return 0 } func (x ClassIssuerClassIdIssuerIndexKey) values() []interface{} { return x.vs } func (x ClassIssuerClassIdIssuerIndexKey) classIssuerIndexKey() {} -func (this ClassIssuerClassIdIssuerIndexKey) WithClassId(class_id string) ClassIssuerClassIdIssuerIndexKey { +func (this ClassIssuerClassIdIssuerIndexKey) WithClassId(class_id uint64) ClassIssuerClassIdIssuerIndexKey { this.vs = []interface{}{class_id} return this } -func (this ClassIssuerClassIdIssuerIndexKey) WithClassIdIssuer(class_id string, issuer []byte) ClassIssuerClassIdIssuerIndexKey { +func (this ClassIssuerClassIdIssuerIndexKey) WithClassIdIssuer(class_id uint64, issuer []byte) ClassIssuerClassIdIssuerIndexKey { this.vs = []interface{}{class_id, issuer} return this } @@ -414,11 +414,11 @@ func (this classIssuerStore) Delete(ctx context.Context, classIssuer *ClassIssue return this.table.Delete(ctx, classIssuer) } -func (this classIssuerStore) Has(ctx context.Context, class_id string, issuer []byte) (found bool, err error) { +func (this classIssuerStore) Has(ctx context.Context, class_id uint64, issuer []byte) (found bool, err error) { return this.table.PrimaryKey().Has(ctx, class_id, issuer) } -func (this classIssuerStore) Get(ctx context.Context, class_id string, issuer []byte) (*ClassIssuer, error) { +func (this classIssuerStore) Get(ctx context.Context, class_id uint64, issuer []byte) (*ClassIssuer, error) { var classIssuer ClassIssuer found, err := this.table.PrimaryKey().Get(ctx, &classIssuer, class_id, issuer) if err != nil { diff --git a/api/regen/ecocredit/v1beta1/state.pulsar.go b/api/regen/ecocredit/v1beta1/state.pulsar.go index 0e5df0f167..694d3c0ac1 100644 --- a/api/regen/ecocredit/v1beta1/state.pulsar.go +++ b/api/regen/ecocredit/v1beta1/state.pulsar.go @@ -1352,8 +1352,8 @@ func (x *fastReflection_ClassIssuer) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_ClassIssuer) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.ClassId != "" { - value := protoreflect.ValueOfString(x.ClassId) + if x.ClassId != uint64(0) { + value := protoreflect.ValueOfUint64(x.ClassId) if !f(fd_ClassIssuer_class_id, value) { return } @@ -1380,7 +1380,7 @@ func (x *fastReflection_ClassIssuer) Range(f func(protoreflect.FieldDescriptor, func (x *fastReflection_ClassIssuer) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "regen.ecocredit.v1beta1.ClassIssuer.class_id": - return x.ClassId != "" + return x.ClassId != uint64(0) case "regen.ecocredit.v1beta1.ClassIssuer.issuer": return len(x.Issuer) != 0 default: @@ -1400,7 +1400,7 @@ func (x *fastReflection_ClassIssuer) Has(fd protoreflect.FieldDescriptor) bool { func (x *fastReflection_ClassIssuer) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "regen.ecocredit.v1beta1.ClassIssuer.class_id": - x.ClassId = "" + x.ClassId = uint64(0) case "regen.ecocredit.v1beta1.ClassIssuer.issuer": x.Issuer = nil default: @@ -1421,7 +1421,7 @@ func (x *fastReflection_ClassIssuer) Get(descriptor protoreflect.FieldDescriptor switch descriptor.FullName() { case "regen.ecocredit.v1beta1.ClassIssuer.class_id": value := x.ClassId - return protoreflect.ValueOfString(value) + return protoreflect.ValueOfUint64(value) case "regen.ecocredit.v1beta1.ClassIssuer.issuer": value := x.Issuer return protoreflect.ValueOfBytes(value) @@ -1446,7 +1446,7 @@ func (x *fastReflection_ClassIssuer) Get(descriptor protoreflect.FieldDescriptor func (x *fastReflection_ClassIssuer) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { case "regen.ecocredit.v1beta1.ClassIssuer.class_id": - x.ClassId = value.Interface().(string) + x.ClassId = value.Uint() case "regen.ecocredit.v1beta1.ClassIssuer.issuer": x.Issuer = value.Bytes() default: @@ -1487,7 +1487,7 @@ func (x *fastReflection_ClassIssuer) Mutable(fd protoreflect.FieldDescriptor) pr func (x *fastReflection_ClassIssuer) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { case "regen.ecocredit.v1beta1.ClassIssuer.class_id": - return protoreflect.ValueOfString("") + return protoreflect.ValueOfUint64(uint64(0)) case "regen.ecocredit.v1beta1.ClassIssuer.issuer": return protoreflect.ValueOfBytes(nil) default: @@ -1559,9 +1559,8 @@ func (x *fastReflection_ClassIssuer) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.ClassId) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if x.ClassId != 0 { + n += 1 + runtime.Sov(uint64(x.ClassId)) } l = len(x.Issuer) if l > 0 { @@ -1603,12 +1602,10 @@ func (x *fastReflection_ClassIssuer) ProtoMethods() *protoiface.Methods { i-- dAtA[i] = 0x12 } - if len(x.ClassId) > 0 { - i -= len(x.ClassId) - copy(dAtA[i:], x.ClassId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ClassId))) + if x.ClassId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.ClassId)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1660,10 +1657,10 @@ func (x *fastReflection_ClassIssuer) ProtoMethods() *protoiface.Methods { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } - var stringLen uint64 + x.ClassId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1673,24 +1670,11 @@ func (x *fastReflection_ClassIssuer) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + x.ClassId |= 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.ClassId = 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 Issuer", wireType) @@ -5887,8 +5871,8 @@ type ClassIssuer struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + // class_id is the row ID of a credit class. + ClassId uint64 `protobuf:"varint,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // issuer is the approved issuer of the credit class. Issuer []byte `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` } @@ -5913,11 +5897,11 @@ func (*ClassIssuer) Descriptor() ([]byte, []int) { return file_regen_ecocredit_v1beta1_state_proto_rawDescGZIP(), []int{2} } -func (x *ClassIssuer) GetClassId() string { +func (x *ClassIssuer) GetClassId() uint64 { if x != nil { return x.ClassId } - return "" + return 0 } func (x *ClassIssuer) GetIssuer() []byte { @@ -6394,7 +6378,7 @@ var file_regen_ecocredit_v1beta1_state_proto_rawDesc = []byte{ 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x10, 0x03, 0x18, 0x02, 0x22, 0x5d, 0x0a, 0x0b, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x3a, 0x1b, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x15, 0x0a, 0x11, 0x0a, 0x0f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, diff --git a/proto/regen/ecocredit/v1beta1/state.proto b/proto/regen/ecocredit/v1beta1/state.proto index 2023187f7e..284042570f 100644 --- a/proto/regen/ecocredit/v1beta1/state.proto +++ b/proto/regen/ecocredit/v1beta1/state.proto @@ -64,8 +64,8 @@ message ClassIssuer { primary_key: {fields: "class_id,issuer"} }; - // class_id is the unique ID of credit class. - string class_id = 1; + // class_id is the row ID of a credit class. + uint64 class_id = 1; // issuer is the approved issuer of the credit class. bytes issuer = 2; diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index c9f0b33e66..108ccb95fd 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -55,19 +55,20 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass } classID := ecocredit.FormatClassID(creditType.Abbreviation, classSeq) - if err = s.stateStore.ClassInfoStore().Insert(ctx, &ecocreditv1beta1.ClassInfo{ + rowId, err := s.stateStore.ClassInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ Name: classID, Admin: adminAddress, Metadata: req.Metadata, CreditType: req.CreditTypeName, - }); err != nil { + }) + if err != nil { return nil, err } for _, issuer := range req.Issuers { issuer, _ := sdk.AccAddressFromBech32(issuer) if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ - ClassId: classID, + ClassId: rowId, Issuer: issuer, }); err != nil { return nil, err @@ -94,7 +95,7 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro return nil, err } - err = s.assertClassIssuer(ctx, classID, req.Issuer) + err = s.assertClassIssuer(ctx, classInfo.Id, req.Issuer) if err != nil { return nil, err } @@ -154,7 +155,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch return nil, err } - err = s.assertClassIssuer(ctx, classInfo.Name, req.Issuer) + err = s.assertClassIssuer(ctx, classInfo.Id, req.Issuer) if err != nil { return nil, err } @@ -461,7 +462,7 @@ func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpda } // delete the old issuers - if err = s.stateStore.ClassIssuerStore().DeleteBy(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(class.Name)); err != nil { + if err = s.stateStore.ClassIssuerStore().DeleteBy(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(class.Id)); err != nil { return nil, err } @@ -469,7 +470,7 @@ func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpda for _, issuer := range req.Issuers { iAddr, _ := sdk.AccAddressFromBech32(issuer) if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ - ClassId: req.ClassId, + ClassId: class.Id, Issuer: iAddr, }); err != nil { return nil, err @@ -918,7 +919,7 @@ func (s serverImpl) isCreatorAllowListed(ctx sdk.Context, allowlist []string, de // assertClassIssuer makes sure that the issuer is part of issuers of given classID. // Returns ErrUnauthorized otherwise. -func (s serverImpl) assertClassIssuer(goCtx context.Context, classID, issuer string) error { +func (s serverImpl) assertClassIssuer(goCtx context.Context, classID uint64, issuer string) error { addr, _ := sdk.AccAddressFromBech32(issuer) found, err := s.stateStore.ClassIssuerStore().Has(goCtx, classID, addr) if err != nil { diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index 7a86583998..45a970e83d 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -65,7 +65,7 @@ func (s serverImpl) ClassInfo(ctx context.Context, request *v1beta1.QueryClassIn } issuers := make([]sdk.AccAddress, 0) - it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId)) + it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id)) if err != nil { return nil, err } @@ -98,7 +98,12 @@ func (s serverImpl) ClassIssuers(ctx context.Context, request *v1beta1.QueryClas return nil, err } - it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(request.ClassId), ormlist.Paginate(&queryv1beta1.PageRequest{ + classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) + if err != nil { + return nil, err + } + + it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, diff --git a/x/ecocredit/v1beta1/state.pb.go b/x/ecocredit/v1beta1/state.pb.go index be4ccf0d8d..93827942c9 100644 --- a/x/ecocredit/v1beta1/state.pb.go +++ b/x/ecocredit/v1beta1/state.pb.go @@ -184,8 +184,8 @@ func (m *ClassInfo) GetCreditType() string { // ClassIssuers is a JOIN table for Class Info that stores the credit class issuers type ClassIssuer struct { - // class_id is the unique ID of credit class. - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + // class_id is the row ID of a credit class. + ClassId uint64 `protobuf:"varint,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` // issuer is the approved issuer of the credit class. Issuer []byte `protobuf:"bytes,2,opt,name=issuer,proto3" json:"issuer,omitempty"` } @@ -223,11 +223,11 @@ func (m *ClassIssuer) XXX_DiscardUnknown() { var xxx_messageInfo_ClassIssuer proto.InternalMessageInfo -func (m *ClassIssuer) GetClassId() string { +func (m *ClassIssuer) GetClassId() uint64 { if m != nil { return m.ClassId } - return "" + return 0 } func (m *ClassIssuer) GetIssuer() []byte { @@ -751,62 +751,61 @@ func init() { } var fileDescriptor_8079a0bb712cbff1 = []byte{ - // 867 bytes of a gzipped FileDescriptorProto + // 862 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xcd, 0x6e, 0xe4, 0x44, - 0x10, 0x4e, 0x7b, 0x26, 0x33, 0x71, 0xcd, 0x9f, 0xd3, 0x84, 0x5d, 0x13, 0xd8, 0xd9, 0x95, 0xf9, - 0xdb, 0x15, 0xc3, 0x58, 0x13, 0x84, 0xc4, 0x5a, 0xe2, 0x40, 0xb2, 0x97, 0x48, 0x1c, 0x90, 0x77, - 0x4f, 0x48, 0x68, 0xd4, 0x76, 0xf7, 0x4e, 0x1c, 0xfc, 0x87, 0xdd, 0x13, 0x36, 0x2f, 0x81, 0x78, - 0x00, 0xc4, 0x1b, 0xc0, 0x1d, 0x89, 0x33, 0xe2, 0xb8, 0x12, 0x17, 0x8e, 0x28, 0x79, 0x03, 0x9e, - 0x00, 0xb9, 0xba, 0xed, 0x8c, 0x67, 0xa3, 0xe5, 0xe6, 0xfa, 0x5c, 0x5d, 0xdf, 0x57, 0x5f, 0x55, - 0xdb, 0xf0, 0x6e, 0x21, 0x56, 0x22, 0x75, 0x45, 0x98, 0x85, 0x85, 0xe0, 0x91, 0x74, 0x2f, 0x16, - 0x81, 0x90, 0x6c, 0xe1, 0x96, 0x92, 0x49, 0x31, 0xcf, 0x8b, 0x4c, 0x66, 0xf4, 0x2e, 0x26, 0xcd, - 0x9b, 0xa4, 0xb9, 0x4e, 0x3a, 0xbc, 0x17, 0x66, 0x65, 0x92, 0x95, 0x6e, 0x56, 0x24, 0xee, 0xc5, - 0x82, 0xc5, 0xf9, 0x19, 0x5b, 0x54, 0x81, 0x3a, 0x77, 0x78, 0x7f, 0x95, 0x65, 0xab, 0x58, 0xb8, - 0x18, 0x05, 0xeb, 0xe7, 0xae, 0x8c, 0x12, 0x51, 0x4a, 0x96, 0xe4, 0x2a, 0xc1, 0xf9, 0x89, 0x00, - 0x9c, 0x60, 0xc9, 0x67, 0x97, 0xb9, 0xa0, 0x0e, 0x0c, 0x59, 0x10, 0x14, 0xe2, 0x22, 0x62, 0x32, - 0xca, 0x52, 0x9b, 0x3c, 0x20, 0x0f, 0x4d, 0xbf, 0x85, 0x51, 0x0a, 0xdd, 0x94, 0x25, 0xc2, 0x36, - 0xf0, 0x1d, 0x3e, 0x57, 0xd8, 0x3a, 0x8d, 0xa4, 0xdd, 0x51, 0x58, 0xf5, 0x4c, 0xdf, 0x01, 0x33, - 0x2f, 0x44, 0x18, 0x95, 0x55, 0xa1, 0xee, 0x03, 0xf2, 0x70, 0xe4, 0xdf, 0x00, 0xde, 0x7b, 0xff, - 0xfe, 0xfc, 0xd7, 0x0f, 0x9d, 0x29, 0x8c, 0xdb, 0x8c, 0x14, 0x54, 0x75, 0x8b, 0xd8, 0xc4, 0x26, - 0xce, 0xef, 0x04, 0xcc, 0x93, 0x98, 0x95, 0xe5, 0x69, 0xfa, 0x3c, 0xa3, 0x63, 0x30, 0x22, 0x8e, - 0x9a, 0xba, 0xbe, 0x11, 0xf1, 0x5b, 0x95, 0x1c, 0xc0, 0x2e, 0xe3, 0x49, 0x94, 0xa2, 0x94, 0xa1, - 0xaf, 0x02, 0x7a, 0x08, 0x7b, 0x89, 0x90, 0x8c, 0x33, 0xc9, 0x50, 0xca, 0xd0, 0x6f, 0x62, 0x7a, - 0x1f, 0x06, 0xca, 0xd4, 0xa5, 0xbc, 0xcc, 0x85, 0xbd, 0x8b, 0xc5, 0x20, 0x6c, 0x4c, 0xf1, 0x3e, - 0x43, 0xa9, 0x47, 0xd0, 0xab, 0xe8, 0x2d, 0xb2, 0x29, 0x91, 0x9a, 0x9a, 0xce, 0x32, 0xe8, 0xa4, - 0x55, 0xc7, 0xea, 0xd8, 0x86, 0xf3, 0x0d, 0x0c, 0x94, 0xfa, 0xb2, 0x5c, 0x8b, 0x82, 0xbe, 0x05, - 0x7b, 0x61, 0x15, 0x2e, 0x75, 0x17, 0xa6, 0xdf, 0xc7, 0xf8, 0x94, 0xd3, 0x3b, 0xd0, 0x8b, 0x30, - 0x09, 0x9b, 0x19, 0xfa, 0x3a, 0xf2, 0xde, 0x46, 0xee, 0x37, 0x61, 0x1f, 0x26, 0xf5, 0xd1, 0x99, - 0x4e, 0xec, 0x38, 0x7f, 0x10, 0x18, 0x7c, 0x55, 0x64, 0xe7, 0x22, 0x94, 0xaf, 0xf5, 0xa7, 0xb3, - 0xe1, 0xcf, 0xa6, 0x06, 0x03, 0x33, 0x1b, 0x0d, 0x8f, 0xc0, 0xca, 0x55, 0xb5, 0x65, 0x9c, 0x85, - 0x6a, 0x01, 0xba, 0x78, 0x74, 0xa2, 0xf1, 0x2f, 0x35, 0xdc, 0xf2, 0x73, 0xb7, 0xed, 0xa7, 0xb7, - 0x40, 0xc9, 0x1f, 0xdd, 0x6a, 0xd7, 0x1b, 0x30, 0x6a, 0xda, 0x40, 0xd0, 0xb0, 0x89, 0xdd, 0x75, - 0x7e, 0x35, 0xc0, 0x3c, 0x66, 0x32, 0x3c, 0xbb, 0xb5, 0x8d, 0x7b, 0x00, 0xb5, 0xae, 0x46, 0xb4, - 0xa9, 0x91, 0x53, 0x5e, 0xcd, 0x2f, 0xa8, 0xce, 0x2e, 0xb9, 0x48, 0xb3, 0x44, 0x37, 0x0b, 0x08, - 0x3d, 0xa9, 0x90, 0xd7, 0x0e, 0xff, 0x31, 0x40, 0x29, 0x59, 0x21, 0x97, 0x9c, 0x49, 0x35, 0xfb, - 0xc1, 0xd1, 0xe1, 0x5c, 0xdd, 0x9a, 0x79, 0x7d, 0x6b, 0xe6, 0xcf, 0xea, 0x5b, 0xe3, 0x9b, 0x98, - 0xfd, 0x84, 0x49, 0x41, 0x3f, 0x85, 0x3d, 0x91, 0x72, 0x75, 0xb0, 0xf7, 0xbf, 0x07, 0xfb, 0x22, - 0xe5, 0xd5, 0x31, 0xef, 0x04, 0xed, 0xf9, 0xbc, 0xb1, 0x67, 0xbf, 0x25, 0x1f, 0x5d, 0x1a, 0x6f, - 0x36, 0x6c, 0x19, 0x55, 0x7c, 0x23, 0xd2, 0xea, 0xd8, 0xbb, 0x4e, 0x02, 0x23, 0x5c, 0xac, 0xa7, - 0xe2, 0xbb, 0xb5, 0x48, 0x43, 0xb1, 0xbd, 0xc4, 0x64, 0x7b, 0x89, 0xa9, 0x03, 0xa3, 0x54, 0xbc, - 0x90, 0xcb, 0xad, 0xe1, 0x0f, 0x2a, 0x50, 0xed, 0x28, 0xf7, 0xee, 0xa2, 0xb4, 0x7d, 0x18, 0xb5, - 0x8b, 0xf5, 0x9c, 0x73, 0x98, 0xe8, 0x3d, 0x6b, 0x08, 0xb7, 0x77, 0x79, 0x63, 0x8f, 0x3e, 0x80, - 0x09, 0x52, 0xbd, 0x32, 0x34, 0x54, 0x50, 0x2f, 0x2c, 0xf7, 0x0e, 0x90, 0x6e, 0x0c, 0xb0, 0x51, - 0xaa, 0xef, 0x9c, 0xc3, 0x08, 0x57, 0xa1, 0x61, 0x6a, 0x8f, 0x5f, 0x75, 0xb6, 0x31, 0xfe, 0xba, - 0x31, 0x65, 0x62, 0xbb, 0x31, 0xb5, 0x53, 0xdc, 0xbb, 0x83, 0x4c, 0x16, 0x0c, 0x5b, 0xa5, 0xf6, - 0x9c, 0x5f, 0x08, 0x0c, 0x31, 0xe7, 0x98, 0xc5, 0xac, 0xe2, 0xb2, 0xa1, 0xcf, 0x38, 0x2f, 0x44, - 0x59, 0x22, 0xd1, 0xd0, 0xaf, 0xc3, 0xaa, 0xdf, 0x2d, 0x86, 0x7e, 0xa0, 0xaa, 0x57, 0xfb, 0x25, - 0x0b, 0xc6, 0x59, 0x10, 0xd7, 0x57, 0xad, 0x89, 0xab, 0x82, 0x85, 0x90, 0x51, 0x21, 0xb8, 0xbe, - 0x4a, 0x75, 0xe8, 0x1d, 0xa1, 0xa6, 0x19, 0x50, 0xb0, 0x34, 0xc7, 0xac, 0x26, 0xa0, 0x07, 0x60, - 0xd5, 0xcf, 0x33, 0xfd, 0xd2, 0x22, 0xb6, 0xe9, 0xfc, 0x46, 0x60, 0xa0, 0xcc, 0x59, 0xe7, 0x79, - 0x7c, 0xd9, 0x12, 0x45, 0xda, 0xa2, 0x3e, 0x84, 0x49, 0x2d, 0x62, 0xc9, 0x92, 0x6c, 0x9d, 0x4a, - 0xfd, 0x99, 0x1c, 0xd7, 0xf0, 0x17, 0x88, 0xd2, 0xf7, 0x61, 0xac, 0x25, 0xd5, 0x79, 0xaa, 0x87, - 0x91, 0x46, 0x75, 0xda, 0x23, 0xb0, 0xc2, 0xca, 0xa2, 0x38, 0xbe, 0x49, 0xd4, 0x1f, 0x87, 0x06, - 0x57, 0xa9, 0x9b, 0x73, 0x6d, 0xd4, 0xc1, 0xf1, 0xd3, 0x3f, 0xaf, 0xa6, 0xe4, 0xe5, 0xd5, 0x94, - 0xfc, 0x73, 0x35, 0x25, 0x3f, 0x5e, 0x4f, 0x77, 0x5e, 0x5e, 0x4f, 0x77, 0xfe, 0xbe, 0x9e, 0xee, - 0x7c, 0xfd, 0x78, 0x15, 0xc9, 0xb3, 0x75, 0x30, 0x0f, 0xb3, 0xc4, 0xc5, 0xff, 0xdc, 0xc7, 0xa9, - 0x90, 0xdf, 0x67, 0xc5, 0xb7, 0x3a, 0x8a, 0x05, 0x5f, 0x89, 0xc2, 0x7d, 0xf1, 0xea, 0x3f, 0x32, - 0xe8, 0xe1, 0x4d, 0xfb, 0xe4, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0x7c, 0x35, 0x81, 0x45, - 0x07, 0x00, 0x00, + 0x10, 0x4e, 0x7b, 0x26, 0x33, 0x99, 0x9a, 0x3f, 0xa7, 0x09, 0xbb, 0x26, 0xb0, 0xb3, 0x2b, 0xf3, + 0xb7, 0x2b, 0xc2, 0x58, 0x13, 0x84, 0xc4, 0x5a, 0xe2, 0x40, 0xb2, 0x97, 0x48, 0x1c, 0xd0, 0xec, + 0x9e, 0x90, 0xd0, 0xa8, 0xed, 0xee, 0x9d, 0x38, 0xf8, 0x0f, 0xbb, 0x27, 0x6c, 0x5e, 0x02, 0xf1, + 0x00, 0x88, 0x37, 0x80, 0x3b, 0x12, 0x67, 0xc4, 0x71, 0x25, 0x2e, 0x1c, 0x51, 0xf2, 0x06, 0x3c, + 0x01, 0xea, 0xea, 0xb6, 0x33, 0x9e, 0x44, 0xe1, 0xe6, 0xfa, 0x5c, 0x5d, 0xdf, 0x57, 0x5f, 0x55, + 0xdb, 0xf0, 0x6e, 0x21, 0x96, 0x22, 0xf5, 0x44, 0x98, 0x85, 0x85, 0xe0, 0x91, 0xf4, 0xce, 0x67, + 0x81, 0x90, 0x6c, 0xe6, 0x95, 0x92, 0x49, 0x31, 0xcd, 0x8b, 0x4c, 0x66, 0xf4, 0x3e, 0x26, 0x4d, + 0xeb, 0xa4, 0xa9, 0x49, 0xda, 0x7f, 0x10, 0x66, 0x65, 0x92, 0x95, 0x5e, 0x56, 0x24, 0xde, 0xf9, + 0x8c, 0xc5, 0xf9, 0x29, 0x9b, 0xa9, 0x40, 0x9f, 0xdb, 0x7f, 0xb8, 0xcc, 0xb2, 0x65, 0x2c, 0x3c, + 0x8c, 0x82, 0xd5, 0x4b, 0x4f, 0x46, 0x89, 0x28, 0x25, 0x4b, 0x72, 0x9d, 0xe0, 0xfe, 0x44, 0x00, + 0x8e, 0xb1, 0xe4, 0x8b, 0x8b, 0x5c, 0x50, 0x17, 0x06, 0x2c, 0x08, 0x0a, 0x71, 0x1e, 0x31, 0x19, + 0x65, 0xa9, 0x43, 0x1e, 0x91, 0xc7, 0xbd, 0x79, 0x03, 0xa3, 0x14, 0xda, 0x29, 0x4b, 0x84, 0x63, + 0xe1, 0x3b, 0x7c, 0x56, 0xd8, 0x2a, 0x8d, 0xa4, 0xd3, 0xd2, 0x98, 0x7a, 0xa6, 0xef, 0x40, 0x2f, + 0x2f, 0x44, 0x18, 0x95, 0xaa, 0x50, 0xfb, 0x11, 0x79, 0x3c, 0x9c, 0x5f, 0x03, 0xfe, 0x7b, 0xff, + 0xfe, 0xfc, 0xd7, 0x0f, 0xad, 0x09, 0x8c, 0x9a, 0x8c, 0x14, 0x74, 0x75, 0x9b, 0x38, 0xc4, 0x21, + 0xee, 0xef, 0x04, 0x7a, 0xc7, 0x31, 0x2b, 0xcb, 0x93, 0xf4, 0x65, 0x46, 0x47, 0x60, 0x45, 0x1c, + 0x35, 0xb5, 0xe7, 0x56, 0xc4, 0x6f, 0x55, 0xb2, 0x07, 0xdb, 0x8c, 0x27, 0x51, 0x8a, 0x52, 0x06, + 0x73, 0x1d, 0xd0, 0x7d, 0xd8, 0x49, 0x84, 0x64, 0x9c, 0x49, 0x86, 0x52, 0x06, 0xf3, 0x3a, 0xa6, + 0x0f, 0xa1, 0xaf, 0x4d, 0x5d, 0xc8, 0x8b, 0x5c, 0x38, 0xdb, 0x58, 0x0c, 0xc2, 0xda, 0x14, 0xff, + 0x33, 0x94, 0x7a, 0x08, 0x1d, 0x45, 0x6f, 0x93, 0x75, 0x89, 0xb4, 0x67, 0xe8, 0x6c, 0x8b, 0x8e, + 0x1b, 0x75, 0xec, 0x96, 0x63, 0xb9, 0xdf, 0x40, 0x5f, 0xab, 0x2f, 0xcb, 0x95, 0x28, 0xe8, 0x5b, + 0xb0, 0x13, 0xaa, 0x70, 0x51, 0x77, 0xd1, 0xc5, 0xf8, 0x84, 0xd3, 0x7b, 0xd0, 0x89, 0x30, 0x09, + 0x9b, 0x19, 0xcc, 0x4d, 0xe4, 0xbf, 0x8d, 0xdc, 0x6f, 0xc2, 0x2e, 0x8c, 0xab, 0xa3, 0x07, 0x26, + 0xb1, 0xe5, 0xfe, 0x41, 0xa0, 0xff, 0x55, 0x91, 0x9d, 0x89, 0x50, 0xde, 0xe9, 0x4f, 0x6b, 0xcd, + 0x9f, 0x75, 0x0d, 0x56, 0x53, 0xc3, 0x13, 0xb0, 0x73, 0x5d, 0x6d, 0x11, 0x67, 0xa1, 0x5e, 0x80, + 0x36, 0x1e, 0x1d, 0x1b, 0xfc, 0x4b, 0x03, 0x37, 0xfc, 0xdc, 0x6e, 0xfa, 0xe9, 0xcf, 0x50, 0xf2, + 0x47, 0xb7, 0xda, 0xf5, 0x06, 0x0c, 0xeb, 0x36, 0x10, 0xb4, 0x1c, 0xe2, 0xb4, 0xdd, 0x5f, 0x2d, + 0xe8, 0x1d, 0x31, 0x19, 0x9e, 0xde, 0xda, 0xc6, 0x03, 0x80, 0x4a, 0x57, 0x2d, 0xba, 0x67, 0x90, + 0x13, 0xae, 0xe6, 0x17, 0xa8, 0xb3, 0x0b, 0x2e, 0xd2, 0x2c, 0x31, 0xcd, 0x02, 0x42, 0xcf, 0x14, + 0x72, 0xe7, 0xf0, 0x9f, 0x02, 0x94, 0x92, 0x15, 0x72, 0xc1, 0x99, 0xd4, 0xb3, 0xef, 0x1f, 0xee, + 0x4f, 0xf5, 0xad, 0x99, 0x56, 0xb7, 0x66, 0xfa, 0xa2, 0xba, 0x35, 0xf3, 0x1e, 0x66, 0x3f, 0x63, + 0x52, 0xd0, 0x4f, 0x61, 0x47, 0xa4, 0x5c, 0x1f, 0xec, 0xfc, 0xef, 0xc1, 0xae, 0x48, 0xb9, 0x3a, + 0xe6, 0x1f, 0xa3, 0x3d, 0x9f, 0xd7, 0xf6, 0xec, 0x36, 0xe4, 0xa3, 0x4b, 0xa3, 0xf5, 0x86, 0x6d, + 0x4b, 0xc5, 0xd7, 0x22, 0xed, 0x96, 0xb3, 0xed, 0x26, 0x30, 0xc4, 0xc5, 0x7a, 0x2e, 0xbe, 0x5b, + 0x89, 0x34, 0x14, 0x9b, 0x4b, 0x4c, 0x36, 0x97, 0x98, 0xba, 0x30, 0x4c, 0xc5, 0x2b, 0xb9, 0xd8, + 0x18, 0x7e, 0x5f, 0x81, 0x7a, 0x47, 0xb9, 0x7f, 0x1f, 0xa5, 0xed, 0xc2, 0xb0, 0x59, 0xac, 0xe3, + 0x9e, 0xc1, 0xd8, 0xec, 0x59, 0x4d, 0x78, 0xc7, 0x2e, 0x7f, 0x00, 0x63, 0xa4, 0xba, 0x31, 0x34, + 0x54, 0x50, 0x2d, 0x2c, 0xf7, 0xf7, 0x90, 0x6e, 0x04, 0xb0, 0x56, 0xaa, 0xeb, 0x9e, 0xc1, 0x10, + 0x57, 0xa1, 0x66, 0x6a, 0x8e, 0x5f, 0x77, 0xb6, 0x36, 0xfe, 0xaa, 0x31, 0x6d, 0x62, 0xb3, 0x31, + 0xbd, 0x53, 0xdc, 0xbf, 0x87, 0x4c, 0x36, 0x0c, 0x1a, 0xa5, 0x76, 0xdc, 0x5f, 0x08, 0x0c, 0x30, + 0xe7, 0x88, 0xc5, 0x4c, 0x71, 0x39, 0xd0, 0x65, 0x9c, 0x17, 0xa2, 0x2c, 0x91, 0x68, 0x30, 0xaf, + 0x42, 0xd5, 0xef, 0x06, 0x43, 0x37, 0xd0, 0xd5, 0xd5, 0x7e, 0xc9, 0x82, 0x71, 0x16, 0xc4, 0xd5, + 0x55, 0xab, 0x63, 0x55, 0xb0, 0x10, 0x32, 0x2a, 0x04, 0x37, 0x57, 0xa9, 0x0a, 0xfd, 0x43, 0xd4, + 0x74, 0x00, 0x14, 0x6c, 0xc3, 0x71, 0x50, 0x11, 0xd0, 0x3d, 0xb0, 0xab, 0xe7, 0x03, 0xf3, 0xd2, + 0x26, 0x4e, 0xcf, 0xfd, 0x8d, 0x40, 0x5f, 0x9b, 0xb3, 0xca, 0xf3, 0xf8, 0xa2, 0x21, 0x8a, 0x34, + 0x45, 0x7d, 0x08, 0xe3, 0x4a, 0xc4, 0x82, 0x25, 0xd9, 0x2a, 0x95, 0xe6, 0x33, 0x39, 0xaa, 0xe0, + 0x2f, 0x10, 0xa5, 0xef, 0xc3, 0xc8, 0x48, 0xaa, 0xf2, 0x74, 0x0f, 0x43, 0x83, 0x9a, 0xb4, 0x27, + 0x60, 0x87, 0xca, 0xa2, 0x38, 0xbe, 0x4e, 0x34, 0x1f, 0x87, 0x1a, 0xd7, 0xa9, 0xeb, 0x73, 0xad, + 0xd5, 0xc1, 0xd1, 0xf3, 0x3f, 0x2f, 0x27, 0xe4, 0xf5, 0xe5, 0x84, 0xfc, 0x73, 0x39, 0x21, 0x3f, + 0x5e, 0x4d, 0xb6, 0x5e, 0x5f, 0x4d, 0xb6, 0xfe, 0xbe, 0x9a, 0x6c, 0x7d, 0xfd, 0x74, 0x19, 0xc9, + 0xd3, 0x55, 0x30, 0x0d, 0xb3, 0xc4, 0xc3, 0xff, 0xdc, 0xc7, 0xa9, 0x90, 0xdf, 0x67, 0xc5, 0xb7, + 0x26, 0x8a, 0x05, 0x5f, 0x8a, 0xc2, 0x7b, 0x75, 0xf3, 0x1f, 0x19, 0x74, 0xf0, 0xa6, 0x7d, 0xf2, + 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0xf3, 0x9e, 0x57, 0x45, 0x07, 0x00, 0x00, } func (m *CreditType) Marshal() (dAtA []byte, err error) { @@ -941,12 +940,10 @@ func (m *ClassIssuer) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintState(dAtA, i, uint64(len(m.ClassId))) + if m.ClassId != 0 { + i = encodeVarintState(dAtA, i, uint64(m.ClassId)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -1346,9 +1343,8 @@ func (m *ClassIssuer) Size() (n int) { } var l int _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovState(uint64(l)) + if m.ClassId != 0 { + n += 1 + sovState(uint64(m.ClassId)) } l = len(m.Issuer) if l > 0 { @@ -1918,10 +1914,10 @@ func (m *ClassIssuer) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { + if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) } - var stringLen uint64 + m.ClassId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowState @@ -1931,24 +1927,11 @@ func (m *ClassIssuer) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ClassId |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Issuer", wireType) From 90e589897087438bb08ec04ab25ad25370ab4f12 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 08:57:13 -0800 Subject: [PATCH 16/31] feat: add AddIssuers and RemoveIssuers from update class issuers method --- api/regen/ecocredit/v1beta1/tx.pulsar.go | 412 +++++++++++++++-------- proto/regen/ecocredit/v1beta1/tx.proto | 7 +- x/ecocredit/server/core/msg_server.go | 15 +- x/ecocredit/v1beta1/tx.pb.go | 223 +++++++----- 4 files changed, 428 insertions(+), 229 deletions(-) diff --git a/api/regen/ecocredit/v1beta1/tx.pulsar.go b/api/regen/ecocredit/v1beta1/tx.pulsar.go index 771d4fae1a..000a997301 100644 --- a/api/regen/ecocredit/v1beta1/tx.pulsar.go +++ b/api/regen/ecocredit/v1beta1/tx.pulsar.go @@ -9441,7 +9441,7 @@ func (x *fastReflection_MsgUpdateClassAdminResponse) ProtoMethods() *protoiface. var _ protoreflect.List = (*_MsgUpdateClassIssuers_3_list)(nil) type _MsgUpdateClassIssuers_3_list struct { - list *[]string + list *[][]byte } func (x *_MsgUpdateClassIssuers_3_list) Len() int { @@ -9452,23 +9452,23 @@ func (x *_MsgUpdateClassIssuers_3_list) Len() int { } func (x *_MsgUpdateClassIssuers_3_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) + return protoreflect.ValueOfBytes((*x.list)[i]) } func (x *_MsgUpdateClassIssuers_3_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() + valueUnwrapped := value.Bytes() concreteValue := valueUnwrapped (*x.list)[i] = concreteValue } func (x *_MsgUpdateClassIssuers_3_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() + valueUnwrapped := value.Bytes() concreteValue := valueUnwrapped *x.list = append(*x.list, concreteValue) } func (x *_MsgUpdateClassIssuers_3_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message MsgUpdateClassIssuers at list field Issuers as it is not of Message kind")) + panic(fmt.Errorf("AppendMutable can not be called on message MsgUpdateClassIssuers at list field AddIssuers as it is not of Message kind")) } func (x *_MsgUpdateClassIssuers_3_list) Truncate(n int) { @@ -9476,19 +9476,66 @@ func (x *_MsgUpdateClassIssuers_3_list) Truncate(n int) { } func (x *_MsgUpdateClassIssuers_3_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) + var v []byte + return protoreflect.ValueOfBytes(v) } func (x *_MsgUpdateClassIssuers_3_list) IsValid() bool { return x.list != nil } +var _ protoreflect.List = (*_MsgUpdateClassIssuers_4_list)(nil) + +type _MsgUpdateClassIssuers_4_list struct { + list *[][]byte +} + +func (x *_MsgUpdateClassIssuers_4_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgUpdateClassIssuers_4_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfBytes((*x.list)[i]) +} + +func (x *_MsgUpdateClassIssuers_4_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Bytes() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_MsgUpdateClassIssuers_4_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Bytes() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgUpdateClassIssuers_4_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message MsgUpdateClassIssuers at list field RemoveIssuers as it is not of Message kind")) +} + +func (x *_MsgUpdateClassIssuers_4_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_MsgUpdateClassIssuers_4_list) NewElement() protoreflect.Value { + var v []byte + return protoreflect.ValueOfBytes(v) +} + +func (x *_MsgUpdateClassIssuers_4_list) IsValid() bool { + return x.list != nil +} + var ( - md_MsgUpdateClassIssuers protoreflect.MessageDescriptor - fd_MsgUpdateClassIssuers_admin protoreflect.FieldDescriptor - fd_MsgUpdateClassIssuers_class_id protoreflect.FieldDescriptor - fd_MsgUpdateClassIssuers_issuers protoreflect.FieldDescriptor + md_MsgUpdateClassIssuers protoreflect.MessageDescriptor + fd_MsgUpdateClassIssuers_admin protoreflect.FieldDescriptor + fd_MsgUpdateClassIssuers_class_id protoreflect.FieldDescriptor + fd_MsgUpdateClassIssuers_add_issuers protoreflect.FieldDescriptor + fd_MsgUpdateClassIssuers_remove_issuers protoreflect.FieldDescriptor ) func init() { @@ -9496,7 +9543,8 @@ func init() { md_MsgUpdateClassIssuers = File_regen_ecocredit_v1beta1_tx_proto.Messages().ByName("MsgUpdateClassIssuers") fd_MsgUpdateClassIssuers_admin = md_MsgUpdateClassIssuers.Fields().ByName("admin") fd_MsgUpdateClassIssuers_class_id = md_MsgUpdateClassIssuers.Fields().ByName("class_id") - fd_MsgUpdateClassIssuers_issuers = md_MsgUpdateClassIssuers.Fields().ByName("issuers") + fd_MsgUpdateClassIssuers_add_issuers = md_MsgUpdateClassIssuers.Fields().ByName("add_issuers") + fd_MsgUpdateClassIssuers_remove_issuers = md_MsgUpdateClassIssuers.Fields().ByName("remove_issuers") } var _ protoreflect.Message = (*fastReflection_MsgUpdateClassIssuers)(nil) @@ -9576,9 +9624,15 @@ func (x *fastReflection_MsgUpdateClassIssuers) Range(f func(protoreflect.FieldDe return } } - if len(x.Issuers) != 0 { - value := protoreflect.ValueOfList(&_MsgUpdateClassIssuers_3_list{list: &x.Issuers}) - if !f(fd_MsgUpdateClassIssuers_issuers, value) { + if len(x.AddIssuers) != 0 { + value := protoreflect.ValueOfList(&_MsgUpdateClassIssuers_3_list{list: &x.AddIssuers}) + if !f(fd_MsgUpdateClassIssuers_add_issuers, value) { + return + } + } + if len(x.RemoveIssuers) != 0 { + value := protoreflect.ValueOfList(&_MsgUpdateClassIssuers_4_list{list: &x.RemoveIssuers}) + if !f(fd_MsgUpdateClassIssuers_remove_issuers, value) { return } } @@ -9601,8 +9655,10 @@ func (x *fastReflection_MsgUpdateClassIssuers) Has(fd protoreflect.FieldDescript return x.Admin != "" case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.class_id": return x.ClassId != "" - case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.issuers": - return len(x.Issuers) != 0 + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.add_issuers": + return len(x.AddIssuers) != 0 + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.remove_issuers": + return len(x.RemoveIssuers) != 0 default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.MsgUpdateClassIssuers")) @@ -9623,8 +9679,10 @@ func (x *fastReflection_MsgUpdateClassIssuers) Clear(fd protoreflect.FieldDescri x.Admin = "" case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.class_id": x.ClassId = "" - case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.issuers": - x.Issuers = nil + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.add_issuers": + x.AddIssuers = nil + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.remove_issuers": + x.RemoveIssuers = nil default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.MsgUpdateClassIssuers")) @@ -9647,11 +9705,17 @@ func (x *fastReflection_MsgUpdateClassIssuers) Get(descriptor protoreflect.Field case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.class_id": value := x.ClassId return protoreflect.ValueOfString(value) - case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.issuers": - if len(x.Issuers) == 0 { + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.add_issuers": + if len(x.AddIssuers) == 0 { return protoreflect.ValueOfList(&_MsgUpdateClassIssuers_3_list{}) } - listValue := &_MsgUpdateClassIssuers_3_list{list: &x.Issuers} + listValue := &_MsgUpdateClassIssuers_3_list{list: &x.AddIssuers} + return protoreflect.ValueOfList(listValue) + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.remove_issuers": + if len(x.RemoveIssuers) == 0 { + return protoreflect.ValueOfList(&_MsgUpdateClassIssuers_4_list{}) + } + listValue := &_MsgUpdateClassIssuers_4_list{list: &x.RemoveIssuers} return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { @@ -9677,10 +9741,14 @@ func (x *fastReflection_MsgUpdateClassIssuers) Set(fd protoreflect.FieldDescript x.Admin = value.Interface().(string) case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.class_id": x.ClassId = value.Interface().(string) - case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.issuers": + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.add_issuers": lv := value.List() clv := lv.(*_MsgUpdateClassIssuers_3_list) - x.Issuers = *clv.list + x.AddIssuers = *clv.list + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.remove_issuers": + lv := value.List() + clv := lv.(*_MsgUpdateClassIssuers_4_list) + x.RemoveIssuers = *clv.list default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.MsgUpdateClassIssuers")) @@ -9701,11 +9769,17 @@ func (x *fastReflection_MsgUpdateClassIssuers) Set(fd protoreflect.FieldDescript // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_MsgUpdateClassIssuers) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.issuers": - if x.Issuers == nil { - x.Issuers = []string{} + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.add_issuers": + if x.AddIssuers == nil { + x.AddIssuers = [][]byte{} + } + value := &_MsgUpdateClassIssuers_3_list{list: &x.AddIssuers} + return protoreflect.ValueOfList(value) + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.remove_issuers": + if x.RemoveIssuers == nil { + x.RemoveIssuers = [][]byte{} } - value := &_MsgUpdateClassIssuers_3_list{list: &x.Issuers} + value := &_MsgUpdateClassIssuers_4_list{list: &x.RemoveIssuers} return protoreflect.ValueOfList(value) case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.admin": panic(fmt.Errorf("field admin of message regen.ecocredit.v1beta1.MsgUpdateClassIssuers is not mutable")) @@ -9728,9 +9802,12 @@ func (x *fastReflection_MsgUpdateClassIssuers) NewField(fd protoreflect.FieldDes return protoreflect.ValueOfString("") case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.class_id": return protoreflect.ValueOfString("") - case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.issuers": - list := []string{} + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.add_issuers": + list := [][]byte{} return protoreflect.ValueOfList(&_MsgUpdateClassIssuers_3_list{list: &list}) + case "regen.ecocredit.v1beta1.MsgUpdateClassIssuers.remove_issuers": + list := [][]byte{} + return protoreflect.ValueOfList(&_MsgUpdateClassIssuers_4_list{list: &list}) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: regen.ecocredit.v1beta1.MsgUpdateClassIssuers")) @@ -9808,9 +9885,15 @@ func (x *fastReflection_MsgUpdateClassIssuers) ProtoMethods() *protoiface.Method if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if len(x.Issuers) > 0 { - for _, s := range x.Issuers { - l = len(s) + if len(x.AddIssuers) > 0 { + for _, b := range x.AddIssuers { + l = len(b) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if len(x.RemoveIssuers) > 0 { + for _, b := range x.RemoveIssuers { + l = len(b) n += 1 + l + runtime.Sov(uint64(l)) } } @@ -9843,11 +9926,20 @@ func (x *fastReflection_MsgUpdateClassIssuers) ProtoMethods() *protoiface.Method i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Issuers) > 0 { - for iNdEx := len(x.Issuers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.Issuers[iNdEx]) - copy(dAtA[i:], x.Issuers[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Issuers[iNdEx]))) + if len(x.RemoveIssuers) > 0 { + for iNdEx := len(x.RemoveIssuers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.RemoveIssuers[iNdEx]) + copy(dAtA[i:], x.RemoveIssuers[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.RemoveIssuers[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(x.AddIssuers) > 0 { + for iNdEx := len(x.AddIssuers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.AddIssuers[iNdEx]) + copy(dAtA[i:], x.AddIssuers[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AddIssuers[iNdEx]))) i-- dAtA[i] = 0x1a } @@ -9981,9 +10073,9 @@ func (x *fastReflection_MsgUpdateClassIssuers) ProtoMethods() *protoiface.Method iNdEx = postIndex case 3: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Issuers", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AddIssuers", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -9993,23 +10085,55 @@ func (x *fastReflection_MsgUpdateClassIssuers) ProtoMethods() *protoiface.Method } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen 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.Issuers = append(x.Issuers, string(dAtA[iNdEx:postIndex])) + x.AddIssuers = append(x.AddIssuers, make([]byte, postIndex-iNdEx)) + copy(x.AddIssuers[len(x.AddIssuers)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RemoveIssuers", wireType) + } + var byteLen 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++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + byteLen + 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.RemoveIssuers = append(x.RemoveIssuers, make([]byte, postIndex-iNdEx)) + copy(x.RemoveIssuers[len(x.RemoveIssuers)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -11997,8 +12121,10 @@ type MsgUpdateClassIssuers struct { Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` // class_id is the unique ID of the credit class. ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - // issuers are the updated account addresses of the approved issuers. - Issuers []string `protobuf:"bytes,3,rep,name=issuers,proto3" json:"issuers,omitempty"` + // add_issuers are the issuers to add to the class issuers list. + AddIssuers [][]byte `protobuf:"bytes,3,rep,name=add_issuers,json=addIssuers,proto3" json:"add_issuers,omitempty"` + // remove_issuers are the issuers to remove from the class issuers list. + RemoveIssuers [][]byte `protobuf:"bytes,4,rep,name=remove_issuers,json=removeIssuers,proto3" json:"remove_issuers,omitempty"` } func (x *MsgUpdateClassIssuers) Reset() { @@ -12035,9 +12161,16 @@ func (x *MsgUpdateClassIssuers) GetClassId() string { return "" } -func (x *MsgUpdateClassIssuers) GetIssuers() []string { +func (x *MsgUpdateClassIssuers) GetAddIssuers() [][]byte { if x != nil { - return x.Issuers + return x.AddIssuers + } + return nil +} + +func (x *MsgUpdateClassIssuers) GetRemoveIssuers() [][]byte { + if x != nil { + return x.RemoveIssuers } return nil } @@ -12522,101 +12655,104 @@ var file_regen_ecocredit_v1beta1_tx_proto_rawDesc = []byte{ 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x1d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x62, 0x0a, - 0x15, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x49, - 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x73, 0x75, 0x65, - 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, - 0x73, 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x65, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, - 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1a, 0x0a, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, 0x0a, 0x1e, 0x4d, 0x73, 0x67, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc5, 0x07, 0x0a, 0x03, - 0x4d, 0x73, 0x67, 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, - 0x73, 0x73, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x1a, 0x2f, 0x2e, 0x72, 0x65, - 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x0d, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x29, 0x2e, - 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, - 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0b, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, + 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x90, 0x01, + 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x19, 0x0a, + 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x5f, + 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x61, + 0x64, 0x64, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x6d, + 0x6f, 0x76, 0x65, 0x5f, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, + 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, + 0x22, 0x1f, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x65, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x61, + 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, + 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, + 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, 0x0a, 0x1e, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc5, 0x07, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, - 0x74, 0x63, 0x68, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, - 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x20, 0x2e, 0x72, + 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6d, 0x0a, 0x0d, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x29, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x1a, 0x28, - 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x52, 0x65, 0x74, 0x69, - 0x72, 0x65, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x31, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x6a, 0x65, + 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, 0x0b, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, + 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, + 0x63, 0x68, 0x1a, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, - 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x22, 0x2e, 0x72, - 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, - 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x10, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, - 0x12, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x1a, 0x34, - 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x1a, 0x36, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, - 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x20, 0x2e, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x1a, 0x28, 0x2e, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x65, 0x6e, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x52, 0x65, 0x74, 0x69, 0x72, + 0x65, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, + 0x65, 0x74, 0x69, 0x72, 0x65, 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, + 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x58, 0x0a, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x12, 0x22, 0x2e, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x1a, + 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x61, 0x6e, + 0x63, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x76, 0x0a, 0x10, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x12, + 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x1a, 0x34, 0x2e, + 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, + 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x7c, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x12, 0x2e, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, - 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x37, 0x2e, 0x72, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x42, 0xf8, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, + 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x1a, 0x36, 0x2e, 0x72, 0x65, 0x67, 0x65, + 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x7f, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2f, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x37, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x52, - 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, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, - 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x52, - 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x61, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x42, 0xf8, 0x01, 0x0a, 0x1b, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x52, 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, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x3b, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x58, 0xaa, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0xca, 0x02, 0x17, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0xe2, 0x02, 0x23, 0x52, 0x65, + 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, + 0x62, 0x65, 0x74, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/regen/ecocredit/v1beta1/tx.proto b/proto/regen/ecocredit/v1beta1/tx.proto index 2d41919577..eeb684cbc0 100644 --- a/proto/regen/ecocredit/v1beta1/tx.proto +++ b/proto/regen/ecocredit/v1beta1/tx.proto @@ -280,8 +280,11 @@ message MsgUpdateClassIssuers { // class_id is the unique ID of the credit class. string class_id = 2; - // issuers are the updated account addresses of the approved issuers. - repeated string issuers = 3; + // add_issuers are the issuers to add to the class issuers list. + repeated bytes add_issuers = 3; + + // remove_issuers are the issuers to remove from the class issuers list. + repeated bytes remove_issuers = 4; } // MsgUpdateClassIssuersResponse is the MsgUpdateClassIssuers response type. diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index 108ccb95fd..f0da49ee38 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -461,17 +461,20 @@ func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpda return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", class.Admin, req.Admin) } - // delete the old issuers - if err = s.stateStore.ClassIssuerStore().DeleteBy(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(class.Id)); err != nil { - return nil, err + for _, issuer := range req.RemoveIssuers { + if err = s.stateStore.ClassIssuerStore().Delete(ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: class.Id, + Issuer: issuer, + }); err != nil { + return nil, err + } } // add the new issuers - for _, issuer := range req.Issuers { - iAddr, _ := sdk.AccAddressFromBech32(issuer) + for _, issuer := range req.AddIssuers { if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ ClassId: class.Id, - Issuer: iAddr, + Issuer: issuer, }); err != nil { return nil, err } diff --git a/x/ecocredit/v1beta1/tx.pb.go b/x/ecocredit/v1beta1/tx.pb.go index 17d0b0748b..d0537212e6 100644 --- a/x/ecocredit/v1beta1/tx.pb.go +++ b/x/ecocredit/v1beta1/tx.pb.go @@ -1114,8 +1114,10 @@ type MsgUpdateClassIssuers struct { Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty"` // class_id is the unique ID of the credit class. ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - // issuers are the updated account addresses of the approved issuers. - Issuers []string `protobuf:"bytes,3,rep,name=issuers,proto3" json:"issuers,omitempty"` + // add_issuers are the issuers to add to the class issuers list. + AddIssuers [][]byte `protobuf:"bytes,3,rep,name=add_issuers,json=addIssuers,proto3" json:"add_issuers,omitempty"` + // remove_issuers are the issuers to remove from the class issuers list. + RemoveIssuers [][]byte `protobuf:"bytes,4,rep,name=remove_issuers,json=removeIssuers,proto3" json:"remove_issuers,omitempty"` } func (m *MsgUpdateClassIssuers) Reset() { *m = MsgUpdateClassIssuers{} } @@ -1165,9 +1167,16 @@ func (m *MsgUpdateClassIssuers) GetClassId() string { return "" } -func (m *MsgUpdateClassIssuers) GetIssuers() []string { +func (m *MsgUpdateClassIssuers) GetAddIssuers() [][]byte { if m != nil { - return m.Issuers + return m.AddIssuers + } + return nil +} + +func (m *MsgUpdateClassIssuers) GetRemoveIssuers() [][]byte { + if m != nil { + return m.RemoveIssuers } return nil } @@ -1338,70 +1347,71 @@ func init() { func init() { proto.RegisterFile("regen/ecocredit/v1beta1/tx.proto", fileDescriptor_a7efad3b6b8cd694) } var fileDescriptor_a7efad3b6b8cd694 = []byte{ - // 993 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xdf, 0x6f, 0xe3, 0xc4, - 0x13, 0xaf, 0x93, 0x5e, 0xd2, 0x4c, 0xbe, 0x69, 0x7b, 0xdb, 0xfb, 0x96, 0xe0, 0xa3, 0x69, 0x64, - 0x09, 0x35, 0x87, 0xc0, 0xa6, 0x3d, 0x7e, 0xa8, 0xe2, 0x01, 0x5d, 0x7b, 0x42, 0x57, 0x44, 0x10, - 0xf8, 0x0e, 0x09, 0xf1, 0x12, 0x6d, 0xec, 0xc1, 0x35, 0xc4, 0x76, 0x64, 0x6f, 0xaf, 0x77, 0x12, - 0x12, 0x6f, 0x3c, 0xdf, 0xff, 0x81, 0x04, 0xcf, 0xf7, 0x07, 0x20, 0xf1, 0x78, 0x2f, 0x48, 0xbc, - 0x81, 0x5a, 0xf1, 0x7f, 0x20, 0xef, 0xae, 0xb7, 0xd9, 0x34, 0x17, 0x27, 0x02, 0x89, 0x97, 0xa4, - 0x33, 0xfe, 0xcc, 0x67, 0x3f, 0x33, 0x99, 0x9d, 0x71, 0xa1, 0x9b, 0x62, 0x80, 0xb1, 0x83, 0x5e, - 0xe2, 0xa5, 0xe8, 0x87, 0xcc, 0x79, 0xbc, 0x3f, 0x44, 0x46, 0xf7, 0x1d, 0xf6, 0xc4, 0x1e, 0xa7, - 0x09, 0x4b, 0xc8, 0x2b, 0x1c, 0x61, 0x2b, 0x84, 0x2d, 0x11, 0xe6, 0xad, 0x20, 0x09, 0x12, 0x8e, - 0x71, 0xf2, 0xbf, 0x04, 0xdc, 0xdc, 0x0d, 0x92, 0x24, 0x18, 0xa1, 0xc3, 0xad, 0xe1, 0xd9, 0xd7, - 0x0e, 0x0b, 0x23, 0xcc, 0x18, 0x8d, 0xc6, 0x02, 0x60, 0xfd, 0x60, 0xc0, 0x7a, 0x3f, 0x0b, 0x8e, - 0x53, 0xa4, 0x0c, 0x8f, 0x47, 0x34, 0xcb, 0xc8, 0x2d, 0xb8, 0x41, 0xfd, 0x28, 0x8c, 0xdb, 0x46, - 0xd7, 0xe8, 0x35, 0x5c, 0x61, 0x90, 0x36, 0xd4, 0xc3, 0x2c, 0x3b, 0xc3, 0x34, 0x6b, 0x57, 0xba, - 0xd5, 0x5e, 0xc3, 0x2d, 0x4c, 0x62, 0xc2, 0x5a, 0x84, 0x8c, 0xfa, 0x94, 0xd1, 0x76, 0xb5, 0x6b, - 0xf4, 0xfe, 0xe7, 0x2a, 0x9b, 0xf4, 0x60, 0x53, 0xe8, 0x1c, 0xb0, 0xa7, 0x63, 0x1c, 0xc4, 0x34, - 0xc2, 0xf6, 0x2a, 0xa7, 0x5d, 0x17, 0xfe, 0x47, 0x4f, 0xc7, 0xf8, 0x29, 0x8d, 0xd0, 0xba, 0x0b, - 0xdb, 0xba, 0x0e, 0x17, 0xb3, 0x71, 0x12, 0x67, 0x48, 0x5e, 0x85, 0x35, 0x2f, 0x77, 0x0c, 0x42, - 0x5f, 0x4a, 0xaa, 0x73, 0xfb, 0xc4, 0xb7, 0x7e, 0x34, 0x60, 0x53, 0x45, 0x7d, 0x96, 0x26, 0xdf, - 0xa0, 0xc7, 0xc8, 0x36, 0xd4, 0x84, 0x34, 0x89, 0x96, 0x96, 0xc6, 0x53, 0xd1, 0x78, 0xe6, 0xa6, - 0x70, 0x07, 0x36, 0xc7, 0x82, 0x79, 0x30, 0x4a, 0x3c, 0xca, 0xc2, 0x24, 0x96, 0x29, 0x6c, 0x48, - 0xff, 0x27, 0xd2, 0x4d, 0x76, 0x00, 0x0a, 0x68, 0xe8, 0xb7, 0x6f, 0x70, 0x50, 0x43, 0x7a, 0x4e, - 0x7c, 0xeb, 0x10, 0xda, 0xd3, 0x62, 0x55, 0x92, 0x7a, 0xa8, 0x31, 0x1d, 0xfa, 0x57, 0x75, 0xe2, - 0x67, 0x3a, 0xa2, 0xcc, 0x3b, 0x7d, 0x69, 0x9a, 0x3a, 0x53, 0x65, 0x8a, 0x89, 0x7c, 0x0e, 0x6b, - 0x39, 0x90, 0xc6, 0x1e, 0xb6, 0xab, 0xdd, 0x6a, 0xaf, 0x79, 0xf0, 0xae, 0xfd, 0x92, 0x9e, 0xb2, - 0xf5, 0x13, 0x6d, 0xfe, 0x79, 0x22, 0x83, 0x5d, 0x45, 0xa3, 0x55, 0x6f, 0x75, 0xaa, 0x7a, 0x1f, - 0x02, 0x64, 0x8c, 0xa6, 0x6c, 0xe0, 0x53, 0x86, 0xbc, 0x24, 0xcd, 0x03, 0xd3, 0x16, 0x5d, 0x69, - 0x17, 0x5d, 0x69, 0x3f, 0x2a, 0xba, 0xf2, 0x68, 0xf5, 0xd9, 0x1f, 0xbb, 0x86, 0xdb, 0xe0, 0x31, - 0xf7, 0x29, 0x43, 0xf2, 0x01, 0xac, 0x61, 0xec, 0x8b, 0xf0, 0xda, 0x82, 0xe1, 0x75, 0x8c, 0xfd, - 0x3c, 0xd8, 0xfc, 0xc9, 0x80, 0x96, 0xa6, 0x9a, 0xbc, 0x06, 0x8d, 0x14, 0xbd, 0x70, 0x1c, 0x62, - 0xcc, 0x8a, 0x32, 0x2b, 0x07, 0xd9, 0x83, 0x0d, 0x96, 0x52, 0x9f, 0x0e, 0x47, 0x38, 0xa0, 0x51, - 0x72, 0x16, 0x33, 0x59, 0xc0, 0xf5, 0xc2, 0x7d, 0x8f, 0x7b, 0xc9, 0xeb, 0xb0, 0x9e, 0x22, 0x0b, - 0x53, 0xf4, 0x0b, 0x5c, 0x95, 0xe3, 0x5a, 0xd2, 0x2b, 0x61, 0x0e, 0x6c, 0x09, 0x47, 0x84, 0xf1, - 0xb5, 0xf6, 0x21, 0x57, 0x8f, 0x8a, 0x0e, 0xb2, 0x0e, 0x27, 0x6e, 0x01, 0x17, 0xae, 0x1a, 0x64, - 0x17, 0x9a, 0xc3, 0xdc, 0x31, 0xf0, 0x31, 0x4e, 0x22, 0x29, 0x1d, 0xb8, 0xeb, 0x7e, 0xee, 0xb1, - 0x9e, 0x57, 0xa0, 0xde, 0xcf, 0x82, 0x87, 0x18, 0xfb, 0x79, 0x6f, 0x64, 0x18, 0xfb, 0x57, 0xbd, - 0x21, 0x2c, 0x3d, 0xfb, 0xca, 0x74, 0xf6, 0x1f, 0x41, 0x5d, 0x34, 0x40, 0x26, 0x3b, 0xe3, 0xcd, - 0x79, 0x9d, 0x91, 0x1f, 0x64, 0xe7, 0x1f, 0xc7, 0x22, 0xc6, 0x2d, 0x82, 0xcd, 0x9f, 0x0d, 0x68, - 0x4e, 0x3c, 0x28, 0x95, 0xfe, 0xdf, 0x97, 0xfd, 0x26, 0x6c, 0xc8, 0x8c, 0x8a, 0x7a, 0x5b, 0xbf, - 0x19, 0xd0, 0xe8, 0x67, 0x81, 0xcb, 0xc1, 0x79, 0x41, 0x4f, 0x93, 0xd1, 0x44, 0x41, 0x85, 0x45, - 0x3e, 0xbe, 0x2a, 0x59, 0x85, 0x97, 0xec, 0xed, 0x79, 0x25, 0x13, 0x64, 0xb6, 0xf8, 0x9a, 0x2e, - 0x5b, 0x7e, 0x8d, 0x94, 0x54, 0x91, 0x96, 0xb2, 0xcd, 0x07, 0xd0, 0xd2, 0xa2, 0xca, 0x6b, 0xba, - 0x0d, 0x35, 0xad, 0x94, 0xd2, 0xb2, 0xb6, 0xe0, 0xa6, 0x52, 0xa2, 0x92, 0x7d, 0x2e, 0x92, 0x3d, - 0xce, 0xaf, 0xc8, 0xe8, 0x5f, 0x4a, 0x56, 0x90, 0xd9, 0xe2, 0xeb, 0x5a, 0x8f, 0x3c, 0x80, 0x96, - 0xf6, 0xe4, 0x9f, 0x26, 0x24, 0xc8, 0x54, 0x42, 0x1e, 0x6c, 0xf5, 0xb3, 0xe0, 0x8b, 0xb1, 0x5f, - 0x6c, 0x93, 0x7b, 0x7c, 0x89, 0xcd, 0x5e, 0x6d, 0x73, 0x16, 0xc3, 0x6d, 0x68, 0xc4, 0x78, 0x3e, - 0x10, 0x41, 0xf2, 0x47, 0x89, 0xf1, 0x9c, 0xb3, 0x59, 0x3b, 0x70, 0x7b, 0xc6, 0x21, 0x4a, 0xc3, - 0x10, 0xfe, 0xaf, 0x3f, 0x3e, 0x91, 0x0b, 0x73, 0x69, 0x15, 0x13, 0xbb, 0xb7, 0xaa, 0xed, 0x5e, - 0x6b, 0x17, 0x76, 0x66, 0x9e, 0xa1, 0x44, 0x20, 0x1f, 0x28, 0x13, 0x80, 0x7e, 0x31, 0x99, 0x97, - 0x56, 0x31, 0x67, 0x49, 0x5a, 0x5d, 0xe8, 0xcc, 0x3e, 0xa6, 0x10, 0x72, 0xf0, 0x4b, 0x1d, 0xaa, - 0xfd, 0x2c, 0x20, 0x01, 0x34, 0x27, 0x5f, 0x36, 0xf6, 0xca, 0x97, 0x0f, 0x07, 0x9a, 0xce, 0x82, - 0x40, 0x35, 0x30, 0x23, 0x68, 0xe9, 0xef, 0x05, 0x77, 0xca, 0x19, 0x24, 0xd4, 0xdc, 0x5f, 0x18, - 0xaa, 0x8e, 0x53, 0x79, 0x89, 0xed, 0xbc, 0xb7, 0xe0, 0x52, 0x5d, 0x24, 0x2f, 0x7d, 0x11, 0xb8, - 0xb0, 0xca, 0x67, 0x7c, 0xb7, 0x6c, 0x38, 0x9b, 0xbd, 0x32, 0x84, 0xe2, 0xfc, 0x12, 0x6a, 0x72, - 0xd0, 0x59, 0xe5, 0xf3, 0xcb, 0x7c, 0xa3, 0x1c, 0x33, 0xc9, 0x2c, 0xa7, 0x8a, 0x55, 0x3e, 0x2c, - 0xe6, 0x33, 0xeb, 0x57, 0x9c, 0x3c, 0x86, 0xcd, 0x6b, 0xf7, 0x7b, 0xee, 0xc2, 0x9a, 0x46, 0x9b, - 0xef, 0x2c, 0x83, 0x56, 0xe7, 0x7e, 0x07, 0x64, 0xc6, 0x9d, 0xb6, 0x17, 0xe4, 0x92, 0x78, 0xf3, - 0xbd, 0xe5, 0xf0, 0xea, 0xf4, 0xef, 0x61, 0x6b, 0xd6, 0x65, 0x76, 0x16, 0xa4, 0x2b, 0x02, 0xcc, - 0xf7, 0x97, 0x0c, 0x28, 0x04, 0x1c, 0x3d, 0xfc, 0xf5, 0xa2, 0x63, 0xbc, 0xb8, 0xe8, 0x18, 0x7f, - 0x5e, 0x74, 0x8c, 0x67, 0x97, 0x9d, 0x95, 0x17, 0x97, 0x9d, 0x95, 0xdf, 0x2f, 0x3b, 0x2b, 0x5f, - 0x1d, 0x06, 0x21, 0x3b, 0x3d, 0x1b, 0xda, 0x5e, 0x12, 0x39, 0x9c, 0xfc, 0xad, 0x18, 0xd9, 0x79, - 0x92, 0x7e, 0x2b, 0xad, 0x11, 0xfa, 0x01, 0xa6, 0xce, 0x93, 0xeb, 0xff, 0xde, 0x0c, 0x6b, 0xfc, - 0x55, 0xee, 0xee, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xce, 0x80, 0xf6, 0x00, 0x0d, 0x00, - 0x00, + // 1015 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4f, 0x6f, 0xe3, 0x54, + 0x10, 0xaf, 0x93, 0x6c, 0xd2, 0x4c, 0x36, 0x6d, 0xd7, 0x5d, 0x4a, 0xf0, 0xd2, 0x24, 0xb2, 0x84, + 0x9a, 0x45, 0x60, 0xd3, 0x2e, 0x7f, 0x54, 0x71, 0x40, 0xdb, 0xae, 0xd0, 0x16, 0x11, 0x04, 0xde, + 0x45, 0x42, 0x5c, 0xa2, 0x17, 0xbf, 0xc1, 0x35, 0xc4, 0x76, 0x64, 0xbf, 0xb6, 0xbb, 0x12, 0x12, + 0x37, 0xce, 0xfd, 0x1e, 0x48, 0x70, 0xde, 0x0f, 0x80, 0xc4, 0x71, 0x2f, 0x48, 0xdc, 0x40, 0xad, + 0xf8, 0x1e, 0xc8, 0xef, 0x3d, 0xbf, 0xc6, 0x69, 0x1a, 0x27, 0x02, 0x89, 0x4b, 0xd2, 0x19, 0xff, + 0xe6, 0xf7, 0x7e, 0x33, 0x99, 0x37, 0xe3, 0x42, 0x37, 0x46, 0x0f, 0x43, 0x1b, 0xdd, 0xc8, 0x8d, + 0x91, 0xfa, 0xcc, 0x3e, 0xdd, 0x1d, 0x22, 0x23, 0xbb, 0x36, 0x7b, 0x66, 0x8d, 0xe3, 0x88, 0x45, + 0xfa, 0xab, 0x1c, 0x61, 0x29, 0x84, 0x25, 0x11, 0xc6, 0x5d, 0x2f, 0xf2, 0x22, 0x8e, 0xb1, 0xd3, + 0xbf, 0x04, 0xdc, 0xe8, 0x78, 0x51, 0xe4, 0x8d, 0xd0, 0xe6, 0xd6, 0xf0, 0xe4, 0x1b, 0x9b, 0xf9, + 0x01, 0x26, 0x8c, 0x04, 0x63, 0x01, 0x30, 0x7f, 0xd4, 0x60, 0xad, 0x9f, 0x78, 0x87, 0x31, 0x12, + 0x86, 0x87, 0x23, 0x92, 0x24, 0xfa, 0x5d, 0xb8, 0x45, 0x68, 0xe0, 0x87, 0x2d, 0xad, 0xab, 0xf5, + 0xea, 0x8e, 0x30, 0xf4, 0x16, 0xd4, 0xfc, 0x24, 0x39, 0xc1, 0x38, 0x69, 0x95, 0xba, 0xe5, 0x5e, + 0xdd, 0xc9, 0x4c, 0xdd, 0x80, 0xd5, 0x00, 0x19, 0xa1, 0x84, 0x91, 0x56, 0xb9, 0xab, 0xf5, 0x6e, + 0x3b, 0xca, 0xd6, 0x7b, 0xb0, 0x21, 0x74, 0x0e, 0xd8, 0xf3, 0x31, 0x0e, 0x42, 0x12, 0x60, 0xab, + 0xc2, 0x69, 0xd7, 0x84, 0xff, 0xe9, 0xf3, 0x31, 0x7e, 0x46, 0x02, 0x34, 0x1f, 0xc0, 0x56, 0x5e, + 0x87, 0x83, 0xc9, 0x38, 0x0a, 0x13, 0xd4, 0x5f, 0x83, 0x55, 0x37, 0x75, 0x0c, 0x7c, 0x2a, 0x25, + 0xd5, 0xb8, 0x7d, 0x44, 0xcd, 0x9f, 0x34, 0xd8, 0x50, 0x51, 0x9f, 0xc7, 0xd1, 0xb7, 0xe8, 0x32, + 0x7d, 0x0b, 0xaa, 0x42, 0x9a, 0x44, 0x4b, 0x2b, 0xc7, 0x53, 0xca, 0xf1, 0xcc, 0x4d, 0xe1, 0x3e, + 0x6c, 0x8c, 0x05, 0xf3, 0x60, 0x14, 0xb9, 0x84, 0xf9, 0x51, 0x28, 0x53, 0x58, 0x97, 0xfe, 0x4f, + 0xa5, 0x5b, 0xdf, 0x06, 0xc8, 0xa0, 0x3e, 0x6d, 0xdd, 0xe2, 0xa0, 0xba, 0xf4, 0x1c, 0x51, 0x73, + 0x1f, 0x5a, 0xd3, 0x62, 0x55, 0x92, 0xf9, 0x50, 0x6d, 0x3a, 0xf4, 0xef, 0xf2, 0xc4, 0xcf, 0x74, + 0x40, 0x98, 0x7b, 0x7c, 0x63, 0x9a, 0x79, 0xa6, 0xd2, 0x14, 0x93, 0xfe, 0x05, 0xac, 0xa6, 0x40, + 0x12, 0xba, 0xd8, 0x2a, 0x77, 0xcb, 0xbd, 0xc6, 0xde, 0x7b, 0xd6, 0x0d, 0x3d, 0x65, 0xe5, 0x4f, + 0xb4, 0xf8, 0xe7, 0x91, 0x0c, 0x76, 0x14, 0x4d, 0xae, 0x7a, 0x95, 0xa9, 0xea, 0x7d, 0x04, 0x90, + 0x30, 0x12, 0xb3, 0x01, 0x25, 0x0c, 0x79, 0x49, 0x1a, 0x7b, 0x86, 0x25, 0xba, 0xd2, 0xca, 0xba, + 0xd2, 0x7a, 0x9a, 0x75, 0xe5, 0x41, 0xe5, 0xfc, 0xcf, 0x8e, 0xe6, 0xd4, 0x79, 0xcc, 0x23, 0xc2, + 0x50, 0xff, 0x10, 0x56, 0x31, 0xa4, 0x22, 0xbc, 0xba, 0x60, 0x78, 0x0d, 0x43, 0x9a, 0x06, 0x1b, + 0x3f, 0x6b, 0xd0, 0xcc, 0xa9, 0xd6, 0x5f, 0x87, 0x7a, 0x8c, 0xae, 0x3f, 0xf6, 0x31, 0x64, 0x59, + 0x99, 0x95, 0x43, 0xdf, 0x81, 0x75, 0x16, 0x13, 0x4a, 0x86, 0x23, 0x1c, 0x90, 0x20, 0x3a, 0x09, + 0x99, 0x2c, 0xe0, 0x5a, 0xe6, 0x7e, 0xc8, 0xbd, 0xfa, 0x1b, 0xb0, 0x16, 0x23, 0xf3, 0x63, 0xa4, + 0x19, 0xae, 0xcc, 0x71, 0x4d, 0xe9, 0x95, 0x30, 0x1b, 0x36, 0x85, 0x23, 0xc0, 0xf0, 0x5a, 0xfb, + 0xe8, 0x57, 0x8f, 0xb2, 0x0e, 0x32, 0xf7, 0x27, 0x6e, 0x01, 0x17, 0xae, 0x1a, 0xa4, 0x03, 0x8d, + 0x61, 0xea, 0x18, 0x50, 0x0c, 0xa3, 0x40, 0x4a, 0x07, 0xee, 0x7a, 0x94, 0x7a, 0xcc, 0x17, 0x25, + 0xa8, 0xf5, 0x13, 0xef, 0x09, 0x86, 0x34, 0xed, 0x8d, 0x04, 0x43, 0x7a, 0xd5, 0x1b, 0xc2, 0xca, + 0x67, 0x5f, 0x9a, 0xce, 0xfe, 0x63, 0xa8, 0x89, 0x06, 0x48, 0x64, 0x67, 0xbc, 0x35, 0xaf, 0x33, + 0xd2, 0x83, 0xac, 0xf4, 0xe3, 0x50, 0xc4, 0x38, 0x59, 0xb0, 0xf1, 0x8b, 0x06, 0x8d, 0x89, 0x07, + 0x85, 0xd2, 0xff, 0xff, 0xb2, 0xdf, 0x81, 0x75, 0x99, 0x51, 0x56, 0x6f, 0xf3, 0x77, 0x0d, 0xea, + 0xfd, 0xc4, 0x73, 0x38, 0x38, 0x2d, 0xe8, 0x71, 0x34, 0x9a, 0x28, 0xa8, 0xb0, 0xf4, 0x4f, 0xae, + 0x4a, 0x56, 0xe2, 0x25, 0x7b, 0x67, 0x5e, 0xc9, 0x04, 0x99, 0x25, 0xbe, 0xa6, 0xcb, 0x96, 0x5e, + 0x23, 0x25, 0x55, 0xa4, 0xa5, 0x6c, 0xe3, 0x31, 0x34, 0x73, 0x51, 0xc5, 0x35, 0xdd, 0x82, 0x6a, + 0xae, 0x94, 0xd2, 0x32, 0x37, 0xe1, 0x8e, 0x52, 0xa2, 0x92, 0x7d, 0x21, 0x92, 0x3d, 0x4c, 0xaf, + 0xc8, 0xe8, 0x3f, 0x4a, 0x56, 0x90, 0x59, 0xe2, 0xeb, 0x5a, 0x8f, 0x3c, 0x86, 0x66, 0xee, 0xc9, + 0xbf, 0x4d, 0x48, 0x90, 0xa9, 0x84, 0x5c, 0xd8, 0xec, 0x27, 0xde, 0x97, 0x63, 0x9a, 0x6d, 0x93, + 0x87, 0x7c, 0x89, 0xcd, 0x5e, 0x6d, 0x73, 0x16, 0xc3, 0x3d, 0xa8, 0x87, 0x78, 0x36, 0x10, 0x41, + 0xf2, 0x47, 0x09, 0xf1, 0x8c, 0xb3, 0x99, 0xdb, 0x70, 0x6f, 0xc6, 0x21, 0x4a, 0xc3, 0xb9, 0x06, + 0xaf, 0xe4, 0x9f, 0x1f, 0xc9, 0x8d, 0xb9, 0xb4, 0x8c, 0x0e, 0x34, 0x08, 0xa5, 0x83, 0x6c, 0x01, + 0xa7, 0xb7, 0xf3, 0xb6, 0x03, 0x84, 0xd2, 0x8c, 0x91, 0x5f, 0x8c, 0x20, 0x3a, 0x45, 0x85, 0xa9, + 0x70, 0x4c, 0x53, 0x78, 0x25, 0xcc, 0xec, 0xc0, 0xf6, 0x4c, 0x45, 0x4a, 0x33, 0xf2, 0xf9, 0x33, + 0x01, 0xe8, 0x67, 0x83, 0x7c, 0x69, 0xcd, 0x73, 0x76, 0xaa, 0xd9, 0x85, 0xf6, 0xec, 0x63, 0x32, + 0x21, 0x7b, 0xbf, 0xd6, 0xa0, 0xdc, 0x4f, 0x3c, 0xdd, 0x83, 0xc6, 0xe4, 0xbb, 0xc9, 0x4e, 0xf1, + 0xae, 0xe2, 0x40, 0xc3, 0x5e, 0x10, 0xa8, 0xe6, 0x6b, 0x00, 0xcd, 0xfc, 0x6b, 0xc4, 0xfd, 0x62, + 0x06, 0x09, 0x35, 0x76, 0x17, 0x86, 0xaa, 0xe3, 0x54, 0x5e, 0x62, 0x99, 0xef, 0x2c, 0xb8, 0x83, + 0x17, 0xc9, 0x2b, 0xbf, 0x37, 0x1c, 0xa8, 0xf0, 0x95, 0xd0, 0x2d, 0x9a, 0xe5, 0x46, 0xaf, 0x08, + 0xa1, 0x38, 0xbf, 0x82, 0xaa, 0x9c, 0x8b, 0x66, 0xf1, 0xb8, 0x33, 0xde, 0x2c, 0xc6, 0x4c, 0x32, + 0xcb, 0x21, 0x64, 0x16, 0xcf, 0x96, 0xf9, 0xcc, 0xf9, 0x89, 0xa0, 0x9f, 0xc2, 0xc6, 0xb5, 0x71, + 0x30, 0x77, 0xbf, 0x4d, 0xa3, 0x8d, 0x77, 0x97, 0x41, 0xab, 0x73, 0xbf, 0x07, 0x7d, 0xc6, 0x04, + 0xb0, 0x16, 0xe4, 0x92, 0x78, 0xe3, 0xfd, 0xe5, 0xf0, 0xea, 0xf4, 0x1f, 0x60, 0x73, 0xd6, 0x65, + 0xb6, 0x17, 0xa4, 0xcb, 0x02, 0x8c, 0x0f, 0x96, 0x0c, 0xc8, 0x04, 0x1c, 0x3c, 0xf9, 0xed, 0xa2, + 0xad, 0xbd, 0xbc, 0x68, 0x6b, 0x7f, 0x5d, 0xb4, 0xb5, 0xf3, 0xcb, 0xf6, 0xca, 0xcb, 0xcb, 0xf6, + 0xca, 0x1f, 0x97, 0xed, 0x95, 0xaf, 0xf7, 0x3d, 0x9f, 0x1d, 0x9f, 0x0c, 0x2d, 0x37, 0x0a, 0x6c, + 0x4e, 0xfe, 0x76, 0x88, 0xec, 0x2c, 0x8a, 0xbf, 0x93, 0xd6, 0x08, 0xa9, 0x87, 0xb1, 0xfd, 0xec, + 0xfa, 0x7f, 0x43, 0xc3, 0x2a, 0x7f, 0xf3, 0x7b, 0xf0, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6d, + 0x81, 0x31, 0x1f, 0x2f, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2559,11 +2569,20 @@ func (m *MsgUpdateClassIssuers) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Issuers) > 0 { - for iNdEx := len(m.Issuers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Issuers[iNdEx]) - copy(dAtA[i:], m.Issuers[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Issuers[iNdEx]))) + if len(m.RemoveIssuers) > 0 { + for iNdEx := len(m.RemoveIssuers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RemoveIssuers[iNdEx]) + copy(dAtA[i:], m.RemoveIssuers[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.RemoveIssuers[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if len(m.AddIssuers) > 0 { + for iNdEx := len(m.AddIssuers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AddIssuers[iNdEx]) + copy(dAtA[i:], m.AddIssuers[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.AddIssuers[iNdEx]))) i-- dAtA[i] = 0x1a } @@ -3036,9 +3055,15 @@ func (m *MsgUpdateClassIssuers) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if len(m.Issuers) > 0 { - for _, s := range m.Issuers { - l = len(s) + if len(m.AddIssuers) > 0 { + for _, b := range m.AddIssuers { + l = len(b) + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.RemoveIssuers) > 0 { + for _, b := range m.RemoveIssuers { + l = len(b) n += 1 + l + sovTx(uint64(l)) } } @@ -5473,9 +5498,9 @@ func (m *MsgUpdateClassIssuers) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Issuers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AddIssuers", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -5485,23 +5510,55 @@ func (m *MsgUpdateClassIssuers) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Issuers = append(m.Issuers, string(dAtA[iNdEx:postIndex])) + m.AddIssuers = append(m.AddIssuers, make([]byte, postIndex-iNdEx)) + copy(m.AddIssuers[len(m.AddIssuers)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemoveIssuers", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RemoveIssuers = append(m.RemoveIssuers, make([]byte, postIndex-iNdEx)) + copy(m.RemoveIssuers[len(m.RemoveIssuers)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex From d03d4ea5f6c65100e3c8cbbfb68efc36626e6edf Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 09:07:15 -0800 Subject: [PATCH 17/31] fix: credit types use ORM and remove marketplace code --- x/ecocredit/server/core/msg_server.go | 449 +----------------------- x/ecocredit/server/core/query_server.go | 19 +- 2 files changed, 25 insertions(+), 443 deletions(-) diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index f0da49ee38..7ad3a66da0 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -6,8 +6,6 @@ import ( "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - basketv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/basket/v1beta1" - marketplacev1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/marketplace/v1beta1" ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" "github.com/regen-network/regen-ledger/types" "github.com/regen-network/regen-ledger/types/math" @@ -44,7 +42,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass return nil, err } - creditType, err := s.getCreditType(sdkCtx, req.CreditTypeName) + creditType, err := s.getCreditType(ctx, req.CreditTypeName) if err != nil { return nil, err } @@ -160,7 +158,7 @@ func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch return nil, err } - creditType, err := s.getCreditType(sdkCtx, classInfo.CreditType) + creditType, err := s.getCreditType(ctx, classInfo.CreditType) if err != nil { return nil, err } @@ -499,413 +497,6 @@ func (s serverImpl) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpd return &v1beta1.MsgUpdateClassMetadataResponse{}, err } -// Sell creates new sell orders for credits -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) Sell(ctx context.Context, sell *marketplacev1beta1.MsgSell) (*marketplacev1beta1.MsgSellResponse, error) { - panic("implement me") - //ctx := types.UnwrapSDKContext(goCtx) - //owner := req.Owner - //store := ctx.KVStore(s.storeKey) - // - //ownerAddr, err := sdk.AccAddressFromBech32(owner) - //if err != nil { - // return nil, err - //} - // - //sellOrderIds := make([]uint64, len(req.Orders)) - // - //for i, order := range req.Orders { - // - // // verify expiration is in the future - // if order.Expiration != nil && order.Expiration.Before(ctx.BlockTime()) { - // return nil, sdkerrors.ErrInvalidRequest.Wrapf("expiration must be in the future: %s", order.Expiration) - // } - // - // err = verifyCreditBalance(store, ownerAddr, order.BatchDenom, order.Quantity) - // if err != nil { - // return nil, err - // } - // - // // TODO: Verify that AskPrice.Denom is in AllowAskDenom #624 - // - // orderID, err := s.createSellOrder(ctx, owner, order) - // if err != nil { - // return nil, err - // } - // - // sellOrderIds[i] = orderID - // err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventSell{ - // OrderId: orderID, - // BatchDenom: order.BatchDenom, - // Quantity: order.Quantity, - // AskPrice: order.AskPrice, - // DisableAutoRetire: order.DisableAutoRetire, - // Expiration: order.Expiration, - // }) - // if err != nil { - // return nil, err - // } - // - // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "create sell order") - //} - // - //return &ecocredit.MsgSellResponse{SellOrderIds: sellOrderIds}, nil -} - -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) createSellOrder(ctx types.Context, owner string, o *marketplacev1beta1.MsgSell_Order) (uint64, error) { - panic("impl me!") - //orderID := s.sellOrderTable.Sequence().PeekNextVal(ctx) - //_, err := s.sellOrderTable.Create(ctx, &ecocredit.SellOrder{ - // Owner: owner, - // OrderId: orderID, - // BatchDenom: o.BatchDenom, - // Quantity: o.Quantity, - // AskPrice: o.AskPrice, - // DisableAutoRetire: o.DisableAutoRetire, - // Expiration: o.Expiration, - //}) - //return orderID, err -} - -// UpdateSellOrders updates existing sell orders for credits -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) UpdateSellOrders(ctx context.Context, orders *marketplacev1beta1.MsgUpdateSellOrders) (*marketplacev1beta1.MsgUpdateSellOrdersResponse, error) { - panic("implement me") - //ctx := types.UnwrapSDKContext(goCtx) - //owner := req.Owner - //store := ctx.KVStore(s.storeKey) - // - //ownerAddr, err := sdk.AccAddressFromBech32(owner) - //if err != nil { - // return nil, err - //} - // - //for _, update := range req.Updates { - // - // // verify expiration is in the future - // if update.NewExpiration != nil && update.NewExpiration.Before(ctx.BlockTime()) { - // return nil, sdkerrors.ErrInvalidRequest.Wrapf("expiration must be in the future: %s", update.NewExpiration) - // } - // - // sellOrder, err := s.getSellOrder(ctx, update.SellOrderId) - // if err != nil { - // return nil, ecocredit.ErrInvalidSellOrder.Wrapf("sell order id %d not found", update.SellOrderId) - // } - // - // if req.Owner != sellOrder.Owner { - // return nil, sdkerrors.ErrUnauthorized.Wrapf("signer is not the owner of sell order id %d", update.SellOrderId) - // } - // - // // TODO: Verify that NewAskPrice.Denom is in AllowAskDenom #624 - // - // err = verifyCreditBalance(store, ownerAddr, sellOrder.BatchDenom, update.NewQuantity) - // if err != nil { - // return nil, err - // } - // - // sellOrder.Quantity = update.NewQuantity - // sellOrder.AskPrice = update.NewAskPrice - // sellOrder.DisableAutoRetire = update.DisableAutoRetire - // sellOrder.Expiration = update.NewExpiration - // - // err = s.sellOrderTable.Update(ctx, sellOrder.OrderId, sellOrder) - // if err != nil { - // return nil, err - // } - // - // err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventUpdateSellOrder{ - // Owner: owner, - // SellOrderId: sellOrder.OrderId, - // BatchDenom: sellOrder.BatchDenom, - // NewQuantity: sellOrder.Quantity, - // NewAskPrice: sellOrder.AskPrice, - // DisableAutoRetire: sellOrder.DisableAutoRetire, - // NewExpiration: sellOrder.Expiration, - // }) - // if err != nil { - // return nil, err - // } - // - // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "update sell order") - //} - // - //return &ecocredit.MsgUpdateSellOrdersResponse{}, nil -} - -// Buy creates new buy orders for credits -func (s serverImpl) Buy(ctx context.Context, buy *marketplacev1beta1.MsgBuy) (*marketplacev1beta1.MsgBuyResponse, error) { - panic("implement me") - //ctx := types.UnwrapSDKContext(goCtx) - //sdkCtx := sdk.UnwrapSDKContext(goCtx) - //store := ctx.KVStore(s.storeKey) - //buyer := req.Buyer - // - //buyerAddr, err := sdk.AccAddressFromBech32(buyer) - //if err != nil { - // return nil, err - //} - // - //buyOrderIds := make([]uint64, len(req.Orders)) - // - //for i, order := range req.Orders { - // - // // verify expiration is in the future - // if order.Expiration != nil && order.Expiration.Before(ctx.BlockTime()) { - // return nil, sdkerrors.ErrInvalidRequest.Wrapf("expiration must be in the future: %s", order.Expiration) - // } - // - // balances := s.bankKeeper.SpendableCoins(sdkCtx, buyerAddr) - // bidPrice := order.BidPrice - // balanceAmount := balances.AmountOf(bidPrice.Denom) - // - // // TODO: Verify that bidPrice.Denom is in AllowAskDenom #624 - // - // // get decimal amount of credits desired for purchase - // creditsDesired, err := math.NewPositiveDecFromString(order.Quantity) - // if err != nil { - // return nil, err - // } - // - // // calculate the amount of coin to send for purchase - // coinToSend, err := getCoinNeeded(creditsDesired, bidPrice) - // if err != nil { - // return nil, err - // } - // - // // verify buyer has sufficient balance in coin - // if balanceAmount.LT(coinToSend.Amount) { - // return nil, sdkerrors.ErrInsufficientFunds.Wrapf("insufficient balance: got %s, needed at least: %s", balanceAmount.String(), coinToSend.Amount.String()) - // } - // - // switch order.Selection.Sum.(type) { - // case *ecocredit.MsgBuy_Order_Selection_SellOrderId: - // - // sellOrderId := order.Selection.GetSellOrderId() - // sellOrder, err := s.getSellOrder(ctx, sellOrderId) - // if err != nil { - // return nil, err - // } - // - // sellerAddr, err := sdk.AccAddressFromBech32(sellOrder.Owner) - // if err != nil { - // return nil, err - // } - // - // // verify bid price and ask price denoms match - // if bidPrice.Denom != sellOrder.AskPrice.Denom { - // return nil, sdkerrors.ErrInvalidRequest.Wrapf("bid price denom does not match ask price denom: got %s, expected: %s", bidPrice.Denom, sellOrder.AskPrice.Denom) - // } - // - // // verify bid price is greater than or equal to ask price - // if bidPrice.Amount.LT(sellOrder.AskPrice.Amount) { - // return nil, sdkerrors.ErrInvalidRequest.Wrapf("bid price too low: got %s, needed at least: %s", bidPrice.String(), sellOrder.AskPrice.String()) - // } - // - // // verify seller has sufficient balance in credits - // err = verifyCreditBalance(store, sellerAddr, sellOrder.BatchDenom, sellOrder.Quantity) - // if err != nil { - // return nil, ecocredit.ErrInvalidSellOrder.Wrap(err.Error()) - // } - // - // // get decimal amount of credits available for purchase - // creditsAvailable, err := math.NewDecFromString(sellOrder.Quantity) - // if err != nil { - // return nil, ecocredit.ErrInvalidSellOrder.Wrap(err.Error()) - // } - // - // creditsToReceive := creditsDesired - // - // // check if credits desired is more than credits available - // if creditsDesired.Cmp(creditsAvailable) == 1 { - // - // // error if partial fill disabled - // if order.DisablePartialFill { - // return nil, ecocredit.ErrInsufficientFunds.Wrap("sell order does not have sufficient credits to fill the buy order") - // } - // - // creditsToReceive = creditsAvailable - // - // // recalculate coinToSend if creditsToReceive is not creditsDesired - // coinToSend, err = getCoinNeeded(creditsToReceive, bidPrice) - // if err != nil { - // return nil, err - // } - // } - // - // // send coin to the seller account - // err = s.bankKeeper.SendCoins(sdkCtx, buyerAddr, sellerAddr, sdk.Coins{coinToSend}) - // if err != nil { - // return nil, err - // } - // - // // error if auto-retire is required for given sell order - // if !sellOrder.DisableAutoRetire && order.DisableAutoRetire { - // return nil, ecocredit.ErrInvalidBuyOrder.Wrapf("auto-retire is required for sell order %d", sellOrder.OrderId) - // } - // - // // error if auto-retire is required and missing location - // if !sellOrder.DisableAutoRetire && order.RetirementLocation == "" { - // return nil, ecocredit.ErrInvalidBuyOrder.Wrapf("retirement location is required for sell order %d", sellOrder.OrderId) - // } - // - // // declare credit for send message - // credit := &ecocredit.MsgSend_SendCredits{ - // BatchDenom: sellOrder.BatchDenom, - // } - // - // // set tradable or retired amount depending on auto-retire - // if sellOrder.DisableAutoRetire && order.DisableAutoRetire { - // credit.RetiredAmount = "0" - // credit.TradableAmount = creditsToReceive.String() - // } else { - // credit.RetiredAmount = creditsToReceive.String() - // credit.RetirementLocation = order.RetirementLocation - // credit.TradableAmount = "0" - // } - // - // // send credits to the buyer account - // err = s.sendEcocredits(ctx, credit, store, sellerAddr, buyerAddr) - // if err != nil { - // return nil, err - // } - // - // // get remaining credits in sell order - // creditsRemaining, err := creditsAvailable.Sub(creditsToReceive) - // if err != nil { - // return nil, err - // } - // - // if creditsRemaining.IsZero() { - // - // // delete sell order if no remaining credits - // if err := s.sellOrderTable.Delete(ctx, sellOrder.OrderId); err != nil { - // return nil, err - // } - // - // } else { - // sellOrder.Quantity = creditsRemaining.String() - // - // // update sell order quantity with remaining credits - // err = s.sellOrderTable.Update(ctx, sellOrder.OrderId, sellOrder) - // if err != nil { - // return nil, err - // } - // } - // - // // TODO: do we want to store a direct buy order? #623 - // buyOrderID := s.buyOrderTable.Sequence().NextVal(ctx) - // buyOrderIds[i] = buyOrderID - // - // err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventBuyOrderCreated{ - // BuyOrderId: buyOrderID, - // SellOrderId: sellOrderId, - // Quantity: order.Quantity, - // BidPrice: order.BidPrice, - // DisableAutoRetire: order.DisableAutoRetire, - // DisablePartialFill: order.DisablePartialFill, - // RetirementLocation: order.RetirementLocation, - // Expiration: order.Expiration, - // }) - // if err != nil { - // return nil, err - // } - // - // err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventBuyOrderFilled{ - // BuyOrderId: buyOrderID, - // SellOrderId: sellOrderId, - // BatchDenom: sellOrder.BatchDenom, - // Quantity: creditsToReceive.String(), - // TotalPrice: &coinToSend, - // }) - // if err != nil { - // return nil, err - // } - // - // // TODO: implement processing for filter option #623 - // //case *ecocredit.MsgBuy_Order_Selection_Filter: - // - // default: - // return nil, sdkerrors.ErrInvalidRequest - // } - // - // ctx.GasMeter().ConsumeGas(gasCostPerIteration, "create buy order") - //} - // - //return &ecocredit.MsgBuyResponse{BuyOrderIds: buyOrderIds}, nil -} - -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) createBuyOrder(ctx types.Context, buyer string, o *marketplacev1beta1.MsgBuy_Order) (uint64, error) { - panic("impl me!") - //orderID := s.buyOrderTable.Sequence().PeekNextVal(ctx) - //selection := ecocredit.BuyOrder_Selection{ - // Sum: &ecocredit.BuyOrder_Selection_SellOrderId{ - // SellOrderId: o.Selection.GetSellOrderId(), - // }, - //} - //_, err := s.buyOrderTable.Create(ctx, &ecocredit.BuyOrder{ - // Buyer: buyer, - // BuyOrderId: orderID, - // Selection: &selection, - // Quantity: o.Quantity, - // BidPrice: o.BidPrice, - // DisableAutoRetire: o.DisableAutoRetire, - // DisablePartialFill: o.DisablePartialFill, - // Expiration: o.Expiration, - //}) - //return orderID, err -} - -// AllowAskDenom adds a new ask denom -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) AllowAskDenom(ctx context.Context, denom *marketplacev1beta1.MsgAllowAskDenom) (*marketplacev1beta1.MsgAllowAskDenomResponse, error) { - panic("implement me") - // ctx := types.UnwrapSDKContext(goCtx) - // - //rootAddress := s.accountKeeper.GetModuleAddress(govtypes.ModuleName).String() - // - //if req.RootAddress != rootAddress { - // return nil, sdkerrors.ErrUnauthorized.Wrapf("root address must be governance module address, got: %s, expected: %s", req.RootAddress, rootAddress) - //} - // - //err := s.askDenomTable.Create(ctx, &ecocredit.AskDenom{ - // Denom: req.Denom, - // DisplayDenom: req.DisplayDenom, - // Exponent: req.Exponent, - //}) - //if err != nil { - // return nil, err - //} - // - //err = ctx.EventManager().EmitTypedEvent(&ecocredit.EventAllowAskDenom{ - // Denom: req.Denom, - // DisplayDenom: req.DisplayDenom, - // Exponent: req.Exponent, - //}) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.MsgAllowAskDenomResponse{}, nil -} - -func (s serverImpl) CreateBasket(ctx context.Context, basket *basketv1beta1.MsgCreateBasket) (*basketv1beta1.MsgCreateBasketResponse, error) { - panic("implement me") -} - -func (s serverImpl) AddToBasket(ctx context.Context, basket *basketv1beta1.MsgAddToBasket) (*basketv1beta1.MsgAddToBasketResponse, error) { - panic("implement me") -} - -func (s serverImpl) TakeFromBasket(ctx context.Context, basket *basketv1beta1.MsgTakeFromBasket) (*basketv1beta1.MsgTakeFromBasketResponse, error) { - panic("implement me") -} - -func (s serverImpl) PickFromBasket(ctx context.Context, basket *basketv1beta1.MsgPickFromBasket) (*basketv1beta1.MsgPickFromBasketResponse, error) { - panic("implement me") -} - // ------- UTILITIES ------ // Checks if the given address is in the allowlist of credit class creators @@ -1107,13 +698,13 @@ func getNonNegativeFixedDecs(precision uint32, decimals ...string) ([]math.Dec, return decs, nil } -func (s serverImpl) getCreditTypeFromBatchDenom(ctx context.Context, denom string) (v1beta1.CreditType, error) { +func (s serverImpl) getCreditTypeFromBatchDenom(ctx context.Context, denom string) (*ecocreditv1beta1.CreditType, error) { classId := ecocredit.GetClassIdFromBatchDenom(denom) classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, classId) if err != nil { - return v1beta1.CreditType{}, err + return nil, err } - return s.getCreditType(sdk.UnwrapSDKContext(ctx), classInfo.CreditType) + return s.getCreditType(ctx, classInfo.CreditType) } func (s serverImpl) getClassSequenceNo(ctx context.Context, ctype string) (uint64, error) { @@ -1134,33 +725,9 @@ func (s serverImpl) getClassSequenceNo(ctx context.Context, ctype string) (uint6 return seq, err } -func (s serverImpl) getCreditType(ctx sdk.Context, creditTypeName string) (v1beta1.CreditType, error) { - creditTypes := s.getAllCreditTypes(ctx) - creditTypeName = ecocredit.NormalizeCreditTypeName(creditTypeName) - for _, creditType := range creditTypes { - // credit type name's stored via params have enforcement on normalization, so we can be sure they will already - // be normalized here. - if creditType.Name == creditTypeName { - return *creditType, nil - } - } - return v1beta1.CreditType{}, sdkerrors.ErrInvalidType.Wrapf("%s is not a valid credit type", creditTypeName) -} - -func (s serverImpl) getAllCreditTypes(ctx sdk.Context) []*v1beta1.CreditType { - var params ecocredit.Params - s.paramSpace.GetParamSet(ctx, ¶ms) - creditTypes := params.CreditTypes - v1beta1types := make([]*v1beta1.CreditType, len(creditTypes)) - for i, typ := range creditTypes { - v1beta1types[i] = &v1beta1.CreditType{ - Abbreviation: typ.Abbreviation, - Name: typ.Name, - Unit: typ.Unit, - Precision: typ.Precision, - } - } - return v1beta1types +func (s serverImpl) getCreditType(ctx context.Context, creditTypeName string) (*ecocreditv1beta1.CreditType, error) { + ct, err := s.stateStore.CreditTypeStore().GetByName(ctx, creditTypeName) + return ct, err } func (s serverImpl) getCreditClassFee(ctx sdk.Context) sdk.Coins { diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index 45a970e83d..2e472bb115 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -376,8 +376,23 @@ func (s serverImpl) Supply(ctx context.Context, request *v1beta1.QuerySupplyRequ // CreditTypes queries the list of allowed types that credit classes can have. func (s serverImpl) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypesRequest) (*v1beta1.QueryCreditTypesResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - creditTypes := s.getAllCreditTypes(sdkCtx) + creditTypes := make([]*v1beta1.CreditType, 0) + it, err := s.stateStore.CreditTypeStore().List(ctx, ecocreditv1beta1.CreditTypePrimaryKey{}) + if err != nil { + return nil, err + } + for it.Next() { + ct, err := it.Value() + if err != nil { + return nil, err + } + creditTypes = append(creditTypes, &v1beta1.CreditType{ + Abbreviation: ct.Abbreviation, + Name: ct.Name, + Unit: ct.Unit, + Precision: ct.Precision, + }) + } return &v1beta1.QueryCreditTypesResponse{CreditTypes: creditTypes}, nil } From 8b6960d9e7fdf69cabc96d65fa3dc347ebedc037 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 09:09:12 -0800 Subject: [PATCH 18/31] chore: add comment to remove params --- x/ecocredit/server/core/msg_server.go | 2 ++ x/ecocredit/server/core/query_server.go | 1 + 2 files changed, 3 insertions(+) diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index 7ad3a66da0..517cfcacfb 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -31,6 +31,7 @@ func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass return nil, err } + // TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 var params ecocredit.Params s.paramSpace.GetParamSet(sdkCtx, ¶ms) if params.AllowlistEnabled && !s.isCreatorAllowListed(sdkCtx, params.AllowedClassCreators, adminAddress) { @@ -730,6 +731,7 @@ func (s serverImpl) getCreditType(ctx context.Context, creditTypeName string) (* return ct, err } +// TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 func (s serverImpl) getCreditClassFee(ctx sdk.Context) sdk.Coins { var params ecocredit.Params s.paramSpace.GetParamSet(ctx, ¶ms) diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index 2e472bb115..87058c3863 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -397,6 +397,7 @@ func (s serverImpl) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypes } // Params queries the ecocredit module parameters. +// TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 func (s serverImpl) Params(ctx context.Context, _ *v1beta1.QueryParamsRequest) (*v1beta1.QueryParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) var params ecocredit.Params From 9bdcd8ac427f9a9c8af6f32f1ac897dde5c48db1 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 8 Feb 2022 12:10:27 -0800 Subject: [PATCH 19/31] chore: remove non-core queries --- x/ecocredit/server/core/query_server.go | 218 ------------------------ 1 file changed, 218 deletions(-) diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index 87058c3863..c5606353b2 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -419,221 +419,3 @@ func (s serverImpl) Params(ctx context.Context, _ *v1beta1.QueryParamsRequest) ( } return &v1beta1.QueryParamsResponse{Params: &v1beta1Params}, nil } - -// SellOrder queries for information about a sell order by its ID -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) SellOrder(goCtx context.Context, request *ecocredit.QuerySellOrderRequest) (*ecocredit.QuerySellOrderResponse, error) { - panic("impl me!") - //if request == nil { - // return nil, status.Errorf(codes.InvalidArgument, "empty request") - //} - // - //ctx := types.UnwrapSDKContext(goCtx) - //sellOrder, err := s.getSellOrder(ctx, request.SellOrderId) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.QuerySellOrderResponse{SellOrder: sellOrder}, nil -} - -// SellOrders queries for all sell orders with pagination. -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) SellOrders(goCtx context.Context, request *ecocredit.QuerySellOrdersRequest) (*ecocredit.QuerySellOrdersResponse, error) { - panic("impl me!") - //if request == nil { - // return nil, status.Errorf(codes.InvalidArgument, "empty request") - //} - // - //ctx := types.UnwrapSDKContext(goCtx) - //ordersIter, err := s.sellOrderTable.PrefixScan(ctx, 1, math.MaxUint64) - //if err != nil { - // return nil, err - //} - // - //var orders []*ecocredit.SellOrder - //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.QuerySellOrdersResponse{ - // SellOrders: orders, - // Pagination: pageResp, - //}, nil -} - -// SellOrdersByAddress queries for all sell orders by address with pagination. -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) SellOrdersByAddress(goCtx context.Context, request *ecocredit.QuerySellOrdersByAddressRequest) (*ecocredit.QuerySellOrdersByAddressResponse, error) { - panic("impl me!") - //if request == nil { - // return nil, status.Errorf(codes.InvalidArgument, "empty request") - //} - // - //addr, err := sdk.AccAddressFromBech32(request.Address) - //if err != nil { - // return nil, err - //} - // - //ctx := types.UnwrapSDKContext(goCtx) - //ordersIter, err := s.sellOrderByAddressIndex.GetPaginated(ctx, addr.Bytes(), request.Pagination) - //if err != nil { - // return nil, err - //} - // - //var orders []*ecocredit.SellOrder - //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.QuerySellOrdersByAddressResponse{ - // SellOrders: orders, - // Pagination: pageResp, - //}, nil -} - -// SellOrdersByBatchDenom queries for all sell orders by address with pagination. -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) SellOrdersByBatchDenom(goCtx context.Context, request *ecocredit.QuerySellOrdersByBatchDenomRequest) (*ecocredit.QuerySellOrdersByBatchDenomResponse, error) { - panic("impl me!") - //if request == nil { - // return nil, status.Errorf(codes.InvalidArgument, "empty request") - //} - // - //if err := ecocredit.ValidateDenom(request.BatchDenom); err != nil { - // return nil, err - //} - // - //ctx := types.UnwrapSDKContext(goCtx) - //ordersIter, err := s.sellOrderByBatchDenomIndex.GetPaginated(ctx, request.BatchDenom, request.Pagination) - //if err != nil { - // return nil, err - //} - // - //var orders []*ecocredit.SellOrder - //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.QuerySellOrdersByBatchDenomResponse{ - // SellOrders: orders, - // Pagination: pageResp, - //}, nil -} - -// BuyOrder queries for information about a buy order by its ID -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) BuyOrder(goCtx context.Context, request *ecocredit.QueryBuyOrderRequest) (*ecocredit.QueryBuyOrderResponse, error) { - panic("impl me!") - //if request == nil { - // return nil, status.Errorf(codes.InvalidArgument, "empty request") - //} - // - //ctx := types.UnwrapSDKContext(goCtx) - //buyOrder, err := s.getBuyOrder(ctx, request.BuyOrderId) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.QueryBuyOrderResponse{BuyOrder: buyOrder}, nil -} - -// BuyOrders queries for all buy orders with pagination. -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) BuyOrders(goCtx context.Context, request *ecocredit.QueryBuyOrdersRequest) (*ecocredit.QueryBuyOrdersResponse, error) { - panic("impl me!") - //if request == nil { - // return nil, status.Errorf(codes.InvalidArgument, "empty request") - //} - // - //ctx := types.UnwrapSDKContext(goCtx) - //ordersIter, err := s.buyOrderTable.PrefixScan(ctx, 1, math.MaxUint64) - //if err != nil { - // return nil, err - //} - // - //var orders []*ecocredit.BuyOrder - //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.QueryBuyOrdersResponse{ - // BuyOrders: orders, - // Pagination: pageResp, - //}, nil -} - -// BuyOrdersByAddress queries for all buy orders by address with pagination. -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) BuyOrdersByAddress(goCtx context.Context, request *ecocredit.QueryBuyOrdersByAddressRequest) (*ecocredit.QueryBuyOrdersByAddressResponse, error) { - panic("impl me!") - //if request == nil { - // return nil, status.Errorf(codes.InvalidArgument, "empty request") - //} - // - //ctx := types.UnwrapSDKContext(goCtx) - //addr, err := sdk.AccAddressFromBech32(request.Address) - //if err != nil { - // return nil, err - //} - // - //ordersIter, err := s.buyOrderByAddressIndex.GetPaginated(ctx, addr.Bytes(), request.Pagination) - //if err != nil { - // return nil, err - //} - // - //var orders []*ecocredit.BuyOrder - //pageResp, err := orm.Paginate(ordersIter, request.Pagination, &orders) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.QueryBuyOrdersByAddressResponse{ - // BuyOrders: orders, - // Pagination: pageResp, - //}, nil -} - -// AllowedAskDenoms queries for all allowed ask denoms with pagination. -// TODO: impl with ORM https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) AllowedAskDenoms(goCtx context.Context, request *ecocredit.QueryAllowedAskDenomsRequest) (*ecocredit.QueryAllowedAskDenomsResponse, error) { - panic("impl me!") - //if request == nil { - // return nil, status.Errorf(codes.InvalidArgument, "empty request") - //} - // - //ctx := types.UnwrapSDKContext(goCtx) - //denomsIter, err := s.askDenomTable.PrefixScan(ctx, nil, nil) - //if err != nil { - // return nil, err - //} - // - //var denoms []*ecocredit.AskDenom - //pageResp, err := orm.Paginate(denomsIter, request.Pagination, &denoms) - //if err != nil { - // return nil, err - //} - // - //return &ecocredit.QueryAllowedAskDenomsResponse{ - // AskDenoms: denoms, - // Pagination: pageResp, - //}, nil -} - -// TODO: baskets PR queries - -func (s serverImpl) Basket(ctx context.Context, request *ecocredit.QueryBasketRequest) (*ecocredit.QueryBasketResponse, error) { - panic("implement me") -} - -func (s serverImpl) Baskets(ctx context.Context, request *ecocredit.QueryBasketsRequest) (*ecocredit.QueryBasketsResponse, error) { - panic("implement me") -} - -func (s serverImpl) BasketCredits(ctx context.Context, request *ecocredit.QueryBasketCreditsRequest) (*ecocredit.QueryBasketCreditsResponse, error) { - panic("implement me") -} From 66397548d10007ec9153103afc4296aa22305b36 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Wed, 16 Feb 2022 00:39:04 -0800 Subject: [PATCH 20/31] wip: first few --- x/ecocredit/server/core/create_batch.go | 145 ++++++++++++++++++++++ x/ecocredit/server/core/create_class.go | 141 +++++++++++++++++++++ x/ecocredit/server/core/create_project.go | 99 +++++++++++++++ x/ecocredit/server/core/keeper.go | 45 +++++++ x/ecocredit/server/core/msg_server.go | 20 +-- 5 files changed, 435 insertions(+), 15 deletions(-) create mode 100644 x/ecocredit/server/core/create_batch.go create mode 100644 x/ecocredit/server/core/create_class.go create mode 100644 x/ecocredit/server/core/create_project.go create mode 100644 x/ecocredit/server/core/keeper.go diff --git a/x/ecocredit/server/core/create_batch.go b/x/ecocredit/server/core/create_batch.go new file mode 100644 index 0000000000..a420f47013 --- /dev/null +++ b/x/ecocredit/server/core/create_batch.go @@ -0,0 +1,145 @@ +package core + +import ( + "context" + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" + sdk "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "google.golang.org/protobuf/types/known/timestamppb" +) + +// CreateBatch creates a new batch of credits. +// Credits in the batch must not have more decimal places than the credit type's specified precision. +func (k Keeper) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch) (*v1beta1.MsgCreateBatchResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + projectID := req.ProjectId + + projectInfo, err := k.stateStore.ProjectInfoStore().GetByName(ctx, projectID) + if err != nil { + return nil, err + } + + classInfo, err := k.stateStore.ClassInfoStore().Get(ctx, projectInfo.ClassId) + if err != nil { + return nil, err + } + + err = k.assertClassIssuer(ctx, classInfo.Id, req.Issuer) + if err != nil { + return nil, err + } + + creditType, err := k.getCreditType(sdkCtx, classInfo.CreditType) + if err != nil { + return nil, err + } + + maxDecimalPlaces := creditType.Precision + + batchSeqNo, err := k.getBatchSeqNo(ctx, projectID) + if err != nil { + return nil, err + } + + batchDenom, err := ecocredit.FormatDenom(classInfo.Name, batchSeqNo, req.StartDate, req.EndDate) + if err != nil { + return nil, err + } + + rowID, err := k.stateStore.BatchInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: projectInfo.Id, + BatchDenom: batchDenom, + Metadata: req.Metadata, + StartDate: timestamppb.New(req.StartDate.UTC()), + EndDate: timestamppb.New(req.EndDate.UTC()), + }) + if err != nil { + return nil, err + } + + tradableSupply, retiredSupply := math.NewDecFromInt64(0), math.NewDecFromInt64(0) + + for _, issuance := range req.Issuance { + decs, err := getNonNegativeFixedDecs(maxDecimalPlaces, issuance.TradableAmount, issuance.RetiredAmount) + if err != nil { + return nil, err + } + tradable, retired := decs[0], decs[1] + + recipient, _ := sdk.AccAddressFromBech32(issuance.Recipient) + if !tradable.IsZero() { + tradableSupply, err = tradableSupply.Add(tradable) + if err != nil { + return nil, err + } + } + if !retired.IsZero() { + retiredSupply, err = retiredSupply.Add(retired) + if err != nil { + return nil, err + } + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventRetire{ + Retirer: recipient.String(), + BatchDenom: batchDenom, + Amount: retired.String(), + Location: issuance.RetirementLocation, + }); err != nil { + return nil, err + } + } + if err = k.stateStore.BatchBalanceStore().Insert(ctx, &ecocreditv1beta1.BatchBalance{ + Address: recipient, + BatchId: rowID, + Tradable: tradable.String(), + Retired: retired.String(), + }); err != nil { + return nil, err + } + + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventReceive{ + Recipient: recipient.String(), + BatchDenom: batchDenom, + RetiredAmount: tradable.String(), + TradableAmount: retired.String(), + }); err != nil { + return nil, err + } + + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "batch issuance") + } + + if err = k.stateStore.BatchSupplyStore().Insert(ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: rowID, + TradableAmount: tradableSupply.String(), + RetiredAmount: retiredSupply.String(), + CancelledAmount: math.NewDecFromInt64(0).String(), + }); err != nil { + return nil, err + } + + return &v1beta1.MsgCreateBatchResponse{BatchDenom: batchDenom}, nil +} + +func (k Keeper) getBatchSeqNo(ctx context.Context, projectID string) (uint64, error) { + var seq uint64 = 1 + batchSeq, err := k.stateStore.BatchSequenceStore().Get(ctx, projectID) + if err != nil { + if !ormerrors.IsNotFound(err) { + return 0, err + } + } else { + seq = batchSeq.NextBatchId + } + + if err = k.stateStore.BatchSequenceStore().Save(ctx, &ecocreditv1beta1.BatchSequence{ + ProjectId: projectID, + NextBatchId: seq + 1, + }); err != nil { + return 0, err + } + + return seq, err +} diff --git a/x/ecocredit/server/core/create_class.go b/x/ecocredit/server/core/create_class.go new file mode 100644 index 0000000000..f8c3f31e14 --- /dev/null +++ b/x/ecocredit/server/core/create_class.go @@ -0,0 +1,141 @@ +package core + +import ( + "context" + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" +) + +func (k Keeper) CreateClass(goCtx context.Context, req *v1beta1.MsgCreateClass) (*v1beta1.MsgCreateClassResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(goCtx) + // Charge the admin a fee to create the credit class + adminAddress, err := sdk.AccAddressFromBech32(req.Admin) + if err != nil { + return nil, err + } + + // TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 + var params ecocredit.Params + k.params.GetParamSet(sdkCtx, ¶ms) + if params.AllowlistEnabled && !k.isCreatorAllowListed(sdkCtx, params.AllowedClassCreators, adminAddress) { + return nil, sdkerrors.ErrUnauthorized.Wrapf("%s is not allowed to create credit classes", adminAddress.String()) + } + + err = k.chargeCreditClassFee(sdkCtx, adminAddress) + if err != nil { + return nil, err + } + + creditType, err := k.getCreditType(sdkCtx, req.CreditTypeName) + if err != nil { + return nil, err + } + + var seq uint64 = 1 + classSeq, err := k.stateStore.ClassSequenceStore().Get(goCtx, creditType.Abbreviation) + if err != nil { + if !ormerrors.IsNotFound(err) { + return nil, err + } + } else { + seq = classSeq.NextClassId + } + if err = k.stateStore.ClassSequenceStore().Save(goCtx, &ecocreditv1beta1.ClassSequence{ + CreditType: creditType.Abbreviation, + NextClassId: seq + 1, + }); err != nil { + return nil, err + } + + classID := ecocredit.FormatClassID(creditType.Abbreviation, seq) + + rowId, err := k.stateStore.ClassInfoStore().InsertReturningID(goCtx, &ecocreditv1beta1.ClassInfo{ + Name: classID, + Admin: adminAddress, + Metadata: req.Metadata, + CreditType: creditType.Abbreviation, + }) + if err != nil { + return nil, err + } + + for _, issuer := range req.Issuers { + issuer, _ := sdk.AccAddressFromBech32(issuer) + if err = k.stateStore.ClassIssuerStore().Insert(goCtx, &ecocreditv1beta1.ClassIssuer{ + ClassId: rowId, + Issuer: issuer, + }); err != nil { + return nil, err + } + } + + err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateClass{ + ClassId: classID, + Admin: req.Admin, + }) + if err != nil { + return nil, err + } + + return &v1beta1.MsgCreateClassResponse{ClassId: classID}, nil +} + +func (k Keeper) isCreatorAllowListed(ctx sdk.Context, allowlist []string, designer sdk.AccAddress) bool { + for _, addr := range allowlist { + ctx.GasMeter().ConsumeGas(gasCostPerIteration, "credit class creators allowlist") + allowListedAddr, _ := sdk.AccAddressFromBech32(addr) + if designer.Equals(allowListedAddr) { + return true + } + } + return false +} + +func (k Keeper) chargeCreditClassFee(ctx sdk.Context, creatorAddr sdk.AccAddress) error { + creditClassFee := k.getCreditClassFee(ctx) + + // Move the fee to the ecocredit module's account + err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, ecocredit.ModuleName, creditClassFee) + if err != nil { + return err + } + + // Burn the coins + // TODO: Update this implementation based on the discussion at + // https://github.com/regen-network/regen-ledger/issues/351 + err = k.bankKeeper.BurnCoins(ctx, ecocredit.ModuleName, creditClassFee) + if err != nil { + return err + } + + return nil +} + +func (k Keeper) getCreditClassFee(ctx sdk.Context) sdk.Coins { + var params ecocredit.Params + k.params.GetParamSet(ctx, ¶ms) + return params.CreditClassFee +} + +func (k Keeper) getCreditType(ctx sdk.Context, creditTypeName string) (ecocredit.CreditType, error) { + creditTypes := k.getAllCreditTypes(ctx) + creditTypeName = ecocredit.NormalizeCreditTypeName(creditTypeName) + for _, creditType := range creditTypes { + // credit type name's stored via params have enforcement on normalization, so we can be sure they will already + // be normalized here. + if creditType.Name == creditTypeName { + return *creditType, nil + } + } + return ecocredit.CreditType{}, sdkerrors.ErrInvalidType.Wrapf("%s is not a valid credit type", creditTypeName) +} + +func (k Keeper) getAllCreditTypes(ctx sdk.Context) []*ecocredit.CreditType { + var params ecocredit.Params + k.params.GetParamSet(ctx, ¶ms) + return params.CreditTypes +} diff --git a/x/ecocredit/server/core/create_project.go b/x/ecocredit/server/core/create_project.go new file mode 100644 index 0000000000..74bdbb3948 --- /dev/null +++ b/x/ecocredit/server/core/create_project.go @@ -0,0 +1,99 @@ +package core + +import ( + "context" + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" +) + +func (k Keeper) CreateProject(ctx context.Context, req *v1beta1.MsgCreateProject) (*v1beta1.MsgCreateProjectResponse, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + classID := req.ClassId + classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, classID) + if err != nil { + return nil, err + } + + err = k.assertClassIssuer(ctx, classInfo.Id, req.Issuer) + if err != nil { + return nil, err + } + + projectID := req.ProjectId + if projectID == "" { + found := false + for ; !found; sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "project id sequence") { + projectID, err = k.genProjectID(ctx, classInfo.Id, classInfo.Name) + if err != nil { + return nil, err + } + found, err = k.stateStore.ProjectInfoStore().HasByClassIdName(ctx, classInfo.Id, projectID) + if err != nil { + return nil, err + } + } + } + + if err = k.stateStore.ProjectInfoStore().Insert(ctx, &ecocreditv1beta1.ProjectInfo{ + Name: projectID, + ClassId: classInfo.Id, + ProjectLocation: req.ProjectLocation, + Metadata: req.Metadata, + }); err != nil { + return nil, err + } + + if err := sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateProject{ + ClassId: classID, + ProjectId: projectID, + Issuer: req.Issuer, + ProjectLocation: req.ProjectLocation, + }); err != nil { + return nil, err + } + + return &v1beta1.MsgCreateProjectResponse{ + ProjectId: projectID, + }, nil +} + +func (k Keeper) genProjectID(ctx context.Context, classRowID uint64, classID string) (string, error) { + var nextID uint64 + projectSeqNo, err := k.stateStore.ProjectSequenceStore().Get(ctx, classRowID) + switch err { + case ormerrors.NotFound: + nextID = 1 + case nil: + nextID = projectSeqNo.NextProjectId + default: + return "", err + } + + if err = k.stateStore.ProjectSequenceStore().Save(ctx, &ecocreditv1beta1.ProjectSequence{ + ClassId: classRowID, + NextProjectId: nextID + 1, + }); err != nil { + return "", err + } + + return ecocredit.FormatProjectID(classID, nextID), nil +} + +// assertClassIssuer makes sure that the issuer is part of issuers of given classID. +// Returns ErrUnauthorized otherwise. +func (k Keeper) assertClassIssuer(goCtx context.Context, classID uint64, issuer string) error { + addr, _ := sdk.AccAddressFromBech32(issuer) + found, err := k.stateStore.ClassIssuerStore().Has(goCtx, classID, addr) + if err != nil { + return err + } + if !found { + return sdkerrors.ErrUnauthorized.Wrapf("%s is not an issuer for class %s", issuer, classID) + } + return nil +} diff --git a/x/ecocredit/server/core/keeper.go b/x/ecocredit/server/core/keeper.go new file mode 100644 index 0000000000..ab7c170bfc --- /dev/null +++ b/x/ecocredit/server/core/keeper.go @@ -0,0 +1,45 @@ +package core + +import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" +) + +type Keeper struct { + stateStore ecocreditv1beta1.StateStore + bankKeeper ecocredit.BankKeeper + params ParamKeeper +} + +func (k Keeper) Send(ctx context.Context, send *v1beta1.MsgSend) (*v1beta1.MsgSendResponse, error) { + panic("implement me") +} + +func (k Keeper) Retire(ctx context.Context, retire *v1beta1.MsgRetire) (*v1beta1.MsgRetireResponse, error) { + panic("implement me") +} + +func (k Keeper) Cancel(ctx context.Context, cancel *v1beta1.MsgCancel) (*v1beta1.MsgCancelResponse, error) { + panic("implement me") +} + +func (k Keeper) UpdateClassAdmin(ctx context.Context, admin *v1beta1.MsgUpdateClassAdmin) (*v1beta1.MsgUpdateClassAdminResponse, error) { + panic("implement me") +} + +func (k Keeper) UpdateClassIssuers(ctx context.Context, issuers *v1beta1.MsgUpdateClassIssuers) (*v1beta1.MsgUpdateClassIssuersResponse, error) { + panic("implement me") +} + +func (k Keeper) UpdateClassMetadata(ctx context.Context, metadata *v1beta1.MsgUpdateClassMetadata) (*v1beta1.MsgUpdateClassMetadataResponse, error) { + panic("implement me") +} + +type ParamKeeper interface { + GetParamSet(ctx sdk.Context, params *ecocredit.Params) +} + +var _ v1beta1.MsgServer = &Keeper{} diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go index 517cfcacfb..0859318141 100644 --- a/x/ecocredit/server/core/msg_server.go +++ b/x/ecocredit/server/core/msg_server.go @@ -107,7 +107,7 @@ func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreatePro if err != nil { return nil, err } - found, err = s.stateStore.ProjectInfoStore().HasByClassIdName(ctx, classInfo.Id, projectID) + found, err = s.stateStore.ProjectInfoStore().HasByName(ctx, projectID) if err != nil { return nil, err } @@ -512,20 +512,10 @@ func (s serverImpl) isCreatorAllowListed(ctx sdk.Context, allowlist []string, de return false } -// assertClassIssuer makes sure that the issuer is part of issuers of given classID. -// Returns ErrUnauthorized otherwise. -func (s serverImpl) assertClassIssuer(goCtx context.Context, classID uint64, issuer string) error { - addr, _ := sdk.AccAddressFromBech32(issuer) - found, err := s.stateStore.ClassIssuerStore().Has(goCtx, classID, addr) - if err != nil { - return err - } - if !found { - return sdkerrors.ErrUnauthorized.Wrapf("%s is not an issuer for class %s", issuer, classID) - } - return nil -} - +// TODO: Given the following state +// project FOO. Sequence of FOO = 10. Inc it to 11 -> FOO11 +// Project FOO1. Sequence of FOO1 = 0 (doesnt exist yet). Inc it to 1 -> FOO11 +// Solution: escape the sequence? FOO1-1. FOO-11? func (s serverImpl) genProjectID(ctx context.Context, classRowID uint64, classID string) (string, error) { var nextID uint64 projectSeqNo, err := s.stateStore.ProjectSequenceStore().Get(ctx, classRowID) From c3d3afa5603468691f46879c065609a4461edca9 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Wed, 16 Feb 2022 14:09:48 -0800 Subject: [PATCH 21/31] feat: core impl keeper --- x/ecocredit/server/core/cancel.go | 91 +++ x/ecocredit/server/core/create_class.go | 15 +- x/ecocredit/server/core/genesis.go | 30 - x/ecocredit/server/core/invariants.go | 217 ------ x/ecocredit/server/core/invariants_test.go | 488 -------------- x/ecocredit/server/core/keeper.go | 34 +- x/ecocredit/server/core/msg_server.go | 749 --------------------- x/ecocredit/server/core/operations.go | 20 - x/ecocredit/server/core/query_server.go | 64 +- x/ecocredit/server/core/retire.go | 95 +++ x/ecocredit/server/core/send.go | 163 +++++ x/ecocredit/server/core/server.go | 67 -- x/ecocredit/server/core/update_class.go | 75 +++ 13 files changed, 477 insertions(+), 1631 deletions(-) create mode 100644 x/ecocredit/server/core/cancel.go delete mode 100644 x/ecocredit/server/core/genesis.go delete mode 100644 x/ecocredit/server/core/invariants.go delete mode 100644 x/ecocredit/server/core/invariants_test.go delete mode 100644 x/ecocredit/server/core/msg_server.go delete mode 100644 x/ecocredit/server/core/operations.go create mode 100644 x/ecocredit/server/core/retire.go create mode 100644 x/ecocredit/server/core/send.go delete mode 100644 x/ecocredit/server/core/server.go create mode 100644 x/ecocredit/server/core/update_class.go diff --git a/x/ecocredit/server/core/cancel.go b/x/ecocredit/server/core/cancel.go new file mode 100644 index 0000000000..219ffbd991 --- /dev/null +++ b/x/ecocredit/server/core/cancel.go @@ -0,0 +1,91 @@ +package core + +import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" +) + +func (k Keeper) Cancel(ctx context.Context, req *v1beta1.MsgCancel) (*v1beta1.MsgCancelResponse, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + holder, _ := sdk.AccAddressFromBech32(req.Holder) + + for _, credit := range req.Credits { + batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) + if err != nil { + return nil, err + + } + creditType, err := k.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) + if err != nil { + return nil, err + } + precision := creditType.Precision + + userBalance, err := k.stateStore.BatchBalanceStore().Get(ctx, holder, batch.Id) + if err != nil { + return nil, err + } + batchSupply, err := k.stateStore.BatchSupplyStore().Get(ctx, batch.Id) + if err != nil { + return nil, err + } + decs, err := getNonNegativeFixedDecs(precision, credit.Amount, batchSupply.TradableAmount, userBalance.Tradable, batchSupply.CancelledAmount) + if err != nil { + return nil, err + } + amtToCancelDec, supplyTradable, userBalTradable, cancelledDec := decs[0], decs[1], decs[2], decs[3] + userBalTradable, err = math.SafeSubBalance(userBalTradable, amtToCancelDec) + if err != nil { + return nil, err + } + supplyTradable, err = math.SafeSubBalance(supplyTradable, amtToCancelDec) + if err != nil { + return nil, err + } + cancelledDec, err = cancelledDec.Add(amtToCancelDec) + if err != nil { + return nil, err + } + if err = k.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ + Address: holder, + BatchId: batch.Id, + Tradable: userBalTradable.String(), + Retired: userBalance.Retired, + }); err != nil { + return nil, err + } + if err = k.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: batch.Id, + TradableAmount: supplyTradable.String(), + RetiredAmount: batchSupply.RetiredAmount, + CancelledAmount: cancelledDec.String(), + }); err != nil { + return nil, err + } + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCancel{ + Canceller: holder.String(), + BatchDenom: credit.BatchDenom, + Amount: credit.Amount, + }); err != nil { + return nil, err + } + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "cancel ecocredits") + } + return &v1beta1.MsgCancelResponse{}, nil +} + +func getNonNegativeFixedDecs(precision uint32, decimals ...string) ([]math.Dec, error) { + decs := make([]math.Dec, len(decimals)) + for i, decimal := range decimals { + dec, err := math.NewNonNegativeFixedDecFromString(decimal, precision) + if err != nil { + return nil, err + } + decs[i] = dec + } + return decs, nil +} diff --git a/x/ecocredit/server/core/create_class.go b/x/ecocredit/server/core/create_class.go index f8c3f31e14..7e7a44d052 100644 --- a/x/ecocredit/server/core/create_class.go +++ b/x/ecocredit/server/core/create_class.go @@ -10,6 +10,10 @@ import ( "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" ) +// TODO: Revisit this once we have proper gas fee framework. +// Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, https://github.com/cosmos/cosmos-sdk/discussions/9072 +const gasCostPerIteration = uint64(10) + func (k Keeper) CreateClass(goCtx context.Context, req *v1beta1.MsgCreateClass) (*v1beta1.MsgCreateClassResponse, error) { sdkCtx := sdk.UnwrapSDKContext(goCtx) // Charge the admin a fee to create the credit class @@ -121,17 +125,22 @@ func (k Keeper) getCreditClassFee(ctx sdk.Context) sdk.Coins { return params.CreditClassFee } -func (k Keeper) getCreditType(ctx sdk.Context, creditTypeName string) (ecocredit.CreditType, error) { +func (k Keeper) getCreditType(ctx sdk.Context, creditTypeName string) (ecocreditv1beta1.CreditType, error) { creditTypes := k.getAllCreditTypes(ctx) creditTypeName = ecocredit.NormalizeCreditTypeName(creditTypeName) for _, creditType := range creditTypes { // credit type name's stored via params have enforcement on normalization, so we can be sure they will already // be normalized here. if creditType.Name == creditTypeName { - return *creditType, nil + return ecocreditv1beta1.CreditType{ + Abbreviation: creditType.Abbreviation, + Name: creditType.Name, + Unit: creditType.Unit, + Precision: creditType.Precision, + }, nil } } - return ecocredit.CreditType{}, sdkerrors.ErrInvalidType.Wrapf("%s is not a valid credit type", creditTypeName) + return ecocreditv1beta1.CreditType{}, sdkerrors.ErrInvalidType.Wrapf("%s is not a valid credit type", creditTypeName) } func (k Keeper) getAllCreditTypes(ctx sdk.Context) []*ecocredit.CreditType { diff --git a/x/ecocredit/server/core/genesis.go b/x/ecocredit/server/core/genesis.go deleted file mode 100644 index 0ce3977306..0000000000 --- a/x/ecocredit/server/core/genesis.go +++ /dev/null @@ -1,30 +0,0 @@ -package core - -import ( - "encoding/json" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/orm/types/ormjson" - regentypes "github.com/regen-network/regen-ledger/types" - abci "github.com/tendermint/tendermint/abci/types" -) - -// InitGenesis performs genesis initialization for the ecocredit module. It -// returns no validator updates. -func (s serverImpl) InitGenesis(ctx regentypes.Context, cdc codec.Codec, data json.RawMessage) ([]abci.ValidatorUpdate, error) { - goCtx := ctx.Context.Context() - target, err := ormjson.NewRawMessageSource(data) - if err != nil { - return nil, err - } - return []abci.ValidatorUpdate{}, s.db.ImportJSON(goCtx, target) -} - -// ExportGenesis will dump the ecocredit module state into a serializable GenesisState. -func (s serverImpl) ExportGenesis(ctx regentypes.Context, cdc codec.Codec) (json.RawMessage, error) { - target := ormjson.NewRawMessageTarget() - err := s.db.ExportJSON(ctx.Context.Context(), target) - if err != nil { - return nil, err - } - return target.JSON() -} diff --git a/x/ecocredit/server/core/invariants.go b/x/ecocredit/server/core/invariants.go deleted file mode 100644 index 9a59f3542e..0000000000 --- a/x/ecocredit/server/core/invariants.go +++ /dev/null @@ -1,217 +0,0 @@ -package core - -import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" - "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit" -) - -// RegisterInvariants registers the ecocredit module invariants. -func (s serverImpl) RegisterInvariants(ir sdk.InvariantRegistry) { - ir.RegisterRoute(ecocredit.ModuleName, "tradable-supply", s.tradableSupplyInvariant()) - ir.RegisterRoute(ecocredit.ModuleName, "retired-supply", s.retiredSupplyInvariant()) -} - -func (s serverImpl) tradableSupplyInvariant() sdk.Invariant { - return func(ctx sdk.Context) (string, bool) { - supplyStore := s.stateStore.BatchSupplyStore() - batchStore := s.stateStore.BatchInfoStore() - balanceStore := s.stateStore.BatchBalanceStore() - return tradableSupplyInvariant(supplyStore, balanceStore, batchStore, ctx) - } -} - -func tradableSupplyInvariant(batchSupplyStore ecocreditv1beta1.BatchSupplyStore, balanceStore ecocreditv1beta1.BatchBalanceStore, batchInfoStore ecocreditv1beta1.BatchInfoStore, ctx sdk.Context) (string, bool) { - var ( - msg string - broken bool - ) - calTradableSupplies := make(map[string]math.Dec) - - err := iterateBalances(balanceStore, batchInfoStore, true, ctx, func(denom, supply string) bool { - balance, err := math.NewNonNegativeDecFromString(supply) - if err != nil { - broken = true - msg += fmt.Sprintf("error while parsing tradable balance %v", err) - } - if supply, ok := calTradableSupplies[denom]; ok { - supply, err := math.SafeAddBalance(supply, balance) - if err != nil { - broken = true - msg += fmt.Sprintf("error adding credit batch tradable supply %v", err) - } - calTradableSupplies[denom] = supply - } else { - calTradableSupplies[denom] = balance - } - - return false - }) - if err != nil { - msg = fmt.Sprintf("error querying credit balances tradable supply %v", err) - } - - if err := iterateSupplies(batchSupplyStore, batchInfoStore, true, ctx, func(denom string, s string) bool { - supply, err := math.NewNonNegativeDecFromString(s) - if err != nil { - broken = true - msg += fmt.Sprintf("error while parsing tradable supply for denom: %s", denom) - } - if s1, ok := calTradableSupplies[denom]; ok { - if supply.Cmp(s1) != 0 { - broken = true - msg += fmt.Sprintf("tradable supply is incorrect for %s credit batch, expected %v, got %v", denom, supply, s1) - } - } else { - broken = true - msg += fmt.Sprintf("tradable supply is not found for %s credit batch", denom) - } - return false - }); err != nil { - msg = fmt.Sprintf("error querying credit tradable supply %v", err) - } - - return msg, broken -} - -func (s serverImpl) retiredSupplyInvariant() sdk.Invariant { - return func(ctx sdk.Context) (string, bool) { - supplyStore := s.stateStore.BatchSupplyStore() - balanceStore := s.stateStore.BatchBalanceStore() - batchStore := s.stateStore.BatchInfoStore() - return retiredSupplyInvariant(supplyStore, balanceStore, batchStore, ctx) - } -} - -func retiredSupplyInvariant(supplyStore ecocreditv1beta1.BatchSupplyStore, balanceStore ecocreditv1beta1.BatchBalanceStore, batchInfoStore ecocreditv1beta1.BatchInfoStore, ctx sdk.Context) (string, bool) { - var ( - msg string - broken bool - ) - calRetiredSupplies := make(map[string]math.Dec) - err := iterateBalances(balanceStore, batchInfoStore, false, ctx, func(denom, supply string) bool { - balance, err := math.NewNonNegativeDecFromString(supply) - if err != nil { - broken = true - msg += fmt.Sprintf("error while parsing retired balance %v", err) - } - if supply, ok := calRetiredSupplies[denom]; ok { - supply, err := math.SafeAddBalance(balance, supply) - if err != nil { - broken = true - msg += fmt.Sprintf("error adding credit batch retired supply %v", err) - } - calRetiredSupplies[denom] = supply - } else { - calRetiredSupplies[denom] = balance - } - return false - }) - if err != nil { - msg = fmt.Sprintf("error querying credit retired balances %v", err) - } - - if err := iterateSupplies(supplyStore, batchInfoStore, false, ctx, func(denom, s string) bool { - supply, err := math.NewNonNegativeDecFromString(s) - if err != nil { - broken = true - msg += fmt.Sprintf("error while parsing reired supply for denom: %s", denom) - } - if s1, ok := calRetiredSupplies[denom]; ok { - if supply.Cmp(s1) != 0 { - broken = true - msg += fmt.Sprintf("retired supply is incorrect for %s credit batch, expected %v, got %v", denom, supply, s1) - } - } else { - broken = true - msg += fmt.Sprintf("retired supply is not found for %s credit batch", denom) - } - - return false - }); err != nil { - msg = fmt.Sprintf("error querying credit retired supply %v", err) - } - - return msg, broken -} - -func iterateBalances(store ecocreditv1beta1.BatchBalanceStore, batchStore ecocreditv1beta1.BatchInfoStore, tradable bool, sdkCtx sdk.Context, cb func(denom, balance string) bool) error { - ctx := sdkCtx.Context() - it, err := store.List(ctx, &ecocreditv1beta1.BatchBalanceBatchIdAddressIndexKey{}) - if err != nil { - return err - } - // we cache denoms here so we don't have to ORM query each time - batchIdToDenom := make(map[uint64]string) - for it.Next() { - val, err := it.Value() - if err != nil { - return err - } - var batchDenom string - if d, ok := batchIdToDenom[val.BatchId]; ok { - batchDenom = d - } else { - batch, err := batchStore.Get(ctx, val.BatchId) - if err != nil { - return err - } - if batch == nil { - panic(fmt.Sprintf("batch was nil with batch id: %d and denom %s", val.BatchId, batchDenom)) - } - batchDenom = batch.BatchDenom - batchIdToDenom[val.BatchId] = batchDenom - } - - var balance string - if tradable { - balance = val.Tradable - } else { - balance = val.Retired - } - - if cb(batchDenom, balance) { - break - } - } - return nil -} - -func iterateSupplies(supplyStore ecocreditv1beta1.BatchSupplyStore, batchStore ecocreditv1beta1.BatchInfoStore, tradable bool, sdkCtx sdk.Context, cb func(denom, supply string) bool) error { - ctx := sdkCtx.Context() - it, err := supplyStore.List(ctx, &ecocreditv1beta1.BatchSupplyBatchIdIndexKey{}) - if err != nil { - return err - } - // we cache denoms here so we don't have to ORM query each time - batchIdToDenom := make(map[uint64]string) - for it.Next() { - val, err := it.Value() - if err != nil { - return err - } - var batchDenom string - if d, ok := batchIdToDenom[val.BatchId]; ok { - batchDenom = d - } else { - batch, err := batchStore.Get(ctx, val.BatchId) - if err != nil { - return err - } - batchDenom = batch.BatchDenom - batchIdToDenom[val.BatchId] = batchDenom - } - var supply string - if tradable { - supply = val.TradableAmount - } else { - supply = val.RetiredAmount - } - if cb(batchDenom, supply) { - break - } - } - return nil -} diff --git a/x/ecocredit/server/core/invariants_test.go b/x/ecocredit/server/core/invariants_test.go deleted file mode 100644 index 71619ee442..0000000000 --- a/x/ecocredit/server/core/invariants_test.go +++ /dev/null @@ -1,488 +0,0 @@ -package core - -import ( - "context" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/orm/model/ormdb" - "github.com/cosmos/cosmos-sdk/orm/model/ormtable" - "github.com/cosmos/cosmos-sdk/orm/testing/ormtest" - sdk "github.com/cosmos/cosmos-sdk/types" - ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" - "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "google.golang.org/protobuf/reflect/protoreflect" - "google.golang.org/protobuf/types/known/timestamppb" - "testing" -) - -func setupStore(t *testing.T) ormdb.ModuleDB { - interfaceRegistry := types.NewInterfaceRegistry() - ecocredit.RegisterTypes(interfaceRegistry) - var moduleSchema = ormdb.ModuleSchema{ - FileDescriptors: map[uint32]protoreflect.FileDescriptor{ - 1: ecocreditv1beta1.File_regen_ecocredit_v1beta1_state_proto, - }, - } - backend := ormtest.NewMemoryBackend() - modDB, err := ormdb.NewModuleDB(moduleSchema, ormdb.ModuleDBOptions{ - TypeResolver: nil, - FileResolver: nil, - JSONValidator: nil, - GetBackend: func(ctx context.Context) (ormtable.Backend, error) { - return backend, nil - }, - GetReadBackend: func(ctx context.Context) (ormtable.ReadBackend, error) { - return backend, nil - }, - }) - require.NoError(t, err) - return modDB -} - -func TestTradableSupplyInvariants(t *testing.T) { - acc1 := sdk.AccAddress([]byte("account1")) - acc2 := sdk.AccAddress([]byte("account2")) - - testCases := []struct { - msg string - balances []*ecocredit.Balance - supply []*ecocredit.Supply - expBroken bool - }{ - { - "valid test case", - []*ecocredit.Balance{ - { - Address: acc1.String(), - BatchDenom: "1/2", - TradableBalance: "100", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - TradableBalance: "210", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - RetiredBalance: "210", - }, - }, - []*ecocredit.Supply{ - { - BatchDenom: "1/2", - TradableSupply: "310", - RetiredSupply: "210", - }, - }, - false, - }, - { - "valid test case multiple denom", - []*ecocredit.Balance{ - { - Address: acc1.String(), - BatchDenom: "1/2", - TradableBalance: "100.123", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - TradableBalance: "210.456", - }, - { - Address: acc2.String(), - BatchDenom: "3/4", - TradableBalance: "210.456", - }, - }, - []*ecocredit.Supply{ - { - BatchDenom: "1/2", - TradableSupply: "310.579", - RetiredSupply: "0", - }, - { - BatchDenom: "3/4", - TradableSupply: "210.456", - RetiredSupply: "0", - }, - }, - false, - }, - { - "fail with error tradable balance not found", - []*ecocredit.Balance{ - { - Address: acc1.String(), - BatchDenom: "1/2", - TradableBalance: "100.123", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - TradableBalance: "210.456", - }, - }, - []*ecocredit.Supply{ - { - BatchDenom: "1/2", - TradableSupply: "310.579", - RetiredSupply: "0", - }, - { - BatchDenom: "3/4", - TradableSupply: "1234", - RetiredSupply: "0", - }, - }, - true, - }, - { - "fail with error supply does not match", - []*ecocredit.Balance{ - { - Address: acc1.String(), - BatchDenom: "1/2", - TradableBalance: "100.123", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - TradableBalance: "210.456", - }, - { - BatchDenom: "3/4", - Address: acc2.String(), - TradableBalance: "1234", - }, - }, - []*ecocredit.Supply{ - { - BatchDenom: "1/2", - TradableSupply: "310.57", - RetiredSupply: "0", - }, - { - BatchDenom: "3/4", - TradableSupply: "1234", - RetiredSupply: "0", - }, - }, - true, - }, - } - - db := setupStore(t) - - ctx := sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger()) - supplyStore, err := ecocreditv1beta1.NewBatchSupplyStore(db) - require.NoError(t, err) - balanceStore, err := ecocreditv1beta1.NewBatchBalanceStore(db) - require.NoError(t, err) - batchInfoStore, err := ecocreditv1beta1.NewBatchInfoStore(db) - require.NoError(t, err) - - initBatchDenom(t, ctx.Context(), batchInfoStore, testCases) - - for _, tc := range testCases { - tc := tc - - t.Run(tc.msg, func(t *testing.T) { - - initBalances(t, ctx, balanceStore, batchInfoStore, tc.balances) - initSupply(t, ctx, supplyStore, batchInfoStore, tc.supply) - - msg, broken := tradableSupplyInvariant(supplyStore, balanceStore, batchInfoStore, ctx) - if tc.expBroken { - require.True(t, broken, msg) - } else { - require.False(t, broken, msg) - } - }) - } -} - -func initBatchDenom(t *testing.T, ctx context.Context, store ecocreditv1beta1.BatchInfoStore, testCases []struct { - msg string - balances []*ecocredit.Balance - supply []*ecocredit.Supply - expBroken bool -}) { - for _, tc := range testCases { - for _, b := range tc.balances { - has, err := store.HasByBatchDenom(ctx, b.BatchDenom) - require.NoError(t, err) - if !has { - err := store.Insert(ctx, &ecocreditv1beta1.BatchInfo{ - ProjectId: 0, - BatchDenom: b.BatchDenom, - Metadata: nil, - StartDate: timestamppb.Now(), - EndDate: timestamppb.Now(), - }) - require.NoError(t, err) - } - } - for _, s := range tc.supply { - has, err := store.HasByBatchDenom(ctx, s.BatchDenom) - require.NoError(t, err) - if !has { - err := store.Insert(ctx, &ecocreditv1beta1.BatchInfo{ - ProjectId: 0, - BatchDenom: s.BatchDenom, - Metadata: nil, - StartDate: timestamppb.Now(), - EndDate: timestamppb.Now(), - }) - require.NoError(t, err) - } - } - } -} - -func TestRetiredSupplyInvariants(t *testing.T) { - acc1 := sdk.AccAddress([]byte("account1")) - acc2 := sdk.AccAddress([]byte("account2")) - - testCases := []struct { - msg string - balances []*ecocredit.Balance - supply []*ecocredit.Supply - expBroken bool - }{ - { - "valid test case", - []*ecocredit.Balance{ - { - Address: acc1.String(), - BatchDenom: "1/2", - RetiredBalance: "100", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - RetiredBalance: "210", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - TradableBalance: "210", - }, - }, - []*ecocredit.Supply{ - { - BatchDenom: "1/2", - RetiredSupply: "310", - TradableSupply: "210", - }, - }, - false, - }, - { - "valid test case multiple denom", - []*ecocredit.Balance{ - { - Address: acc1.String(), - BatchDenom: "1/2", - RetiredBalance: "100.123", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - RetiredBalance: "210.456", - }, - { - Address: acc2.String(), - BatchDenom: "3/4", - RetiredBalance: "210.456", - }, - }, - []*ecocredit.Supply{ - { - BatchDenom: "1/2", - RetiredSupply: "310.579", - TradableSupply: "0", - }, - { - BatchDenom: "3/4", - RetiredSupply: "210.456", - TradableSupply: "0", - }, - }, - false, - }, - { - "fail with error retired balance not found", - []*ecocredit.Balance{ - { - Address: acc1.String(), - BatchDenom: "1/2", - RetiredBalance: "100.123", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - RetiredBalance: "210.456", - }, - }, - []*ecocredit.Supply{ - { - BatchDenom: "1/2", - RetiredSupply: "310.579", - TradableSupply: "0", - }, - { - BatchDenom: "3/4", - RetiredSupply: "1234", - TradableSupply: "0", - }, - }, - true, - }, - { - "fail with error retired supply does not match", - []*ecocredit.Balance{ - { - Address: acc1.String(), - BatchDenom: "1/2", - RetiredBalance: "100.123", - }, - { - Address: acc2.String(), - BatchDenom: "1/2", - RetiredBalance: "210.456", - }, - { - BatchDenom: "3/4", - Address: acc2.String(), - RetiredBalance: "1234", - }, - }, - []*ecocredit.Supply{ - { - BatchDenom: "1/2", - RetiredSupply: "310.57", - TradableSupply: "0", - }, - { - BatchDenom: "3/4", - RetiredSupply: "1234", - TradableSupply: "0", - }, - }, - true, - }, - } - ctx := sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger()) - db := setupStore(t) - supplyStore, err := ecocreditv1beta1.NewBatchSupplyStore(db) - require.NoError(t, err) - balanceStore, err := ecocreditv1beta1.NewBatchBalanceStore(db) - require.NoError(t, err) - batchInfoStore, err := ecocreditv1beta1.NewBatchInfoStore(db) - require.NoError(t, err) - initBatchDenom(t, ctx.Context(), batchInfoStore, testCases) - for _, tc := range testCases { - tc := tc - t.Run(tc.msg, func(t *testing.T) { - initBalances(t, ctx, balanceStore, batchInfoStore, tc.balances) - initSupply(t, ctx, supplyStore, batchInfoStore, tc.supply) - msg, broken := retiredSupplyInvariant(supplyStore, balanceStore, batchInfoStore, ctx) - if tc.expBroken { - require.True(t, broken, msg) - } else { - require.False(t, broken, msg) - } - }) - } -} - -func initBalances(t *testing.T, ctx sdk.Context, store ecocreditv1beta1.BatchBalanceStore, batchInfoStore ecocreditv1beta1.BatchInfoStore, balances []*ecocredit.Balance) { - for _, b := range balances { - addr, err := sdk.AccAddressFromBech32(b.Address) - require.NoError(t, err) - info, err := batchInfoStore.GetByBatchDenom(ctx.Context(), b.BatchDenom) - require.NoError(t, err) - id := info.Id - if b.TradableBalance == "" { - b.TradableBalance = "0" - } - if b.RetiredBalance == "" { - b.RetiredBalance = "0" - } - - trad, err := math.NewNonNegativeDecFromString(b.TradableBalance) - require.NoError(t, err) - ret, err := math.NewNonNegativeDecFromString(b.RetiredBalance) - require.NoError(t, err) - - bal, err := store.Get(ctx.Context(), addr, id) - if err == nil && bal != nil { - balTrad, err := math.NewNonNegativeDecFromString(bal.Tradable) - require.NoError(t, err) - balRet, err := math.NewNonNegativeDecFromString(bal.Retired) - require.NoError(t, err) - trad, err = balTrad.Add(trad) - require.NoError(t, err) - ret, err = balRet.Add(ret) - require.NoError(t, err) - err = store.Update(ctx.Context(), &ecocreditv1beta1.BatchBalance{ - Address: addr, - BatchId: id, - Tradable: trad.String(), - Retired: ret.String(), - }) - require.NoError(t, err) - } else { - err = store.Insert(ctx.Context(), &ecocreditv1beta1.BatchBalance{ - Address: addr, - BatchId: id, - Tradable: trad.String(), - Retired: ret.String(), - }) - require.NoError(t, err) - } - } -} - -func initSupply(t *testing.T, ctx sdk.Context, store ecocreditv1beta1.BatchSupplyStore, batchStore ecocreditv1beta1.BatchInfoStore, supply []*ecocredit.Supply) { - for _, s := range supply { - info, err := batchStore.GetByBatchDenom(ctx.Context(), s.BatchDenom) - require.NoError(t, err) - id := info.Id - trad, err := math.NewNonNegativeDecFromString(s.TradableSupply) - require.NoError(t, err) - ret, err := math.NewNonNegativeDecFromString(s.RetiredSupply) - require.NoError(t, err) - sup, err := store.Get(ctx.Context(), id) - if err == nil && sup != nil { - supplyTradable, err := math.NewNonNegativeDecFromString(sup.TradableAmount) - require.NoError(t, err) - supplyRetired, err := math.NewNonNegativeDecFromString(sup.RetiredAmount) - require.NoError(t, err) - trad, err = supplyTradable.Add(trad) - require.NoError(t, err) - ret, err = supplyRetired.Add(ret) - require.NoError(t, err) - err = store.Update(ctx.Context(), &ecocreditv1beta1.BatchSupply{ - BatchId: sup.BatchId, - TradableAmount: trad.String(), - RetiredAmount: ret.String(), - CancelledAmount: "", - }) - require.NoError(t, err) - } else { - err = store.Insert(ctx.Context(), &ecocreditv1beta1.BatchSupply{ - BatchId: id, - TradableAmount: trad.String(), - RetiredAmount: ret.String(), - CancelledAmount: "", - }) - require.NoError(t, err) - } - } -} diff --git a/x/ecocredit/server/core/keeper.go b/x/ecocredit/server/core/keeper.go index ab7c170bfc..31e9eef0f9 100644 --- a/x/ecocredit/server/core/keeper.go +++ b/x/ecocredit/server/core/keeper.go @@ -1,8 +1,8 @@ package core import ( - "context" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/params/types" ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" "github.com/regen-network/regen-ledger/x/ecocredit" "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" @@ -14,32 +14,16 @@ type Keeper struct { params ParamKeeper } -func (k Keeper) Send(ctx context.Context, send *v1beta1.MsgSend) (*v1beta1.MsgSendResponse, error) { - panic("implement me") -} - -func (k Keeper) Retire(ctx context.Context, retire *v1beta1.MsgRetire) (*v1beta1.MsgRetireResponse, error) { - panic("implement me") -} - -func (k Keeper) Cancel(ctx context.Context, cancel *v1beta1.MsgCancel) (*v1beta1.MsgCancelResponse, error) { - panic("implement me") -} - -func (k Keeper) UpdateClassAdmin(ctx context.Context, admin *v1beta1.MsgUpdateClassAdmin) (*v1beta1.MsgUpdateClassAdminResponse, error) { - panic("implement me") -} - -func (k Keeper) UpdateClassIssuers(ctx context.Context, issuers *v1beta1.MsgUpdateClassIssuers) (*v1beta1.MsgUpdateClassIssuersResponse, error) { - panic("implement me") -} - -func (k Keeper) UpdateClassMetadata(ctx context.Context, metadata *v1beta1.MsgUpdateClassMetadata) (*v1beta1.MsgUpdateClassMetadataResponse, error) { - panic("implement me") +type ParamKeeper interface { + GetParamSet(ctx sdk.Context, ps types.ParamSet) } -type ParamKeeper interface { - GetParamSet(ctx sdk.Context, params *ecocredit.Params) +func NewKeeper(ss ecocreditv1beta1.StateStore, bk ecocredit.BankKeeper, params ParamKeeper) Keeper { + return Keeper{ + stateStore: ss, + bankKeeper: bk, + params: params, + } } var _ v1beta1.MsgServer = &Keeper{} diff --git a/x/ecocredit/server/core/msg_server.go b/x/ecocredit/server/core/msg_server.go deleted file mode 100644 index 0859318141..0000000000 --- a/x/ecocredit/server/core/msg_server.go +++ /dev/null @@ -1,749 +0,0 @@ -package core - -import ( - "context" - "fmt" - "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" - "github.com/regen-network/regen-ledger/types" - "github.com/regen-network/regen-ledger/types/math" - "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" - "google.golang.org/protobuf/types/known/timestamppb" -) - -// TODO: Revisit this once we have proper gas fee framework. -// Tracking issues https://github.com/cosmos/cosmos-sdk/issues/9054, https://github.com/cosmos/cosmos-sdk/discussions/9072 -const gasCostPerIteration = uint64(10) - -// CreateClass creates a new class of ecocredit -// -// The admin is charged a fee for creating the class. This is controlled by -// the global parameter CreditClassFee, which can be updated through the -// governance process. -func (s serverImpl) CreateClass(ctx context.Context, req *v1beta1.MsgCreateClass) (*v1beta1.MsgCreateClassResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - // Charge the admin a fee to create the credit class - adminAddress, err := sdk.AccAddressFromBech32(req.Admin) - if err != nil { - return nil, err - } - - // TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 - var params ecocredit.Params - s.paramSpace.GetParamSet(sdkCtx, ¶ms) - if params.AllowlistEnabled && !s.isCreatorAllowListed(sdkCtx, params.AllowedClassCreators, adminAddress) { - return nil, sdkerrors.ErrUnauthorized.Wrapf("%s is not allowed to create credit classes", adminAddress.String()) - } - - err = s.chargeCreditClassFee(sdkCtx, adminAddress) - if err != nil { - return nil, err - } - - creditType, err := s.getCreditType(ctx, req.CreditTypeName) - if err != nil { - return nil, err - } - - classSeq, err := s.getClassSequenceNo(ctx, req.CreditTypeName) - if err != nil { - return nil, fmt.Errorf("error getting class sequence") - } - classID := ecocredit.FormatClassID(creditType.Abbreviation, classSeq) - - rowId, err := s.stateStore.ClassInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ - Name: classID, - Admin: adminAddress, - Metadata: req.Metadata, - CreditType: req.CreditTypeName, - }) - if err != nil { - return nil, err - } - - for _, issuer := range req.Issuers { - issuer, _ := sdk.AccAddressFromBech32(issuer) - if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ - ClassId: rowId, - Issuer: issuer, - }); err != nil { - return nil, err - } - } - - err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateClass{ - ClassId: classID, - Admin: req.Admin, - }) - if err != nil { - return nil, err - } - - return &v1beta1.MsgCreateClassResponse{ClassId: classID}, nil -} - -// CreateProject creates a new project. -func (s serverImpl) CreateProject(ctx context.Context, req *v1beta1.MsgCreateProject) (*v1beta1.MsgCreateProjectResponse, error) { - sdkCtx := types.UnwrapSDKContext(ctx) - classID := req.ClassId - classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, classID) - if err != nil { - return nil, err - } - - err = s.assertClassIssuer(ctx, classInfo.Id, req.Issuer) - if err != nil { - return nil, err - } - - projectID := req.ProjectId - if projectID == "" { - found := false - for !found { - projectID, err = s.genProjectID(ctx, classInfo.Id, classInfo.Name) - if err != nil { - return nil, err - } - found, err = s.stateStore.ProjectInfoStore().HasByName(ctx, projectID) - if err != nil { - return nil, err - } - sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "project id sequence") - } - } - - if err = s.stateStore.ProjectInfoStore().Insert(ctx, &ecocreditv1beta1.ProjectInfo{ - Name: projectID, - ClassId: classInfo.Id, - ProjectLocation: req.ProjectLocation, - Metadata: req.Metadata, - }); err != nil { - return nil, err - } - - if err := sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCreateProject{ - ClassId: classID, - ProjectId: projectID, - Issuer: req.Issuer, - ProjectLocation: req.ProjectLocation, - }); err != nil { - return nil, err - } - - return &v1beta1.MsgCreateProjectResponse{ - ProjectId: projectID, - }, nil -} - -// CreateBatch creates a new batch of credits. -// Credits in the batch must not have more decimal places than the credit type's specified precision. -func (s serverImpl) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch) (*v1beta1.MsgCreateBatchResponse, error) { - sdkCtx := sdk.UnwrapSDKContext(ctx) - projectID := req.ProjectId - - projectInfo, err := s.stateStore.ProjectInfoStore().GetByName(ctx, projectID) - if err != nil { - return nil, err - } - - classInfo, err := s.stateStore.ClassInfoStore().Get(ctx, projectInfo.ClassId) - if err != nil { - return nil, err - } - - err = s.assertClassIssuer(ctx, classInfo.Id, req.Issuer) - if err != nil { - return nil, err - } - - creditType, err := s.getCreditType(ctx, classInfo.CreditType) - if err != nil { - return nil, err - } - - maxDecimalPlaces := creditType.Precision - - batchSeqNo, err := s.getBatchSeqNo(ctx, projectID) - if err != nil { - return nil, err - } - - batchDenom, err := ecocredit.FormatDenom(classInfo.Name, batchSeqNo, req.StartDate, req.EndDate) - if err != nil { - return nil, err - } - - rowID, err := s.stateStore.BatchInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.BatchInfo{ - ProjectId: projectInfo.Id, - BatchDenom: batchDenom, - Metadata: req.Metadata, - StartDate: timestamppb.New(req.StartDate.UTC()), - EndDate: timestamppb.New(req.EndDate.UTC()), - }) - if err != nil { - return nil, err - } - - tradableSupply, retiredSupply := math.NewDecFromInt64(0), math.NewDecFromInt64(0) - - for _, issuance := range req.Issuance { - decs, err := getNonNegativeFixedDecs(maxDecimalPlaces, issuance.TradableAmount, issuance.RetiredAmount) - if err != nil { - return nil, err - } - tradable, retired := decs[0], decs[1] - - recipient, _ := sdk.AccAddressFromBech32(issuance.Recipient) - if !tradable.IsZero() { - tradableSupply, err = tradableSupply.Add(tradable) - if err != nil { - return nil, err - } - } - if !retired.IsZero() { - retiredSupply, err = retiredSupply.Add(retired) - if err != nil { - return nil, err - } - if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventRetire{ - Retirer: recipient.String(), - BatchDenom: batchDenom, - Amount: retired.String(), - Location: issuance.RetirementLocation, - }); err != nil { - return nil, err - } - } - if err = s.stateStore.BatchBalanceStore().Insert(ctx, &ecocreditv1beta1.BatchBalance{ - Address: recipient, - BatchId: rowID, - Tradable: tradable.String(), - Retired: retired.String(), - }); err != nil { - return nil, err - } - - if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventReceive{ - Recipient: recipient.String(), - BatchDenom: batchDenom, - RetiredAmount: tradable.String(), - TradableAmount: retired.String(), - }); err != nil { - return nil, err - } - - sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "batch issuance") - } - - if err = s.stateStore.BatchSupplyStore().Insert(ctx, &ecocreditv1beta1.BatchSupply{ - BatchId: rowID, - TradableAmount: tradableSupply.String(), - RetiredAmount: retiredSupply.String(), - CancelledAmount: math.NewDecFromInt64(0).String(), - }); err != nil { - return nil, err - } - - return &v1beta1.MsgCreateBatchResponse{BatchDenom: batchDenom}, nil -} - -// Send sends credits to a recipient. -// Send also retires credits if the amount to retire is specified in the request. -func (s serverImpl) Send(ctx context.Context, req *v1beta1.MsgSend) (*v1beta1.MsgSendResponse, error) { - sdkCtx := types.UnwrapSDKContext(ctx) - sender, _ := sdk.AccAddressFromBech32(req.Sender) - recipient, _ := sdk.AccAddressFromBech32(req.Recipient) - - for _, credit := range req.Credits { - err := s.sendEcocredits(ctx, credit, recipient, sender) - if err != nil { - return nil, err - } - if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventReceive{ - Sender: req.Sender, - Recipient: req.Recipient, - BatchDenom: credit.BatchDenom, - TradableAmount: credit.TradableAmount, - RetiredAmount: credit.RetiredAmount, - }); err != nil { - return nil, err - } - sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "send ecocredits") - } - return &v1beta1.MsgSendResponse{}, nil -} - -// Retire credits to the specified location. -// WARNING: retiring credits is permanent. Retired credits cannot be un-retired. -func (s serverImpl) Retire(ctx context.Context, req *v1beta1.MsgRetire) (*v1beta1.MsgRetireResponse, error) { - sdkCtx := types.UnwrapSDKContext(ctx) - holder, _ := sdk.AccAddressFromBech32(req.Holder) - - for _, credit := range req.Credits { - batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) - if err != nil { - return nil, err - } - creditType, err := s.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) - if err != nil { - return nil, err - } - userBalance, err := s.stateStore.BatchBalanceStore().Get(ctx, holder, batch.Id) - if err != nil { - return nil, err - } - - decs, err := getNonNegativeFixedDecs(creditType.Precision, credit.Amount, userBalance.Tradable) - if err != nil { - return nil, err - } - amtToRetire, userTradableBalance := decs[0], decs[1] - - userTradableBalance, err = userTradableBalance.Sub(amtToRetire) - if err != nil { - return nil, err - } - if userTradableBalance.IsNegative() { - return nil, ecocredit.ErrInsufficientFunds.Wrapf("cannot retire %s credits with a balance of %s", credit.Amount, userBalance.Tradable) - } - userRetiredBalance, err := math.NewNonNegativeFixedDecFromString(userBalance.Retired, creditType.Precision) - if err != nil { - return nil, err - } - userRetiredBalance, err = userRetiredBalance.Add(amtToRetire) - if err != nil { - return nil, err - } - batchSupply, err := s.stateStore.BatchSupplyStore().Get(ctx, batch.Id) - if err != nil { - return nil, err - } - decs, err = getNonNegativeFixedDecs(creditType.Precision, batchSupply.RetiredAmount, batchSupply.TradableAmount) - if err != nil { - return nil, err - } - supplyRetired, supplyTradable := decs[0], decs[1] - supplyRetired, err = supplyRetired.Add(amtToRetire) - if err != nil { - return nil, err - } - supplyTradable, err = supplyTradable.Sub(amtToRetire) - if err != nil { - return nil, err - } - - if err = s.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ - Address: holder, - BatchId: batch.Id, - Tradable: userTradableBalance.String(), - Retired: userRetiredBalance.String(), - }); err != nil { - return nil, err - } - err = s.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ - BatchId: batch.Id, - TradableAmount: supplyTradable.String(), - RetiredAmount: supplyRetired.String(), - CancelledAmount: batchSupply.CancelledAmount, - }) - if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventRetire{ - Retirer: req.Holder, - BatchDenom: credit.BatchDenom, - Amount: credit.Amount, - Location: req.Location, - }); err != nil { - return nil, err - } - sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "retire ecocredits") - } - return &v1beta1.MsgRetireResponse{}, nil -} - -// Cancel credits, removing them from the supply and balance of the holder -func (s serverImpl) Cancel(ctx context.Context, req *v1beta1.MsgCancel) (*v1beta1.MsgCancelResponse, error) { - sdkCtx := types.UnwrapSDKContext(ctx) - holder, _ := sdk.AccAddressFromBech32(req.Holder) - - for _, credit := range req.Credits { - batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) - if err != nil { - return nil, err - - } - creditType, err := s.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) - if err != nil { - return nil, err - } - precision := creditType.Precision - - userBalance, err := s.stateStore.BatchBalanceStore().Get(ctx, holder, batch.Id) - if err != nil { - return nil, err - } - batchSupply, err := s.stateStore.BatchSupplyStore().Get(ctx, batch.Id) - if err != nil { - return nil, err - } - decs, err := getNonNegativeFixedDecs(precision, credit.Amount, batchSupply.TradableAmount, userBalance.Tradable, batchSupply.CancelledAmount) - if err != nil { - return nil, err - } - amtToCancelDec, supplyTradable, userBalTradable, cancelledDec := decs[0], decs[1], decs[2], decs[3] - userBalTradable, err = math.SafeSubBalance(userBalTradable, amtToCancelDec) - if err != nil { - return nil, err - } - supplyTradable, err = math.SafeSubBalance(supplyTradable, amtToCancelDec) - if err != nil { - return nil, err - } - cancelledDec, err = cancelledDec.Add(amtToCancelDec) - if err != nil { - return nil, err - } - if err = s.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ - Address: holder, - BatchId: batch.Id, - Tradable: userBalTradable.String(), - Retired: userBalance.Retired, - }); err != nil { - return nil, err - } - if err = s.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ - BatchId: batch.Id, - TradableAmount: supplyTradable.String(), - RetiredAmount: batchSupply.RetiredAmount, - CancelledAmount: cancelledDec.String(), - }); err != nil { - return nil, err - } - if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventCancel{ - Canceller: holder.String(), - BatchDenom: credit.BatchDenom, - Amount: credit.Amount, - }); err != nil { - return nil, err - } - sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "cancel ecocredits") - } - return &v1beta1.MsgCancelResponse{}, nil -} - -func (s serverImpl) UpdateClassAdmin(ctx context.Context, req *v1beta1.MsgUpdateClassAdmin) (*v1beta1.MsgUpdateClassAdminResponse, error) { - classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) - if err != nil { - return nil, err - } - reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) - classAdmin := sdk.AccAddress(classInfo.Admin) - if !classAdmin.Equals(reqAddr) { - return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) - } - classInfo.Admin = reqAddr - if err = s.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { - return nil, err - } - return &v1beta1.MsgUpdateClassAdminResponse{}, err -} - -func (s serverImpl) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpdateClassIssuers) (*v1beta1.MsgUpdateClassIssuersResponse, error) { - class, err := s.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) - if err != nil { - return nil, err - } - reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) - admin := sdk.AccAddress(class.Admin) - if !reqAddr.Equals(admin) { - return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", class.Admin, req.Admin) - } - - for _, issuer := range req.RemoveIssuers { - if err = s.stateStore.ClassIssuerStore().Delete(ctx, &ecocreditv1beta1.ClassIssuer{ - ClassId: class.Id, - Issuer: issuer, - }); err != nil { - return nil, err - } - } - - // add the new issuers - for _, issuer := range req.AddIssuers { - if err = s.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ - ClassId: class.Id, - Issuer: issuer, - }); err != nil { - return nil, err - } - } - return &v1beta1.MsgUpdateClassIssuersResponse{}, nil -} - -func (s serverImpl) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpdateClassMetadata) (*v1beta1.MsgUpdateClassMetadataResponse, error) { - classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) - if err != nil { - return nil, err - } - reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) - admin := sdk.AccAddress(classInfo.Admin) - if !reqAddr.Equals(admin) { - return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) - } - classInfo.Metadata = req.Metadata - if err = s.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { - return nil, err - } - return &v1beta1.MsgUpdateClassMetadataResponse{}, err -} - -// ------- UTILITIES ------ - -// Checks if the given address is in the allowlist of credit class creators -func (s serverImpl) isCreatorAllowListed(ctx sdk.Context, allowlist []string, designer sdk.Address) bool { - for _, addr := range allowlist { - ctx.GasMeter().ConsumeGas(gasCostPerIteration, "credit class creators allowlist") - allowListedAddr, _ := sdk.AccAddressFromBech32(addr) - if designer.Equals(allowListedAddr) { - return true - } - } - return false -} - -// TODO: Given the following state -// project FOO. Sequence of FOO = 10. Inc it to 11 -> FOO11 -// Project FOO1. Sequence of FOO1 = 0 (doesnt exist yet). Inc it to 1 -> FOO11 -// Solution: escape the sequence? FOO1-1. FOO-11? -func (s serverImpl) genProjectID(ctx context.Context, classRowID uint64, classID string) (string, error) { - var nextID uint64 - projectSeqNo, err := s.stateStore.ProjectSequenceStore().Get(ctx, classRowID) - switch err { - case ormerrors.NotFound: - nextID = 1 - case nil: - nextID = projectSeqNo.NextProjectId - default: - return "", err - } - - if err = s.stateStore.ProjectSequenceStore().Save(ctx, &ecocreditv1beta1.ProjectSequence{ - ClassId: classRowID, - NextProjectId: nextID + 1, - }); err != nil { - return "", err - } - - return ecocredit.FormatProjectID(classID, nextID), nil -} - -func (s serverImpl) getBatchSeqNo(ctx context.Context, projectID string) (uint64, error) { - var seq uint64 - batchSeq, err := s.stateStore.BatchSequenceStore().Get(ctx, projectID) - - switch err { - case ormerrors.NotFound: - seq = 1 - case nil: - seq = batchSeq.NextBatchId - default: - return 0, err - } - if err = s.stateStore.BatchSequenceStore().Save(ctx, &ecocreditv1beta1.BatchSequence{ - ProjectId: projectID, - NextBatchId: seq + 1, - }); err != nil { - return 0, err - } - - return seq, err -} - -func (s serverImpl) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_SendCredits, to, from sdk.AccAddress) error { - batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) - if err != nil { - return err - } - creditType, err := s.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) - if err != nil { - return err - } - precision := creditType.Precision - - batchSupply, err := s.stateStore.BatchSupplyStore().Get(ctx, batch.Id) - if err != nil { - return err - } - fromBalance, err := s.stateStore.BatchBalanceStore().Get(ctx, from, batch.Id) - if err != nil { - if err == ormerrors.NotFound { - return ecocredit.ErrInsufficientFunds.Wrapf("you do not have any credits from batch %s", batch.BatchDenom) - } - return err - } - - toBalance, err := s.stateStore.BatchBalanceStore().Get(ctx, to, batch.Id) - if err != nil { - if err == ormerrors.NotFound { - toBalance = &ecocreditv1beta1.BatchBalance{ - Address: to, - BatchId: batch.Id, - Tradable: "0", - Retired: "0", - } - } else { - return err - } - } - decs, err := getNonNegativeFixedDecs(precision, toBalance.Tradable, toBalance.Retired, fromBalance.Tradable, fromBalance.Retired, credit.TradableAmount, credit.RetiredAmount, batchSupply.TradableAmount, batchSupply.RetiredAmount) - if err != nil { - return err - } - toTradableBalance, toRetiredBalance, - fromTradableBalance, fromRetiredBalance, - sendAmtTradable, sendAmtRetired, - batchSupplyTradable, batchSupplyRetired := decs[0], decs[1], decs[2], decs[3], decs[4], decs[5], decs[6], decs[7] - - if !sendAmtTradable.IsZero() { - fromTradableBalance, err = math.SafeSubBalance(fromTradableBalance, sendAmtTradable) - if err != nil { - return err - } - toTradableBalance, err = toTradableBalance.Add(sendAmtTradable) - if err != nil { - return err - } - } - - didRetire := false - if !sendAmtRetired.IsZero() { - didRetire = true - fromTradableBalance, err = math.SafeSubBalance(fromTradableBalance, sendAmtRetired) - if err != nil { - return err - } - toRetiredBalance, err = toRetiredBalance.Add(sendAmtRetired) - if err != nil { - return err - } - batchSupplyRetired, err = batchSupplyRetired.Add(sendAmtRetired) - if err != nil { - return err - } - batchSupplyTradable, err = batchSupplyTradable.Sub(sendAmtRetired) - if err != nil { - return err - } - } - // update the "to" balance - if err := s.stateStore.BatchBalanceStore().Save(ctx, &ecocreditv1beta1.BatchBalance{ - Address: to, - BatchId: batch.Id, - Tradable: toTradableBalance.String(), - Retired: toRetiredBalance.String(), - }); err != nil { - return err - } - - // update the "from" balance - if err := s.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ - Address: from, - BatchId: batch.Id, - Tradable: fromTradableBalance.String(), - Retired: fromRetiredBalance.String(), - }); err != nil { - return err - } - // update the "retired" balance only if credits were retired - if didRetire { - if err := s.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ - BatchId: batch.Id, - TradableAmount: batchSupplyTradable.String(), - RetiredAmount: batchSupplyRetired.String(), - CancelledAmount: batchSupply.CancelledAmount, - }); err != nil { - return err - } - if err = sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&ecocredit.EventRetire{ - Retirer: to.String(), - BatchDenom: credit.BatchDenom, - Amount: sendAmtRetired.String(), - Location: credit.RetirementLocation, - }); err != nil { - return err - } - } - return nil -} - -func getNonNegativeFixedDecs(precision uint32, decimals ...string) ([]math.Dec, error) { - decs := make([]math.Dec, len(decimals)) - for i, decimal := range decimals { - dec, err := math.NewNonNegativeFixedDecFromString(decimal, precision) - if err != nil { - return nil, err - } - decs[i] = dec - } - return decs, nil -} - -func (s serverImpl) getCreditTypeFromBatchDenom(ctx context.Context, denom string) (*ecocreditv1beta1.CreditType, error) { - classId := ecocredit.GetClassIdFromBatchDenom(denom) - classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, classId) - if err != nil { - return nil, err - } - return s.getCreditType(ctx, classInfo.CreditType) -} - -func (s serverImpl) getClassSequenceNo(ctx context.Context, ctype string) (uint64, error) { - var seq uint64 - classSeq, err := s.stateStore.ClassSequenceStore().Get(ctx, ctype) - switch err { - case nil: - seq = classSeq.NextClassId - case ormerrors.NotFound: - seq = 1 - default: - return 0, err - } - err = s.stateStore.ClassSequenceStore().Save(ctx, &ecocreditv1beta1.ClassSequence{ - CreditType: ctype, - NextClassId: seq + 1, - }) - return seq, err -} - -func (s serverImpl) getCreditType(ctx context.Context, creditTypeName string) (*ecocreditv1beta1.CreditType, error) { - ct, err := s.stateStore.CreditTypeStore().GetByName(ctx, creditTypeName) - return ct, err -} - -// TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 -func (s serverImpl) getCreditClassFee(ctx sdk.Context) sdk.Coins { - var params ecocredit.Params - s.paramSpace.GetParamSet(ctx, ¶ms) - return params.CreditClassFee -} - -func (s serverImpl) chargeCreditClassFee(ctx sdk.Context, creatorAddr sdk.AccAddress) error { - creditClassFee := s.getCreditClassFee(ctx) - - // Move the fee to the ecocredit module's account - err := s.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, ecocredit.ModuleName, creditClassFee) - if err != nil { - return err - } - - // Burn the coins - // TODO: Update this implementation based on the discussion at - // https://github.com/regen-network/regen-ledger/issues/351 - err = s.bankKeeper.BurnCoins(ctx, ecocredit.ModuleName, creditClassFee) - if err != nil { - return err - } - - return nil -} diff --git a/x/ecocredit/server/core/operations.go b/x/ecocredit/server/core/operations.go deleted file mode 100644 index 826dd492c1..0000000000 --- a/x/ecocredit/server/core/operations.go +++ /dev/null @@ -1,20 +0,0 @@ -package core - -import ( - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// WeightedOperations returns all the ecocredit module operations with their respective weights. -// TODO: sim refactor PR https://github.com/regen-network/regen-ledger/issues/728 -func (s serverImpl) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - //key := s.storeKey.(servermodule.RootModuleKey) - //queryClient := ecocredit.NewQueryClient(key) - // - //return simulation.WeightedOperations( - // simState.AppParams, simState.Cdc, - // s.accountKeeper, s.bankKeeper, - // queryClient, - //) - return nil -} diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index c5606353b2..434ffd3308 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -16,7 +16,7 @@ import ( ) // Classes queries for all credit classes with pagination. -func (s serverImpl) Classes(ctx context.Context, request *v1beta1.QueryClassesRequest) (*v1beta1.QueryClassesResponse, error) { +func (k Keeper) Classes(ctx context.Context, request *v1beta1.QueryClassesRequest) (*v1beta1.QueryClassesResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -24,7 +24,7 @@ func (s serverImpl) Classes(ctx context.Context, request *v1beta1.QueryClassesRe request.Pagination = &query.PageRequest{} } p := request.Pagination - it, err := s.stateStore.ClassInfoStore().List(ctx, &ecocreditv1beta1.ClassInfoPrimaryKey{}, ormlist.Paginate(&queryv1beta1.PageRequest{ + it, err := k.stateStore.ClassInfoStore().List(ctx, &ecocreditv1beta1.ClassInfoPrimaryKey{}, ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, @@ -52,20 +52,20 @@ func (s serverImpl) Classes(ctx context.Context, request *v1beta1.QueryClassesRe } // ClassInfo queries for information on a credit class. -func (s serverImpl) ClassInfo(ctx context.Context, request *v1beta1.QueryClassInfoRequest) (*v1beta1.QueryClassInfoResponse, error) { +func (k Keeper) ClassInfo(ctx context.Context, request *v1beta1.QueryClassInfoRequest) (*v1beta1.QueryClassInfoResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } if err := ecocredit.ValidateClassID(request.ClassId); err != nil { return nil, err } - classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) + classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) if err != nil { return nil, err } issuers := make([]sdk.AccAddress, 0) - it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id)) + it, err := k.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id)) if err != nil { return nil, err } @@ -86,7 +86,7 @@ func (s serverImpl) ClassInfo(ctx context.Context, request *v1beta1.QueryClassIn }}, nil } -func (s serverImpl) ClassIssuers(ctx context.Context, request *v1beta1.QueryClassIssuersRequest) (*v1beta1.QueryClassIssuersResponse, error) { +func (k Keeper) ClassIssuers(ctx context.Context, request *v1beta1.QueryClassIssuersRequest) (*v1beta1.QueryClassIssuersResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -98,12 +98,12 @@ func (s serverImpl) ClassIssuers(ctx context.Context, request *v1beta1.QueryClas return nil, err } - classInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) + classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) if err != nil { return nil, err } - it, err := s.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ + it, err := k.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, @@ -135,7 +135,7 @@ func (s serverImpl) ClassIssuers(ctx context.Context, request *v1beta1.QueryClas } // Projects queries projects of a given credit batch. -func (s serverImpl) Projects(ctx context.Context, request *v1beta1.QueryProjectsRequest) (*v1beta1.QueryProjectsResponse, error) { +func (k Keeper) Projects(ctx context.Context, request *v1beta1.QueryProjectsRequest) (*v1beta1.QueryProjectsResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -143,11 +143,11 @@ func (s serverImpl) Projects(ctx context.Context, request *v1beta1.QueryProjects request.Pagination = &query.PageRequest{} } p := request.Pagination - cInfo, err := s.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) + cInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) if err != nil { return nil, err } - it, err := s.stateStore.ProjectInfoStore().List(ctx, ecocreditv1beta1.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ + it, err := k.stateStore.ProjectInfoStore().List(ctx, ecocreditv1beta1.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, @@ -163,7 +163,7 @@ func (s serverImpl) Projects(ctx context.Context, request *v1beta1.QueryProjects if err != nil { return nil, err } - classInfo, err := s.stateStore.ClassInfoStore().Get(ctx, info.ClassId) + classInfo, err := k.stateStore.ClassInfoStore().Get(ctx, info.ClassId) if err != nil { return nil, err } @@ -185,19 +185,19 @@ func (s serverImpl) Projects(ctx context.Context, request *v1beta1.QueryProjects }, nil } -func (s serverImpl) ProjectInfo(ctx context.Context, request *v1beta1.QueryProjectInfoRequest) (*v1beta1.QueryProjectInfoResponse, error) { +func (k Keeper) ProjectInfo(ctx context.Context, request *v1beta1.QueryProjectInfoRequest) (*v1beta1.QueryProjectInfoResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } if err := ecocredit.ValidateProjectID(request.ProjectId); err != nil { return nil, err } - pInfo, err := s.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) + pInfo, err := k.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) if err != nil { return nil, err } - cInfo, err := s.stateStore.ClassInfoStore().Get(ctx, pInfo.ClassId) + cInfo, err := k.stateStore.ClassInfoStore().Get(ctx, pInfo.ClassId) if err != nil { return nil, err } @@ -212,7 +212,7 @@ func (s serverImpl) ProjectInfo(ctx context.Context, request *v1beta1.QueryProje } // Batches queries for all batches in the given credit class. -func (s serverImpl) Batches(ctx context.Context, request *v1beta1.QueryBatchesRequest) (*v1beta1.QueryBatchesResponse, error) { +func (k Keeper) Batches(ctx context.Context, request *v1beta1.QueryBatchesRequest) (*v1beta1.QueryBatchesResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -220,11 +220,11 @@ func (s serverImpl) Batches(ctx context.Context, request *v1beta1.QueryBatchesRe request.Pagination = &query.PageRequest{} } p := request.Pagination - project, err := s.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) + project, err := k.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) if err != nil { return nil, err } - it, err := s.stateStore.BatchInfoStore().List(ctx, ecocreditv1beta1.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ + it, err := k.stateStore.BatchInfoStore().List(ctx, ecocreditv1beta1.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ Key: p.Key, Offset: p.Offset, Limit: p.Limit, @@ -236,7 +236,7 @@ func (s serverImpl) Batches(ctx context.Context, request *v1beta1.QueryBatchesRe } projectName := request.ProjectId - pinfo, err := s.stateStore.ProjectInfoStore().GetByName(ctx, projectName) + pinfo, err := k.stateStore.ProjectInfoStore().GetByName(ctx, projectName) if err != nil { return nil, err } @@ -275,7 +275,7 @@ func (s serverImpl) Batches(ctx context.Context, request *v1beta1.QueryBatchesRe } // BatchInfo queries for information on a credit batch. -func (s serverImpl) BatchInfo(ctx context.Context, request *v1beta1.QueryBatchInfoRequest) (*v1beta1.QueryBatchInfoResponse, error) { +func (k Keeper) BatchInfo(ctx context.Context, request *v1beta1.QueryBatchInfoRequest) (*v1beta1.QueryBatchInfoResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -283,12 +283,12 @@ func (s serverImpl) BatchInfo(ctx context.Context, request *v1beta1.QueryBatchIn return nil, err } - batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, request.BatchDenom) + batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, request.BatchDenom) if err != nil { return nil, err } - project, err := s.stateStore.ProjectInfoStore().Get(ctx, batch.ProjectId) + project, err := k.stateStore.ProjectInfoStore().Get(ctx, batch.ProjectId) if err != nil { return nil, err } @@ -315,14 +315,14 @@ func (s serverImpl) BatchInfo(ctx context.Context, request *v1beta1.QueryBatchIn // Balance queries the balance (both tradable and retired) of a given credit // batch for a given account. -func (s serverImpl) Balance(ctx context.Context, req *v1beta1.QueryBalanceRequest) (*v1beta1.QueryBalanceResponse, error) { +func (k Keeper) Balance(ctx context.Context, req *v1beta1.QueryBalanceRequest) (*v1beta1.QueryBalanceResponse, error) { if req == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } if err := ecocredit.ValidateDenom(req.BatchDenom); err != nil { return nil, err } - batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, req.BatchDenom) + batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, req.BatchDenom) if err != nil { return nil, err } @@ -331,7 +331,7 @@ func (s serverImpl) Balance(ctx context.Context, req *v1beta1.QueryBalanceReques } addr, _ := sdk.AccAddressFromBech32(req.Account) - balance, err := s.stateStore.BatchBalanceStore().Get(ctx, addr, batch.Id) + balance, err := k.stateStore.BatchBalanceStore().Get(ctx, addr, batch.Id) if err != nil { return nil, err } @@ -348,7 +348,7 @@ func (s serverImpl) Balance(ctx context.Context, req *v1beta1.QueryBalanceReques } // Supply queries the supply (tradable, retired, cancelled) of a given credit batch. -func (s serverImpl) Supply(ctx context.Context, request *v1beta1.QuerySupplyRequest) (*v1beta1.QuerySupplyResponse, error) { +func (k Keeper) Supply(ctx context.Context, request *v1beta1.QuerySupplyRequest) (*v1beta1.QuerySupplyResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } @@ -357,12 +357,12 @@ func (s serverImpl) Supply(ctx context.Context, request *v1beta1.QuerySupplyRequ return nil, err } - batch, err := s.stateStore.BatchInfoStore().GetByBatchDenom(ctx, request.BatchDenom) + batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, request.BatchDenom) if err != nil { return nil, err } - supply, err := s.stateStore.BatchSupplyStore().Get(ctx, batch.Id) + supply, err := k.stateStore.BatchSupplyStore().Get(ctx, batch.Id) if err != nil { return nil, err } @@ -375,9 +375,9 @@ func (s serverImpl) Supply(ctx context.Context, request *v1beta1.QuerySupplyRequ } // CreditTypes queries the list of allowed types that credit classes can have. -func (s serverImpl) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypesRequest) (*v1beta1.QueryCreditTypesResponse, error) { +func (k Keeper) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypesRequest) (*v1beta1.QueryCreditTypesResponse, error) { creditTypes := make([]*v1beta1.CreditType, 0) - it, err := s.stateStore.CreditTypeStore().List(ctx, ecocreditv1beta1.CreditTypePrimaryKey{}) + it, err := k.stateStore.CreditTypeStore().List(ctx, ecocreditv1beta1.CreditTypePrimaryKey{}) if err != nil { return nil, err } @@ -398,10 +398,10 @@ func (s serverImpl) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypes // Params queries the ecocredit module parameters. // TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 -func (s serverImpl) Params(ctx context.Context, _ *v1beta1.QueryParamsRequest) (*v1beta1.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, _ *v1beta1.QueryParamsRequest) (*v1beta1.QueryParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) var params ecocredit.Params - s.paramSpace.GetParamSet(sdkCtx, ¶ms) + k.params.GetParamSet(sdkCtx, ¶ms) v1beta1types := make([]*v1beta1.CreditType, len(params.CreditTypes)) for i, typ := range params.CreditTypes { v1beta1types[i] = &v1beta1.CreditType{ diff --git a/x/ecocredit/server/core/retire.go b/x/ecocredit/server/core/retire.go new file mode 100644 index 0000000000..879cb54343 --- /dev/null +++ b/x/ecocredit/server/core/retire.go @@ -0,0 +1,95 @@ +package core + +import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" +) + +func (k Keeper) Retire(ctx context.Context, req *v1beta1.MsgRetire) (*v1beta1.MsgRetireResponse, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + holder, _ := sdk.AccAddressFromBech32(req.Holder) + + for _, credit := range req.Credits { + batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) + if err != nil { + return nil, err + } + creditType, err := k.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) + if err != nil { + return nil, err + } + userBalance, err := k.stateStore.BatchBalanceStore().Get(ctx, holder, batch.Id) + if err != nil { + return nil, err + } + + decs, err := getNonNegativeFixedDecs(creditType.Precision, credit.Amount, userBalance.Tradable) + if err != nil { + return nil, err + } + amtToRetire, userTradableBalance := decs[0], decs[1] + + userTradableBalance, err = userTradableBalance.Sub(amtToRetire) + if err != nil { + return nil, err + } + if userTradableBalance.IsNegative() { + return nil, ecocredit.ErrInsufficientFunds.Wrapf("cannot retire %s credits with a balance of %s", credit.Amount, userBalance.Tradable) + } + userRetiredBalance, err := math.NewNonNegativeFixedDecFromString(userBalance.Retired, creditType.Precision) + if err != nil { + return nil, err + } + userRetiredBalance, err = userRetiredBalance.Add(amtToRetire) + if err != nil { + return nil, err + } + batchSupply, err := k.stateStore.BatchSupplyStore().Get(ctx, batch.Id) + if err != nil { + return nil, err + } + decs, err = getNonNegativeFixedDecs(creditType.Precision, batchSupply.RetiredAmount, batchSupply.TradableAmount) + if err != nil { + return nil, err + } + supplyRetired, supplyTradable := decs[0], decs[1] + supplyRetired, err = supplyRetired.Add(amtToRetire) + if err != nil { + return nil, err + } + supplyTradable, err = supplyTradable.Sub(amtToRetire) + if err != nil { + return nil, err + } + + if err = k.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ + Address: holder, + BatchId: batch.Id, + Tradable: userTradableBalance.String(), + Retired: userRetiredBalance.String(), + }); err != nil { + return nil, err + } + err = k.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: batch.Id, + TradableAmount: supplyTradable.String(), + RetiredAmount: supplyRetired.String(), + CancelledAmount: batchSupply.CancelledAmount, + }) + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventRetire{ + Retirer: req.Holder, + BatchDenom: credit.BatchDenom, + Amount: credit.Amount, + Location: req.Location, + }); err != nil { + return nil, err + } + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "retire ecocredits") + } + return &v1beta1.MsgRetireResponse{}, nil +} diff --git a/x/ecocredit/server/core/send.go b/x/ecocredit/server/core/send.go new file mode 100644 index 0000000000..8611fee6b0 --- /dev/null +++ b/x/ecocredit/server/core/send.go @@ -0,0 +1,163 @@ +package core + +import ( + "context" + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" + sdk "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/types" + "github.com/regen-network/regen-ledger/types/math" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" +) + +func (k Keeper) Send(ctx context.Context, req *v1beta1.MsgSend) (*v1beta1.MsgSendResponse, error) { + sdkCtx := types.UnwrapSDKContext(ctx) + sender, _ := sdk.AccAddressFromBech32(req.Sender) + recipient, _ := sdk.AccAddressFromBech32(req.Recipient) + + for _, credit := range req.Credits { + err := k.sendEcocredits(ctx, credit, recipient, sender) + if err != nil { + return nil, err + } + if err = sdkCtx.EventManager().EmitTypedEvent(&v1beta1.EventReceive{ + Sender: req.Sender, + Recipient: req.Recipient, + BatchDenom: credit.BatchDenom, + TradableAmount: credit.TradableAmount, + RetiredAmount: credit.RetiredAmount, + }); err != nil { + return nil, err + } + sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "send ecocredits") + } + return &v1beta1.MsgSendResponse{}, nil +} + +func (k Keeper) sendEcocredits(ctx context.Context, credit *v1beta1.MsgSend_SendCredits, to, from sdk.AccAddress) error { + batch, err := k.stateStore.BatchInfoStore().GetByBatchDenom(ctx, credit.BatchDenom) + if err != nil { + return err + } + creditType, err := k.getCreditTypeFromBatchDenom(ctx, batch.BatchDenom) + if err != nil { + return err + } + precision := creditType.Precision + + batchSupply, err := k.stateStore.BatchSupplyStore().Get(ctx, batch.Id) + if err != nil { + return err + } + fromBalance, err := k.stateStore.BatchBalanceStore().Get(ctx, from, batch.Id) + if err != nil { + if err == ormerrors.NotFound { + return ecocredit.ErrInsufficientFunds.Wrapf("you do not have any credits from batch %s", batch.BatchDenom) + } + return err + } + + toBalance, err := k.stateStore.BatchBalanceStore().Get(ctx, to, batch.Id) + if err != nil { + if err == ormerrors.NotFound { + toBalance = &ecocreditv1beta1.BatchBalance{ + Address: to, + BatchId: batch.Id, + Tradable: "0", + Retired: "0", + } + } else { + return err + } + } + decs, err := getNonNegativeFixedDecs(precision, toBalance.Tradable, toBalance.Retired, fromBalance.Tradable, fromBalance.Retired, credit.TradableAmount, credit.RetiredAmount, batchSupply.TradableAmount, batchSupply.RetiredAmount) + if err != nil { + return err + } + toTradableBalance, toRetiredBalance, + fromTradableBalance, fromRetiredBalance, + sendAmtTradable, sendAmtRetired, + batchSupplyTradable, batchSupplyRetired := decs[0], decs[1], decs[2], decs[3], decs[4], decs[5], decs[6], decs[7] + + if !sendAmtTradable.IsZero() { + fromTradableBalance, err = math.SafeSubBalance(fromTradableBalance, sendAmtTradable) + if err != nil { + return err + } + toTradableBalance, err = toTradableBalance.Add(sendAmtTradable) + if err != nil { + return err + } + } + + didRetire := false + if !sendAmtRetired.IsZero() { + didRetire = true + fromTradableBalance, err = math.SafeSubBalance(fromTradableBalance, sendAmtRetired) + if err != nil { + return err + } + toRetiredBalance, err = toRetiredBalance.Add(sendAmtRetired) + if err != nil { + return err + } + batchSupplyRetired, err = batchSupplyRetired.Add(sendAmtRetired) + if err != nil { + return err + } + batchSupplyTradable, err = batchSupplyTradable.Sub(sendAmtRetired) + if err != nil { + return err + } + } + // update the "to" balance + if err := k.stateStore.BatchBalanceStore().Save(ctx, &ecocreditv1beta1.BatchBalance{ + Address: to, + BatchId: batch.Id, + Tradable: toTradableBalance.String(), + Retired: toRetiredBalance.String(), + }); err != nil { + return err + } + + // update the "from" balance + if err := k.stateStore.BatchBalanceStore().Update(ctx, &ecocreditv1beta1.BatchBalance{ + Address: from, + BatchId: batch.Id, + Tradable: fromTradableBalance.String(), + Retired: fromRetiredBalance.String(), + }); err != nil { + return err + } + // update the "retired" balance only if credits were retired + if didRetire { + if err := k.stateStore.BatchSupplyStore().Update(ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: batch.Id, + TradableAmount: batchSupplyTradable.String(), + RetiredAmount: batchSupplyRetired.String(), + CancelledAmount: batchSupply.CancelledAmount, + }); err != nil { + return err + } + if err = sdk.UnwrapSDKContext(ctx).EventManager().EmitTypedEvent(&ecocredit.EventRetire{ + Retirer: to.String(), + BatchDenom: credit.BatchDenom, + Amount: sendAmtRetired.String(), + Location: credit.RetirementLocation, + }); err != nil { + return err + } + } + return nil +} + +func (k Keeper) getCreditTypeFromBatchDenom(ctx context.Context, denom string) (ecocreditv1beta1.CreditType, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + classId := ecocredit.GetClassIdFromBatchDenom(denom) + classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, classId) + if err != nil { + return ecocreditv1beta1.CreditType{}, err + } + return k.getCreditType(sdkCtx, classInfo.CreditType) +} diff --git a/x/ecocredit/server/core/server.go b/x/ecocredit/server/core/server.go deleted file mode 100644 index 69af12e22e..0000000000 --- a/x/ecocredit/server/core/server.go +++ /dev/null @@ -1,67 +0,0 @@ -package core - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/orm/model/ormdb" - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" - "github.com/regen-network/regen-ledger/types/module/server" - "github.com/regen-network/regen-ledger/types/ormstore" - "github.com/regen-network/regen-ledger/x/ecocredit" - "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" - "google.golang.org/protobuf/reflect/protoreflect" -) - -type serverImpl struct { - storeKey sdk.StoreKey - - paramSpace paramtypes.Subspace - bankKeeper ecocredit.BankKeeper - accountKeeper ecocredit.AccountKeeper - - db ormdb.ModuleDB - - stateStore ecocreditv1beta1.StateStore -} - -func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, - accountKeeper ecocredit.AccountKeeper, bankKeeper ecocredit.BankKeeper, cdc codec.Codec) serverImpl { - - s := serverImpl{ - storeKey: storeKey, - paramSpace: paramSpace, - bankKeeper: bankKeeper, - accountKeeper: accountKeeper, - } - - ecocreditSchema := ormdb.ModuleSchema{ - FileDescriptors: map[uint32]protoreflect.FileDescriptor{1: ecocreditv1beta1.File_regen_ecocredit_v1beta1_state_proto}, - Prefix: nil, - } - - db, err := ormstore.NewStoreKeyDB(ecocreditSchema, storeKey, ormdb.ModuleDBOptions{}) - if err != nil { - panic(err) - } - s.db = db - - stateStore, err := ecocreditv1beta1.NewStateStore(db) - if err != nil { - panic(err) - } - s.stateStore = stateStore - - return s -} - -func RegisterServices(configurator server.Configurator, paramSpace paramtypes.Subspace, accountKeeper ecocredit.AccountKeeper, - bankKeeper ecocredit.BankKeeper) v1beta1.MsgServer { - impl := newServer(configurator.ModuleKey(), paramSpace, accountKeeper, bankKeeper, configurator.Marshaler()) - v1beta1.RegisterMsgServer(configurator.MsgServer(), impl) - v1beta1.RegisterQueryServer(configurator.QueryServer(), impl) - configurator.RegisterGenesisHandlers(impl.InitGenesis, impl.ExportGenesis) - configurator.RegisterWeightedOperationsHandler(impl.WeightedOperations) - configurator.RegisterInvariantsHandler(impl.RegisterInvariants) - return impl -} diff --git a/x/ecocredit/server/core/update_class.go b/x/ecocredit/server/core/update_class.go new file mode 100644 index 0000000000..2a6f1308e9 --- /dev/null +++ b/x/ecocredit/server/core/update_class.go @@ -0,0 +1,75 @@ +package core + +import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" +) + +func (k Keeper) UpdateClassAdmin(ctx context.Context, req *v1beta1.MsgUpdateClassAdmin) (*v1beta1.MsgUpdateClassAdminResponse, error) { + classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) + if err != nil { + return nil, err + } + reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) + classAdmin := sdk.AccAddress(classInfo.Admin) + if !classAdmin.Equals(reqAddr) { + return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) + } + classInfo.Admin = reqAddr + if err = k.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { + return nil, err + } + return &v1beta1.MsgUpdateClassAdminResponse{}, err +} + +func (k Keeper) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpdateClassIssuers) (*v1beta1.MsgUpdateClassIssuersResponse, error) { + class, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) + if err != nil { + return nil, err + } + reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) + admin := sdk.AccAddress(class.Admin) + if !reqAddr.Equals(admin) { + return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", class.Admin, req.Admin) + } + + for _, issuer := range req.RemoveIssuers { + if err = k.stateStore.ClassIssuerStore().Delete(ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: class.Id, + Issuer: issuer, + }); err != nil { + return nil, err + } + } + + // add the new issuers + for _, issuer := range req.AddIssuers { + if err = k.stateStore.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: class.Id, + Issuer: issuer, + }); err != nil { + return nil, err + } + } + return &v1beta1.MsgUpdateClassIssuersResponse{}, nil +} + +func (k Keeper) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpdateClassMetadata) (*v1beta1.MsgUpdateClassMetadataResponse, error) { + classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) + if err != nil { + return nil, err + } + reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) + admin := sdk.AccAddress(classInfo.Admin) + if !reqAddr.Equals(admin) { + return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) + } + classInfo.Metadata = req.Metadata + if err = k.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { + return nil, err + } + return &v1beta1.MsgUpdateClassMetadataResponse{}, err +} From 701dda0a7b55113a0b5c3827a4441ab768c2b199 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Wed, 16 Feb 2022 15:58:52 -0800 Subject: [PATCH 22/31] feat: impl, test --- Makefile | 8 + go.mod | 4 + go.sum | 6 + x/ecocredit/go.mod | 3 + x/ecocredit/mocks/expected_keepers.go | 206 +++++++++++++++++++ x/ecocredit/server/core/create_batch.go | 4 +- x/ecocredit/server/core/create_class.go | 25 +-- x/ecocredit/server/core/create_class_test.go | 101 +++++++++ x/ecocredit/server/core/create_project.go | 2 +- x/ecocredit/server/core/keeper_test.go | 73 +++++++ x/ecocredit/server/core/mocks/keeper.go | 48 +++++ x/ecocredit/server/core/send.go | 4 +- x/ecocredit/server/server.go | 9 + 13 files changed, 470 insertions(+), 23 deletions(-) create mode 100644 x/ecocredit/mocks/expected_keepers.go create mode 100644 x/ecocredit/server/core/create_class_test.go create mode 100644 x/ecocredit/server/core/keeper_test.go create mode 100644 x/ecocredit/server/core/mocks/keeper.go diff --git a/Makefile b/Makefile index b9f2fce684..1dbb8b23a1 100644 --- a/Makefile +++ b/Makefile @@ -416,3 +416,11 @@ localnet-stop: include sims.mk + +regen-mocks: + mkdir -p x/ecocredit/server/core/mocks + go install github.com/golang/mock/mockgen@latest + mockgen -source=x/ecocredit/server/core/keeper.go -package mocks -destination x/ecocredit/server/core/mocks/keeper.go + mockgen -source=x/ecocredit/expected_keepers.go -package mocks -destination x/ecocredit/mocks/expected_keepers.go +.PHONY: regen-mocks + diff --git a/go.mod b/go.mod index 4a5308f4e1..c464ee4b38 100644 --- a/go.mod +++ b/go.mod @@ -36,6 +36,9 @@ require ( github.com/coinbase/rosetta-sdk-go v0.6.10 // indirect github.com/confio/ics23/go v0.6.6 // indirect github.com/cosmos/cosmos-proto v1.0.0-alpha7 // indirect + github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 // indirect + github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/iavl v0.17.1 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect @@ -97,6 +100,7 @@ require ( github.com/prometheus/procfs v0.7.3 // indirect github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect + github.com/regen-network/regen-ledger/api v0.1.0-alpha.1 // indirect github.com/regen-network/regen-ledger/orm v0.0.0-00010101000000-000000000000 // indirect github.com/rs/cors v1.8.0 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect diff --git a/go.sum b/go.sum index 5f68029119..860aad5c27 100644 --- a/go.sum +++ b/go.sum @@ -238,8 +238,11 @@ github.com/cosmos/cosmos-proto v1.0.0-alpha6/go.mod h1:msdDWOvfStHLG+Z2y2SJ0dcqi github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3/go.mod h1:Ht15guGn9F8b0lv8NkjXE9/asAvVUOt2n4gvQ4q5MyU= +github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 h1:z2si9sQNUTj2jw+24SujuUxcoNS3TVga/fdYsS4rJII= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7 h1:pDxU4OFliJjQ22Tqf9kCfPZFtJla/yfGnV6EojVw+d8= github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7/go.mod h1:woV5EBAWmTaXKs7YXioQsYheXSZkmZIgLPq+Koi/GB8= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= @@ -987,6 +990,7 @@ github.com/regen-network/cosmos-sdk v0.44.2-regen-1 h1:Sm7rU4rMwLpEpgrQkF/4w/V/y github.com/regen-network/cosmos-sdk v0.44.2-regen-1/go.mod h1:fwQJdw+aECatpTvQTo1tSfHEsxACdZYU80QCZUPnHr4= github.com/regen-network/protobuf v1.3.2-alpha.regen.4 h1:c9jEnU+xm6vqyrQe3M94UFWqiXxRIKKnqBOh2EACmBE= github.com/regen-network/protobuf v1.3.2-alpha.regen.4/go.mod h1:/J8/bR1T/NXyIdQDLUaq15LjNE83nRzkyrLAMcPewig= +github.com/regen-network/regen-ledger/api v0.1.0-alpha.1 h1:6Sz8chLlP5yZVFQeXh5pfR457AIlyDB2ocDTxQRCk+0= github.com/regen-network/regen-ledger/api v0.1.0-alpha.1/go.mod h1:wN88p7fU2gFrI23sFcDwiOTrY0KVRnL0RkGolO4C3oY= github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= @@ -1758,7 +1762,9 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk= gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/x/ecocredit/go.mod b/x/ecocredit/go.mod index eeaccee40e..a745496481 100644 --- a/x/ecocredit/go.mod +++ b/x/ecocredit/go.mod @@ -7,6 +7,7 @@ require ( github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7 github.com/gogo/protobuf v1.3.3 + github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -21,6 +22,7 @@ require ( google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 + gotest.tools/v3 v3.1.0 pgregory.net/rapid v0.4.7 sigs.k8s.io/yaml v1.1.0 ) @@ -63,6 +65,7 @@ require ( github.com/gogo/gateway v1.1.0 // indirect github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 // indirect github.com/google/btree v1.0.0 // indirect + github.com/google/go-cmp v0.5.6 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.4.2 // indirect diff --git a/x/ecocredit/mocks/expected_keepers.go b/x/ecocredit/mocks/expected_keepers.go new file mode 100644 index 0000000000..182d2744d7 --- /dev/null +++ b/x/ecocredit/mocks/expected_keepers.go @@ -0,0 +1,206 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/ecocredit/expected_keepers.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + reflect "reflect" + + types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/auth/types" + gomock "github.com/golang/mock/gomock" +) + +// MockAccountKeeper is a mock of AccountKeeper interface. +type MockAccountKeeper struct { + ctrl *gomock.Controller + recorder *MockAccountKeeperMockRecorder +} + +// MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper. +type MockAccountKeeperMockRecorder struct { + mock *MockAccountKeeper +} + +// NewMockAccountKeeper creates a new mock instance. +func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper { + mock := &MockAccountKeeper{ctrl: ctrl} + mock.recorder = &MockAccountKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { + return m.recorder +} + +// GetAccount mocks base method. +func (m *MockAccountKeeper) GetAccount(arg0 types.Context, arg1 types.AccAddress) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAccount", arg0, arg1) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// GetAccount indicates an expected call of GetAccount. +func (mr *MockAccountKeeperMockRecorder) GetAccount(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).GetAccount), arg0, arg1) +} + +// GetModuleAddress mocks base method. +func (m *MockAccountKeeper) GetModuleAddress(moduleName string) types.AccAddress { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetModuleAddress", moduleName) + ret0, _ := ret[0].(types.AccAddress) + return ret0 +} + +// GetModuleAddress indicates an expected call of GetModuleAddress. +func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(moduleName interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModuleAddress", reflect.TypeOf((*MockAccountKeeper)(nil).GetModuleAddress), moduleName) +} + +// NewAccount mocks base method. +func (m *MockAccountKeeper) NewAccount(arg0 types.Context, arg1 types0.AccountI) types0.AccountI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewAccount", arg0, arg1) + ret0, _ := ret[0].(types0.AccountI) + return ret0 +} + +// NewAccount indicates an expected call of NewAccount. +func (mr *MockAccountKeeperMockRecorder) NewAccount(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewAccount", reflect.TypeOf((*MockAccountKeeper)(nil).NewAccount), arg0, arg1) +} + +// SetAccount mocks base method. +func (m *MockAccountKeeper) SetAccount(arg0 types.Context, arg1 types0.AccountI) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "SetAccount", arg0, arg1) +} + +// SetAccount indicates an expected call of SetAccount. +func (mr *MockAccountKeeperMockRecorder) SetAccount(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetAccount", reflect.TypeOf((*MockAccountKeeper)(nil).SetAccount), arg0, arg1) +} + +// MockBankKeeper is a mock of BankKeeper interface. +type MockBankKeeper struct { + ctrl *gomock.Controller + recorder *MockBankKeeperMockRecorder +} + +// MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper. +type MockBankKeeperMockRecorder struct { + mock *MockBankKeeper +} + +// NewMockBankKeeper creates a new mock instance. +func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper { + mock := &MockBankKeeper{ctrl: ctrl} + mock.recorder = &MockBankKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { + return m.recorder +} + +// BurnCoins mocks base method. +func (m *MockBankKeeper) BurnCoins(ctx types.Context, moduleName string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BurnCoins", ctx, moduleName, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// BurnCoins indicates an expected call of BurnCoins. +func (mr *MockBankKeeperMockRecorder) BurnCoins(ctx, moduleName, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BurnCoins", reflect.TypeOf((*MockBankKeeper)(nil).BurnCoins), ctx, moduleName, amt) +} + +// SendCoins mocks base method. +func (m *MockBankKeeper) SendCoins(ctx types.Context, fromAddr, toAddr types.AccAddress, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoins", ctx, fromAddr, toAddr, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoins indicates an expected call of SendCoins. +func (mr *MockBankKeeperMockRecorder) SendCoins(ctx, fromAddr, toAddr, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoins", reflect.TypeOf((*MockBankKeeper)(nil).SendCoins), ctx, fromAddr, toAddr, amt) +} + +// SendCoinsFromAccountToModule mocks base method. +func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromAccountToModule", ctx, senderAddr, recipientModule, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromAccountToModule", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromAccountToModule), ctx, senderAddr, recipientModule, amt) +} + +// SpendableCoins mocks base method. +func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) + ret0, _ := ret[0].(types.Coins) + return ret0 +} + +// SpendableCoins indicates an expected call of SpendableCoins. +func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) +} + +// MockKeeper is a mock of Keeper interface. +type MockKeeper struct { + ctrl *gomock.Controller + recorder *MockKeeperMockRecorder +} + +// MockKeeperMockRecorder is the mock recorder for MockKeeper. +type MockKeeperMockRecorder struct { + mock *MockKeeper +} + +// NewMockKeeper creates a new mock instance. +func NewMockKeeper(ctrl *gomock.Controller) *MockKeeper { + mock := &MockKeeper{ctrl: ctrl} + mock.recorder = &MockKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockKeeper) EXPECT() *MockKeeperMockRecorder { + return m.recorder +} + +// PruneOrders mocks base method. +func (m *MockKeeper) PruneOrders(ctx types.Context) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "PruneOrders", ctx) + ret0, _ := ret[0].(error) + return ret0 +} + +// PruneOrders indicates an expected call of PruneOrders. +func (mr *MockKeeperMockRecorder) PruneOrders(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PruneOrders", reflect.TypeOf((*MockKeeper)(nil).PruneOrders), ctx) +} diff --git a/x/ecocredit/server/core/create_batch.go b/x/ecocredit/server/core/create_batch.go index a420f47013..5649d1dc0d 100644 --- a/x/ecocredit/server/core/create_batch.go +++ b/x/ecocredit/server/core/create_batch.go @@ -32,7 +32,9 @@ func (k Keeper) CreateBatch(ctx context.Context, req *v1beta1.MsgCreateBatch) (* return nil, err } - creditType, err := k.getCreditType(sdkCtx, classInfo.CreditType) + p := &ecocredit.Params{} + k.params.GetParamSet(sdkCtx, p) + creditType, err := k.getCreditType(classInfo.CreditType, p.CreditTypes) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/create_class.go b/x/ecocredit/server/core/create_class.go index 7e7a44d052..7df76d2596 100644 --- a/x/ecocredit/server/core/create_class.go +++ b/x/ecocredit/server/core/create_class.go @@ -16,7 +16,6 @@ const gasCostPerIteration = uint64(10) func (k Keeper) CreateClass(goCtx context.Context, req *v1beta1.MsgCreateClass) (*v1beta1.MsgCreateClassResponse, error) { sdkCtx := sdk.UnwrapSDKContext(goCtx) - // Charge the admin a fee to create the credit class adminAddress, err := sdk.AccAddressFromBech32(req.Admin) if err != nil { return nil, err @@ -29,12 +28,13 @@ func (k Keeper) CreateClass(goCtx context.Context, req *v1beta1.MsgCreateClass) return nil, sdkerrors.ErrUnauthorized.Wrapf("%s is not allowed to create credit classes", adminAddress.String()) } - err = k.chargeCreditClassFee(sdkCtx, adminAddress) + // Charge the admin a fee to create the credit class + err = k.chargeCreditClassFee(sdkCtx, adminAddress, params.CreditClassFee) if err != nil { return nil, err } - creditType, err := k.getCreditType(sdkCtx, req.CreditTypeName) + creditType, err := k.getCreditType(req.CreditTypeName, params.CreditTypes) if err != nil { return nil, err } @@ -99,9 +99,7 @@ func (k Keeper) isCreatorAllowListed(ctx sdk.Context, allowlist []string, design return false } -func (k Keeper) chargeCreditClassFee(ctx sdk.Context, creatorAddr sdk.AccAddress) error { - creditClassFee := k.getCreditClassFee(ctx) - +func (k Keeper) chargeCreditClassFee(ctx sdk.Context, creatorAddr sdk.AccAddress, creditClassFee sdk.Coins) error { // Move the fee to the ecocredit module's account err := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creatorAddr, ecocredit.ModuleName, creditClassFee) if err != nil { @@ -119,14 +117,7 @@ func (k Keeper) chargeCreditClassFee(ctx sdk.Context, creatorAddr sdk.AccAddress return nil } -func (k Keeper) getCreditClassFee(ctx sdk.Context) sdk.Coins { - var params ecocredit.Params - k.params.GetParamSet(ctx, ¶ms) - return params.CreditClassFee -} - -func (k Keeper) getCreditType(ctx sdk.Context, creditTypeName string) (ecocreditv1beta1.CreditType, error) { - creditTypes := k.getAllCreditTypes(ctx) +func (k Keeper) getCreditType(creditTypeName string, creditTypes []*ecocredit.CreditType) (ecocreditv1beta1.CreditType, error) { creditTypeName = ecocredit.NormalizeCreditTypeName(creditTypeName) for _, creditType := range creditTypes { // credit type name's stored via params have enforcement on normalization, so we can be sure they will already @@ -142,9 +133,3 @@ func (k Keeper) getCreditType(ctx sdk.Context, creditTypeName string) (ecocredit } return ecocreditv1beta1.CreditType{}, sdkerrors.ErrInvalidType.Wrapf("%s is not a valid credit type", creditTypeName) } - -func (k Keeper) getAllCreditTypes(ctx sdk.Context) []*ecocredit.CreditType { - var params ecocredit.Params - k.params.GetParamSet(ctx, ¶ms) - return params.CreditTypes -} diff --git a/x/ecocredit/server/core/create_class_test.go b/x/ecocredit/server/core/create_class_test.go new file mode 100644 index 0000000000..c1495a3e66 --- /dev/null +++ b/x/ecocredit/server/core/create_class_test.go @@ -0,0 +1,101 @@ +package core + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "gotest.tools/v3/assert" + "testing" +) + +func TestValidState(t *testing.T) { + t.Parallel() + s := setupBase(t) + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(_ interface{}, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = sdk.NewCoins(sdk.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + s.bankKeeper.EXPECT().SendCoinsFromAccountToModule(any, any,any, any).Return(nil) + s.bankKeeper.EXPECT().BurnCoins(any, any, any).Return(nil) + + res, err := s.k.CreateClass(s.ctx, &v1beta1.MsgCreateClass{ + Admin: s.addr.String(), + Issuers: []string{s.addr.String()}, + Metadata: nil, + CreditTypeName: "carbon", + }) + assert.NilError(t, err, "error creating class: %+w", err) + assert.Equal(t, res.ClassId, "C01") + + ci, err := s.stateStore.ClassInfoStore().GetByName(s.ctx, res.ClassId) + assert.NilError(t, err) + _, err = s.stateStore.ClassIssuerStore().Get(s.ctx, ci.Id, s.addr) + assert.NilError(t, err) +} + +func TestNotAuthorized(t *testing.T) { + t.Parallel() + s := setupBase(t) + + + s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(_ interface{}, p *ecocredit.Params) { + p.AllowlistEnabled = true + p.AllowedClassCreators = append(p.AllowedClassCreators, "foo") + }).AnyTimes() + _, err := s.k.CreateClass(s.ctx, &v1beta1.MsgCreateClass{ + Admin: s.addr.String(), + Issuers: []string{s.addr.String()}, + Metadata: nil, + CreditTypeName: "carbon", + }) + assert.ErrorContains(t, err, "is not allowed to create credit classes") + + s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(_ interface{}, p *ecocredit.Params) { + p.AllowlistEnabled = false + }).AnyTimes() + _, err = s.k.CreateClass(s.ctx, &v1beta1.MsgCreateClass{ + Admin: s.addr.String(), + Issuers: []string{s.addr.String()}, + Metadata: nil, + CreditTypeName: "carbon", + }) + assert.ErrorContains(t, err, "is not allowed to create credit classes") +} + +func TestSequences(t *testing.T) { + t.Parallel() + s := setupBase(t) + + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(_ interface{}, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = sdk.NewCoins(sdk.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + s.bankKeeper.EXPECT().SendCoinsFromAccountToModule(any, any,any, any).Return(nil).AnyTimes() + s.bankKeeper.EXPECT().BurnCoins(any, any, any).Return(nil).AnyTimes() + + res, err := s.k.CreateClass(s.ctx, &v1beta1.MsgCreateClass{ + Admin: s.addr.String(), + Issuers: []string{s.addr.String()}, + Metadata: nil, + CreditTypeName: "carbon", + }) + assert.NilError(t, err, "error creating class: %+w", err) + + res2, err := s.k.CreateClass(s.ctx, &v1beta1.MsgCreateClass{ + Admin: s.addr.String(), + Issuers: []string{s.addr.String()}, + Metadata: nil, + CreditTypeName: "carbon", + }) + assert.NilError(t, err, "error creating class: %+w", err) + + assert.Equal(t, res.ClassId, "C01") + assert.Equal(t, res2.ClassId, "C02") +} diff --git a/x/ecocredit/server/core/create_project.go b/x/ecocredit/server/core/create_project.go index 74bdbb3948..172adfb596 100644 --- a/x/ecocredit/server/core/create_project.go +++ b/x/ecocredit/server/core/create_project.go @@ -93,7 +93,7 @@ func (k Keeper) assertClassIssuer(goCtx context.Context, classID uint64, issuer return err } if !found { - return sdkerrors.ErrUnauthorized.Wrapf("%s is not an issuer for class %s", issuer, classID) + return sdkerrors.ErrUnauthorized.Wrapf("%s is not an issuer for the class", issuer) } return nil } diff --git a/x/ecocredit/server/core/keeper_test.go b/x/ecocredit/server/core/keeper_test.go new file mode 100644 index 0000000000..6d96b558f9 --- /dev/null +++ b/x/ecocredit/server/core/keeper_test.go @@ -0,0 +1,73 @@ +package core + +import ( + "context" + "github.com/regen-network/regen-ledger/x/ecocredit/mocks" + "github.com/regen-network/regen-ledger/x/ecocredit/server" + mocks2 "github.com/regen-network/regen-ledger/x/ecocredit/server/core/mocks" + "github.com/tendermint/tendermint/libs/log" + "gotest.tools/v3/assert" + + "github.com/cosmos/cosmos-sdk/orm/model/ormdb" + "github.com/cosmos/cosmos-sdk/orm/model/ormtable" + "github.com/cosmos/cosmos-sdk/orm/testing/ormtest" + "github.com/cosmos/cosmos-sdk/store" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + dbm "github.com/tendermint/tm-db" + "testing" +) + +type baseSuite struct { + t *testing.T + db ormdb.ModuleDB + stateStore ecocreditv1beta1.StateStore + ctx context.Context + k Keeper + ctrl *gomock.Controller + addr sdk.AccAddress + bankKeeper *mocks.MockBankKeeper + paramsKeeper *mocks2.MockParamKeeper + storeKey *sdk.KVStoreKey + sdkCtx sdk.Context +} + +func setupBase(t *testing.T) *baseSuite { + // prepare database + s := &baseSuite{t: t} + var err error + s.db, err = ormdb.NewModuleDB(server.ModuleSchema, ormdb.ModuleDBOptions{}) + assert.NilError(t, err) + s.stateStore, err = ecocreditv1beta1.NewStateStore(s.db) + assert.NilError(t, err) + + db := dbm.NewMemDB() + cms := store.NewCommitMultiStore(db) + s.storeKey = sdk.NewKVStoreKey("test") + cms.MountStoreWithDB(s.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) + + // setup test keeper + s.ctrl = gomock.NewController(t) + assert.NilError(t, err) + s.bankKeeper = mocks.NewMockBankKeeper(s.ctrl) + s.paramsKeeper = mocks2.NewMockParamKeeper(s.ctrl) + s.k = NewKeeper(s.stateStore, s.bankKeeper, s.paramsKeeper) + _, _, s.addr = testdata.KeyTestPubAddr() + + return s +} + +// this is an example of how we will unit test the basket functionality with mocks +func TestKeeperExample(t *testing.T) { + t.Parallel() + s := setupBase(t) + require.NotNil(t, s.k) +} \ No newline at end of file diff --git a/x/ecocredit/server/core/mocks/keeper.go b/x/ecocredit/server/core/mocks/keeper.go new file mode 100644 index 0000000000..a59be14ebd --- /dev/null +++ b/x/ecocredit/server/core/mocks/keeper.go @@ -0,0 +1,48 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: x/ecocredit/server/core/keeper.go + +// Package mocks is a generated GoMock package. +package mocks + +import ( + reflect "reflect" + + types "github.com/cosmos/cosmos-sdk/types" + types0 "github.com/cosmos/cosmos-sdk/x/params/types" + gomock "github.com/golang/mock/gomock" +) + +// MockParamKeeper is a mock of ParamKeeper interface. +type MockParamKeeper struct { + ctrl *gomock.Controller + recorder *MockParamKeeperMockRecorder +} + +// MockParamKeeperMockRecorder is the mock recorder for MockParamKeeper. +type MockParamKeeperMockRecorder struct { + mock *MockParamKeeper +} + +// NewMockParamKeeper creates a new mock instance. +func NewMockParamKeeper(ctrl *gomock.Controller) *MockParamKeeper { + mock := &MockParamKeeper{ctrl: ctrl} + mock.recorder = &MockParamKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockParamKeeper) EXPECT() *MockParamKeeperMockRecorder { + return m.recorder +} + +// GetParamSet mocks base method. +func (m *MockParamKeeper) GetParamSet(ctx types.Context, ps types0.ParamSet) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "GetParamSet", ctx, ps) +} + +// GetParamSet indicates an expected call of GetParamSet. +func (mr *MockParamKeeperMockRecorder) GetParamSet(ctx, ps interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetParamSet", reflect.TypeOf((*MockParamKeeper)(nil).GetParamSet), ctx, ps) +} diff --git a/x/ecocredit/server/core/send.go b/x/ecocredit/server/core/send.go index 8611fee6b0..6ab3aa945a 100644 --- a/x/ecocredit/server/core/send.go +++ b/x/ecocredit/server/core/send.go @@ -159,5 +159,7 @@ func (k Keeper) getCreditTypeFromBatchDenom(ctx context.Context, denom string) ( if err != nil { return ecocreditv1beta1.CreditType{}, err } - return k.getCreditType(sdkCtx, classInfo.CreditType) + p := &ecocredit.Params{} + k.params.GetParamSet(sdkCtx, p) + return k.getCreditType(classInfo.CreditType, p.CreditTypes) } diff --git a/x/ecocredit/server/server.go b/x/ecocredit/server/server.go index 40f1ac8e89..28b63efebe 100644 --- a/x/ecocredit/server/server.go +++ b/x/ecocredit/server/server.go @@ -2,12 +2,15 @@ package server import ( "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/orm/model/ormdb" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" "github.com/regen-network/regen-ledger/orm" "github.com/regen-network/regen-ledger/types/module/server" "github.com/regen-network/regen-ledger/x/ecocredit" + "google.golang.org/protobuf/reflect/protoreflect" ) const ( @@ -73,6 +76,12 @@ type serverImpl struct { batchesByProjectIDIndex orm.Index } +var ModuleSchema = ormdb.ModuleSchema{ + FileDescriptors: map[uint32]protoreflect.FileDescriptor{ + 1: ecocreditv1beta1.File_regen_ecocredit_v1beta1_state_proto, + }, +} + func newServer(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper ecocredit.AccountKeeper, bankKeeper ecocredit.BankKeeper, cdc codec.Codec) serverImpl { s := serverImpl{ From 9675e7376669b8c8239b923d8418d5044f0ead84 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Wed, 16 Feb 2022 20:59:20 -0800 Subject: [PATCH 23/31] feat(wip): unit tests --- x/ecocredit/server/core/cancel_test.go | 105 ++++++++++++++ x/ecocredit/server/core/create_batch_test.go | 133 ++++++++++++++++++ x/ecocredit/server/core/create_class.go | 8 +- x/ecocredit/server/core/create_class_test.go | 9 +- x/ecocredit/server/core/create_project.go | 6 +- .../server/core/create_project_test.go | 96 +++++++++++++ x/ecocredit/server/core/retire_test.go | 42 ++++++ x/ecocredit/server/core/send_test.go | 85 +++++++++++ 8 files changed, 473 insertions(+), 11 deletions(-) create mode 100644 x/ecocredit/server/core/cancel_test.go create mode 100644 x/ecocredit/server/core/create_batch_test.go create mode 100644 x/ecocredit/server/core/create_project_test.go create mode 100644 x/ecocredit/server/core/retire_test.go create mode 100644 x/ecocredit/server/core/send_test.go diff --git a/x/ecocredit/server/core/cancel_test.go b/x/ecocredit/server/core/cancel_test.go new file mode 100644 index 0000000000..106d69da5d --- /dev/null +++ b/x/ecocredit/server/core/cancel_test.go @@ -0,0 +1,105 @@ +package core + +import ( + "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "google.golang.org/protobuf/types/known/timestamppb" + "gotest.tools/v3/assert" + "testing" +) + +func TestCancelValid(t *testing.T) { + t.Parallel() + s := setupBase(t) + s.setupClassProjectBatch(t) + + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(any, any).Do(func(any, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = types.NewCoins(types.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + _, err := s.k.Cancel(s.ctx, &v1beta1.MsgCancel{ + Holder: s.addr.String(), + Credits: []*v1beta1.MsgCancel_CancelCredits{ + { + BatchDenom: "C01-20200101-20210101-01", + Amount: "10.5", + }, + }, + }) + assert.NilError(t, err) + + sup, err := s.stateStore.BatchSupplyStore().Get(s.ctx, 1) + assert.NilError(t, err) + assert.Equal(t, sup.TradableAmount, "0.0") + assert.Equal(t, sup.RetiredAmount, "10.5") + + bal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, s.addr, 1) + assert.NilError(t, err) + assert.Equal(t, bal.Tradable, "0.0") + assert.Equal(t, bal.Retired, "10.5") +} + +func TestInsufficientFunds(t *testing.T) { + t.Parallel() + s := setupBase(t) + s.setupClassProjectBatch(t) + + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(any, any).Do(func(any, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = types.NewCoins(types.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + _, err := s.k.Cancel(s.ctx, &v1beta1.MsgCancel{ + Holder: s.addr.String(), + Credits: []*v1beta1.MsgCancel_CancelCredits{ + { + BatchDenom: "C01-20200101-20210101-01", + Amount: "100000", + }, + }, + }) + assert.ErrorContains(t, err, "insufficient funds") + +} + +func (s baseSuite) setupClassProjectBatch(t *testing.T) { + assert.NilError(t, s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo{ + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + })) + assert.NilError(t, s.stateStore.ProjectInfoStore().Insert(s.ctx, &ecocreditv1beta1.ProjectInfo{ + Name: "PRO", + ClassId: 1, + ProjectLocation: "US-OR", + Metadata: nil, + })) + assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: 1, + BatchDenom: "C01-20200101-20210101-01", + Metadata: nil, + StartDate: ×tamppb.Timestamp{Seconds: 2}, + EndDate: ×tamppb.Timestamp{Seconds: 2}, + })) + assert.NilError(t, s.stateStore.BatchSupplyStore().Insert(s.ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: 1, + TradableAmount: "10.5", + RetiredAmount: "10.5", + CancelledAmount: "", + })) + assert.NilError(t, s.stateStore.BatchBalanceStore().Insert(s.ctx, &ecocreditv1beta1.BatchBalance{ + Address: s.addr, + BatchId: 1, + Tradable: "10.5", + Retired: "10.5", + })) +} diff --git a/x/ecocredit/server/core/create_batch_test.go b/x/ecocredit/server/core/create_batch_test.go new file mode 100644 index 0000000000..f776eb387d --- /dev/null +++ b/x/ecocredit/server/core/create_batch_test.go @@ -0,0 +1,133 @@ +package core + +import ( + "context" + "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "gotest.tools/v3/assert" + "testing" + "time" +) + +func TestValidBatch(t *testing.T) { + t.Parallel() + s := setupBase(t) + before(t, s.ctx, s.stateStore, s.addr) + + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(any, any).Do(func(any, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = types.NewCoins(types.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + start, end := time.Now(), time.Now() + res, err := s.k.CreateBatch(s.ctx, &v1beta1.MsgCreateBatch{ + Issuer: s.addr.String(), + ProjectId: "PRO", + Issuance: []*v1beta1.MsgCreateBatch_BatchIssuance{ + { + Recipient: s.addr.String(), + TradableAmount: "10", + RetiredAmount: "5.3", + }, + }, + Metadata: nil, + StartDate: &start, + EndDate: &end, + }) + + batch, err := s.stateStore.BatchInfoStore().Get(s.ctx, 1) + assert.NilError(t, err) + assert.Equal(t, res.BatchDenom, batch.BatchDenom) + + assert.NilError(t, err, "unexpected error: %w", err) + sup, err := s.stateStore.BatchSupplyStore().Get(s.ctx, 1) + assert.NilError(t, err) + assert.Equal(t, "10", sup.TradableAmount, "got %s", sup.TradableAmount) + assert.Equal(t, "5.3", sup.RetiredAmount, "got %s", sup.RetiredAmount) + assert.Equal(t, "0", sup.CancelledAmount, "got %s", sup.CancelledAmount) + + bal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, s.addr, 1) + assert.NilError(t, err) + assert.Equal(t, "10", bal.Tradable) + assert.Equal(t, "5.3", bal.Retired) +} + +func TestBadPrecision(t *testing.T) { + t.Parallel() + s := setupBase(t) + before(t, s.ctx, s.stateStore, s.addr) + + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(any, any).Do(func(any, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = types.NewCoins(types.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + start, end := time.Now(), time.Now() + _, err := s.k.CreateBatch(s.ctx, &v1beta1.MsgCreateBatch{ + Issuer: s.addr.String(), + ProjectId: "PRO", + Issuance: []*v1beta1.MsgCreateBatch_BatchIssuance{ + { + Recipient: s.addr.String(), + TradableAmount: "10.1234567891111", + }, + }, + Metadata: nil, + StartDate: &start, + EndDate: &end, + }) + assert.ErrorContains(t, err, "exceeds maximum decimal places") +} + +func TestUnauthorizedIssuer(t *testing.T) { + t.Parallel() + s := setupBase(t) + before(t, s.ctx, s.stateStore, s.addr) + _, err := s.k.CreateBatch(s.ctx, &v1beta1.MsgCreateBatch{ + ProjectId: "PRO", + Issuer: "FooBarBaz", + }) + assert.ErrorContains(t, err, "is not an issuer for the class") +} + +func TestProjectNotFound(t *testing.T) { + t.Parallel() + s := setupBase(t) + + _, err := s.k.CreateBatch(s.ctx, &v1beta1.MsgCreateBatch{ + ProjectId: "none", + }) + assert.ErrorContains(t, err, "not found") +} + +func before(t *testing.T, ctx context.Context, ss ecocreditv1beta1.StateStore, addr types.AccAddress) (classRowId, projectRowId uint64){ + cid, err := ss.ClassInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ClassInfo{ + Name: "C01", + Admin: addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + err = ss.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: cid, + Issuer: addr, + }) + assert.NilError(t, err) + pid, err := ss.ProjectInfoStore().InsertReturningID(ctx, &ecocreditv1beta1.ProjectInfo{ + Name: "PRO", + ClassId: 1, + ProjectLocation: "", + Metadata: nil, + }) + assert.NilError(t, err) + + classRowId, projectRowId = cid, pid + return +} diff --git a/x/ecocredit/server/core/create_class.go b/x/ecocredit/server/core/create_class.go index 7df76d2596..a1ece2f2e3 100644 --- a/x/ecocredit/server/core/create_class.go +++ b/x/ecocredit/server/core/create_class.go @@ -117,12 +117,12 @@ func (k Keeper) chargeCreditClassFee(ctx sdk.Context, creatorAddr sdk.AccAddress return nil } -func (k Keeper) getCreditType(creditTypeName string, creditTypes []*ecocredit.CreditType) (ecocreditv1beta1.CreditType, error) { - creditTypeName = ecocredit.NormalizeCreditTypeName(creditTypeName) +func (k Keeper) getCreditType(ctAbbrev string, creditTypes []*ecocredit.CreditType) (ecocreditv1beta1.CreditType, error) { + //creditTypeName = ecocredit.NormalizeCreditTypeName(creditTypeName) for _, creditType := range creditTypes { // credit type name's stored via params have enforcement on normalization, so we can be sure they will already // be normalized here. - if creditType.Name == creditTypeName { + if creditType.Abbreviation == ctAbbrev { return ecocreditv1beta1.CreditType{ Abbreviation: creditType.Abbreviation, Name: creditType.Name, @@ -131,5 +131,5 @@ func (k Keeper) getCreditType(creditTypeName string, creditTypes []*ecocredit.Cr }, nil } } - return ecocreditv1beta1.CreditType{}, sdkerrors.ErrInvalidType.Wrapf("%s is not a valid credit type", creditTypeName) + return ecocreditv1beta1.CreditType{}, sdkerrors.ErrInvalidType.Wrapf("%s is not a valid credit type", ctAbbrev) } diff --git a/x/ecocredit/server/core/create_class_test.go b/x/ecocredit/server/core/create_class_test.go index c1495a3e66..99ed41034a 100644 --- a/x/ecocredit/server/core/create_class_test.go +++ b/x/ecocredit/server/core/create_class_test.go @@ -13,7 +13,7 @@ func TestValidState(t *testing.T) { t.Parallel() s := setupBase(t) any := gomock.Any() - s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(_ interface{}, p *ecocredit.Params) { + s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(any, p *ecocredit.Params) { p.AllowlistEnabled = false p.CreditClassFee = sdk.NewCoins(sdk.NewInt64Coin("foo", 20)) p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} @@ -33,6 +33,7 @@ func TestValidState(t *testing.T) { ci, err := s.stateStore.ClassInfoStore().GetByName(s.ctx, res.ClassId) assert.NilError(t, err) + assert.Equal(t, res.ClassId, ci.Name) _, err = s.stateStore.ClassIssuerStore().Get(s.ctx, ci.Id, s.addr) assert.NilError(t, err) } @@ -42,7 +43,7 @@ func TestNotAuthorized(t *testing.T) { s := setupBase(t) - s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(_ interface{}, p *ecocredit.Params) { + s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(any, p *ecocredit.Params) { p.AllowlistEnabled = true p.AllowedClassCreators = append(p.AllowedClassCreators, "foo") }).AnyTimes() @@ -54,7 +55,7 @@ func TestNotAuthorized(t *testing.T) { }) assert.ErrorContains(t, err, "is not allowed to create credit classes") - s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(_ interface{}, p *ecocredit.Params) { + s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(any, p *ecocredit.Params) { p.AllowlistEnabled = false }).AnyTimes() _, err = s.k.CreateClass(s.ctx, &v1beta1.MsgCreateClass{ @@ -71,7 +72,7 @@ func TestSequences(t *testing.T) { s := setupBase(t) any := gomock.Any() - s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).Do(func(_ interface{}, p *ecocredit.Params) { + s.paramsKeeper.EXPECT().GetParamSet(any, any).Do(func(any, p *ecocredit.Params) { p.AllowlistEnabled = false p.CreditClassFee = sdk.NewCoins(sdk.NewInt64Coin("foo", 20)) p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} diff --git a/x/ecocredit/server/core/create_project.go b/x/ecocredit/server/core/create_project.go index 172adfb596..322a60d9a0 100644 --- a/x/ecocredit/server/core/create_project.go +++ b/x/ecocredit/server/core/create_project.go @@ -26,13 +26,13 @@ func (k Keeper) CreateProject(ctx context.Context, req *v1beta1.MsgCreateProject projectID := req.ProjectId if projectID == "" { - found := false - for ; !found; sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "project id sequence") { + exists := true + for ; exists; sdkCtx.GasMeter().ConsumeGas(gasCostPerIteration, "project id sequence") { projectID, err = k.genProjectID(ctx, classInfo.Id, classInfo.Name) if err != nil { return nil, err } - found, err = k.stateStore.ProjectInfoStore().HasByClassIdName(ctx, classInfo.Id, projectID) + exists, err = k.stateStore.ProjectInfoStore().HasByClassIdName(ctx, classInfo.Id, projectID) if err != nil { return nil, err } diff --git a/x/ecocredit/server/core/create_project_test.go b/x/ecocredit/server/core/create_project_test.go new file mode 100644 index 0000000000..7e85139a08 --- /dev/null +++ b/x/ecocredit/server/core/create_project_test.go @@ -0,0 +1,96 @@ +package core + +import ( + "context" + "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "gotest.tools/v3/assert" + "testing" +) + +func TestValidProjectState(t *testing.T) { + t.Parallel() + s := setupBase(t) + makeClass(t, s.ctx, s.stateStore, s.addr) + res, err := s.k.CreateProject(s.ctx, &v1beta1.MsgCreateProject{ + Issuer: s.addr.String(), + ClassId: "C01", + Metadata: nil, + ProjectLocation: "US-NY", + ProjectId: "FOO", + }) + assert.NilError(t, err) + assert.Equal(t, res.ProjectId, "FOO") + + project, err := s.stateStore.ProjectInfoStore().GetByName(s.ctx, "FOO") + assert.NilError(t, err) + assert.Equal(t, project.ProjectLocation, "US-NY") +} + + + +func TestSequence(t *testing.T) { + t.Parallel() + s := setupBase(t) + makeClass(t, s.ctx, s.stateStore, s.addr) + res, err := s.k.CreateProject(s.ctx, &v1beta1.MsgCreateProject{ + Issuer: s.addr.String(), + ClassId: "C01", + Metadata: nil, + ProjectLocation: "US-NY", + ProjectId: "FOO", + }) + assert.NilError(t, err) + assert.Equal(t, res.ProjectId, "FOO") + + res, err = s.k.CreateProject(s.ctx, &v1beta1.MsgCreateProject{ + Issuer: s.addr.String(), + ClassId: "C01", + Metadata: nil, + ProjectLocation: "US-NY", + ProjectId: "FOO", + }) + assert.NilError(t, err) + assert.Equal(t, res.ProjectId, "FOO1") +} + +func TestGeneratedProjectID(t *testing.T) { + t.Parallel() + s := setupBase(t) + makeClass(t, s.ctx, s.stateStore, s.addr) + res, err := s.k.CreateProject(s.ctx, &v1beta1.MsgCreateProject{ + Issuer: s.addr.String(), + ClassId: "C01", + Metadata: nil, + ProjectLocation: "US-NY", + ProjectId: "", + }) + assert.NilError(t, err) + assert.Equal(t, res.ProjectId, "C0101", "got project id: %s", res.ProjectId) +} + +func TestBadClassID(t *testing.T) { + t.Parallel() + s := setupBase(t) + _, err := s.k.CreateProject(s.ctx, &v1beta1.MsgCreateProject{ + Issuer: s.addr.String(), + ClassId: "NOPE", + ProjectLocation: "US-NY", + ProjectId: "", + }) + assert.ErrorContains(t, err, "not found") +} + +func makeClass(t *testing.T, ctx context.Context, ss ecocreditv1beta1.StateStore, addr types.AccAddress) { + assert.NilError(t, ss.ClassInfoStore().Insert(ctx, &ecocreditv1beta1.ClassInfo{ + Name: "C01", + Admin: addr, + Metadata: nil, + CreditType: "C", + })) + assert.NilError(t, ss.ClassIssuerStore().Insert(ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: 1, + Issuer: addr, + })) +} diff --git a/x/ecocredit/server/core/retire_test.go b/x/ecocredit/server/core/retire_test.go new file mode 100644 index 0000000000..1040c61269 --- /dev/null +++ b/x/ecocredit/server/core/retire_test.go @@ -0,0 +1,42 @@ +package core + +import ( + "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "gotest.tools/v3/assert" + "testing" +) + +func TestRetireState(t *testing.T) { + t.Parallel() + s := setupBase(t) + s.setupClassProjectBatch(t) + + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(any, any).Do(func(_ interface{}, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = types.NewCoins(types.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + _, err := s.k.Retire(s.ctx, &v1beta1.MsgRetire{ + Holder: s.addr.String(), + Credits: []*v1beta1.MsgRetire_RetireCredits{ + {BatchDenom: "C01-20200101-20210101-01", Amount: "10.0"}, + }, + Location: "US-NY", + }) + assert.NilError(t, err) + + bal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, s.addr, 1) + assert.NilError(t, err) + assert.Equal(t, bal.Tradable, "0.5") + assert.Equal(t, bal.Retired, "20.5") + + sup, err := s.stateStore.BatchSupplyStore().Get(s.ctx, 1) + assert.NilError(t, err) + assert.Equal(t, sup.TradableAmount, "0.5") + assert.Equal(t, sup.RetiredAmount, "20.5") +} diff --git a/x/ecocredit/server/core/send_test.go b/x/ecocredit/server/core/send_test.go new file mode 100644 index 0000000000..6403efe810 --- /dev/null +++ b/x/ecocredit/server/core/send_test.go @@ -0,0 +1,85 @@ +package core + +import ( + "github.com/cosmos/cosmos-sdk/testutil/testdata" + "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + "github.com/regen-network/regen-ledger/x/ecocredit" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "gotest.tools/v3/assert" + "testing" +) + +func TestSendValid(t *testing.T) { + t.Parallel() + s := setupBase(t) + _,_,recipient := testdata.KeyTestPubAddr() + s.setupClassProjectBatch(t) + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(any, any).Do(func(_ interface{}, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = types.NewCoins(types.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + _, err := s.k.Send(s.ctx, &v1beta1.MsgSend{ + Sender: s.addr.String(), + Recipient: recipient.String(), + Credits: []*v1beta1.MsgSend_SendCredits{ + {BatchDenom: "C01-20200101-20210101-01", TradableAmount: "2.51"}, + {BatchDenom: "C01-20200101-20210101-01", RetiredAmount: "1.30", RetirementLocation: "US-OR"}, + }, + }) + assert.NilError(t, err) + + senderBal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, s.addr, 1) + assert.NilError(t, err) + + recipientBal, err := s.stateStore.BatchBalanceStore().Get(s.ctx, recipient, 1) + assert.NilError(t, err) + + // sender -> 10.5 - 2.51 = 7.99 + // sender -> retired 1.30 from 7.99 = 6.69 + + assert.Equal(t, "6.69", senderBal.Tradable) + assert.Equal(t, "2.51", recipientBal.Tradable) + assert.Equal(t, "1.30", recipientBal.Retired) + assert.Equal(t, "10.5", senderBal.Retired) // retired credits should be untouched + + sup, err := s.stateStore.BatchSupplyStore().Get(s.ctx, 1) + assert.NilError(t, err) + + assert.Equal(t, "9.20", sup.TradableAmount) + assert.Equal(t, "11.80", sup.RetiredAmount) +} + +func TestErrors(t *testing.T) { + t.Parallel() + s := setupBase(t) + _,_,recipient := testdata.KeyTestPubAddr() + s.setupClassProjectBatch(t) + any := gomock.Any() + s.paramsKeeper.EXPECT().GetParamSet(any, any).Do(func(_ interface{}, p *ecocredit.Params) { + p.AllowlistEnabled = false + p.CreditClassFee = types.NewCoins(types.NewInt64Coin("foo", 20)) + p.CreditTypes = []*ecocredit.CreditType{{Name: "carbon", Abbreviation: "C", Unit: "tonne", Precision: 6}} + }).AnyTimes() + + _, err := s.k.Send(s.ctx, &v1beta1.MsgSend{ + Sender: s.addr.String(), + Recipient: recipient.String(), + Credits: []*v1beta1.MsgSend_SendCredits{ + {BatchDenom: "C01-20200101-20210101-01", TradableAmount: "1000000"}, + }, + }) + assert.ErrorContains(t, err, "insufficient funds") + + _, err = s.k.Send(s.ctx, &v1beta1.MsgSend{ + Sender: s.addr.String(), + Recipient: recipient.String(), + Credits: []*v1beta1.MsgSend_SendCredits{ + {BatchDenom: "C01-20200101-20210101-01", TradableAmount: "10.325092385"}, + }, + }) + assert.ErrorContains(t, err, "exceeds maximum decimal places") +} \ No newline at end of file From f27d9b7cda78312c307fa281a396db46058cabd8 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Fri, 18 Feb 2022 14:01:44 -0800 Subject: [PATCH 24/31] wip: tests --- x/ecocredit/server/core/update_class_test.go | 70 ++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 x/ecocredit/server/core/update_class_test.go diff --git a/x/ecocredit/server/core/update_class_test.go b/x/ecocredit/server/core/update_class_test.go new file mode 100644 index 0000000000..334364e3b4 --- /dev/null +++ b/x/ecocredit/server/core/update_class_test.go @@ -0,0 +1,70 @@ +package core + +import ( + "github.com/cosmos/cosmos-sdk/testutil/testdata" + "github.com/cosmos/cosmos-sdk/types" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "gotest.tools/v3/assert" + "testing" +) + +func TestAddIssuers(t *testing.T) { + t.Parallel() + s := setupBase(t) + + addrs := genAddrs(3) + + newAddrs := genAddrs(3) + + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo { + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + + for _, addr := range addrs { + err := s.stateStore.ClassIssuerStore().Insert(s.ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: 1, + Issuer: addr, + }) + assert.NilError(t, err) + } + + bzz := make([][]byte, 3) + for i, newAddr := range newAddrs { + bzz[i] = newAddr.Bytes() + } + _, err = s.k.UpdateClassIssuers(s.ctx, &v1beta1.MsgUpdateClassIssuers{ + Admin: s.addr.String(), + ClassId: "C01", + AddIssuers: bzz, + RemoveIssuers: nil, + }) + assert.NilError(t, err) + + matched := make(map[string]struct{}) + it, err := s.stateStore.ClassIssuerStore().List(s.ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(1)) + assert.NilError(t, err) + for it.Next() { + val, err := it.Value() + assert.NilError(t, err) + addr := types.AccAddress(val.Issuer).String() + _, ok := matched[addr] + assert.Equal(t, false, ok, "duplicate address in class issuer store %s", addr) + matched[addr] = struct{}{} + } + assert.Equal(t, 6, len(matched), "expected to get 6 address matches, got %d", len(matched)) +} + + +func genAddrs(x int) []types.AccAddress { + addrs := make([]types.AccAddress, x) + for i := 0; i < x; i++ { + _,_,addr := testdata.KeyTestPubAddr() + addrs[i] = addr + } + return addrs +} \ No newline at end of file From c6a1f5d59a1213e8046cdbcdb50fee82cef472db Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 22 Feb 2022 12:22:20 -0800 Subject: [PATCH 25/31] feat: update class unit tests --- x/ecocredit/server/core/update_class.go | 10 +- x/ecocredit/server/core/update_class_test.go | 167 ++++++++++++++++++- 2 files changed, 172 insertions(+), 5 deletions(-) diff --git a/x/ecocredit/server/core/update_class.go b/x/ecocredit/server/core/update_class.go index 2a6f1308e9..f60667b0be 100644 --- a/x/ecocredit/server/core/update_class.go +++ b/x/ecocredit/server/core/update_class.go @@ -11,14 +11,15 @@ import ( func (k Keeper) UpdateClassAdmin(ctx context.Context, req *v1beta1.MsgUpdateClassAdmin) (*v1beta1.MsgUpdateClassAdminResponse, error) { classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) if err != nil { - return nil, err + return nil, sdkerrors.ErrNotFound.Wrapf("class %s not found", req.ClassId) } reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) classAdmin := sdk.AccAddress(classInfo.Admin) + newAdmin, _ := sdk.AccAddressFromBech32(req.NewAdmin) if !classAdmin.Equals(reqAddr) { return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", classInfo.Admin, req.Admin) } - classInfo.Admin = reqAddr + classInfo.Admin = newAdmin if err = k.stateStore.ClassInfoStore().Update(ctx, classInfo); err != nil { return nil, err } @@ -28,7 +29,7 @@ func (k Keeper) UpdateClassAdmin(ctx context.Context, req *v1beta1.MsgUpdateClas func (k Keeper) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpdateClassIssuers) (*v1beta1.MsgUpdateClassIssuersResponse, error) { class, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) if err != nil { - return nil, err + return nil, sdkerrors.ErrNotFound.Wrapf("class %s not found", req.ClassId) } reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) admin := sdk.AccAddress(class.Admin) @@ -36,6 +37,7 @@ func (k Keeper) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpdateCl return nil, sdkerrors.ErrUnauthorized.Wrapf("expected admin %s, got %s", class.Admin, req.Admin) } + // remove issuers for _, issuer := range req.RemoveIssuers { if err = k.stateStore.ClassIssuerStore().Delete(ctx, &ecocreditv1beta1.ClassIssuer{ ClassId: class.Id, @@ -60,7 +62,7 @@ func (k Keeper) UpdateClassIssuers(ctx context.Context, req *v1beta1.MsgUpdateCl func (k Keeper) UpdateClassMetadata(ctx context.Context, req *v1beta1.MsgUpdateClassMetadata) (*v1beta1.MsgUpdateClassMetadataResponse, error) { classInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, req.ClassId) if err != nil { - return nil, err + return nil, sdkerrors.ErrNotFound.Wrapf("class %s not found", req.ClassId) } reqAddr, _ := sdk.AccAddressFromBech32(req.Admin) admin := sdk.AccAddress(classInfo.Admin) diff --git a/x/ecocredit/server/core/update_class_test.go b/x/ecocredit/server/core/update_class_test.go index 334364e3b4..5126a8a391 100644 --- a/x/ecocredit/server/core/update_class_test.go +++ b/x/ecocredit/server/core/update_class_test.go @@ -3,13 +3,70 @@ package core import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" "gotest.tools/v3/assert" "testing" ) -func TestAddIssuers(t *testing.T) { +func TestUpdateAdmin(t *testing.T) { + t.Parallel() + s := setupBase(t) + + addrs := genAddrs(1) + newAdmin := addrs[0] + + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo { + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + + _, err = s.k.UpdateClassAdmin(s.ctx, &v1beta1.MsgUpdateClassAdmin{ + Admin: s.addr.String(), + ClassId: "C01", + NewAdmin: newAdmin.String(), + }) + assert.NilError(t, err) + + cInfo, err := s.stateStore.ClassInfoStore().Get(s.ctx, 1) + assert.NilError(t, err) + assert.Check(t, newAdmin.Equals(types.AccAddress(cInfo.Admin))) +} + +func TestUpdateAdminErrs(t *testing.T) { + t.Parallel() + s := setupBase(t) + + addr := genAddrs(1)[0] + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo { + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + + _, err = s.k.UpdateClassAdmin(s.ctx, &v1beta1.MsgUpdateClassAdmin{ + Admin: addr.String(), + ClassId: "C01", + NewAdmin: addr.String(), + }) + assert.ErrorContains(t, err, "unauthorized") + + _, err = s.k.UpdateClassAdmin(s.ctx, &v1beta1.MsgUpdateClassAdmin{ + Admin: addr.String(), + ClassId: "FOOBAR", + NewAdmin: addr.String(), + }) + assert.ErrorContains(t, err, "not found") + +} + +func TestUpdateIssuers(t *testing.T) { t.Parallel() s := setupBase(t) @@ -57,8 +114,116 @@ func TestAddIssuers(t *testing.T) { matched[addr] = struct{}{} } assert.Equal(t, 6, len(matched), "expected to get 6 address matches, got %d", len(matched)) + + removeAddrs := addrs[1:] + removeBz := make([][]byte, 3) + for i, rmAddr := range removeAddrs { + removeBz[i] = rmAddr.Bytes() + } + + _, err = s.k.UpdateClassIssuers(s.ctx, &v1beta1.MsgUpdateClassIssuers{ + Admin: s.addr.String(), + ClassId: "C01", + AddIssuers: nil, + RemoveIssuers: removeBz, + }) + assert.NilError(t, err) + it, err = s.stateStore.ClassIssuerStore().List(s.ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(1)) + assert.NilError(t, err) + for it.Next() { + val, err := it.Value() + assert.NilError(t, err) + addr := types.AccAddress(val.Issuer) + for _, rmAddr := range removeAddrs { + assert.Check(t, !addr.Equals(rmAddr), "%s was supposed to be deleted", rmAddr.String()) + } + } +} + +func TestUpdateIssuersErrs(t *testing.T) { + t.Parallel() + s := setupBase(t) + + addr := genAddrs(1)[0] + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo { + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + + _, err = s.k.UpdateClassIssuers(s.ctx, &v1beta1.MsgUpdateClassIssuers{ + Admin: addr.String(), + ClassId: "C01", + AddIssuers: nil, + RemoveIssuers: nil, + }) + assert.ErrorContains(t, err, sdkerrors.ErrUnauthorized.Error()) + + _, err = s.k.UpdateClassIssuers(s.ctx, &v1beta1.MsgUpdateClassIssuers{ + Admin: s.addr.String(), + ClassId: "FOO", + AddIssuers: nil, + RemoveIssuers: nil, + }) + assert.ErrorContains(t, err, sdkerrors.ErrNotFound.Error()) +} + +func TestUpdateMetaData(t *testing.T) { + t.Parallel() + s := setupBase(t) + + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo { + Name: "C01", + Admin: s.addr, + Metadata: []byte("foobar"), + CreditType: "C", + }) + assert.NilError(t, err) + + _, err = s.k.UpdateClassMetadata(s.ctx, &v1beta1.MsgUpdateClassMetadata{ + Admin: s.addr.String(), + ClassId: "C01", + Metadata: []byte("barfoo"), + }) + assert.NilError(t, err) + + class, err := s.stateStore.ClassInfoStore().Get(s.ctx, 1) + assert.NilError(t, err) + assert.DeepEqual(t, []byte("barfoo"), class.Metadata) } +func TestUpdateMetaDataErrs(t *testing.T) { + t.Parallel() + s := setupBase(t) + + addr := genAddrs(1)[0] + + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo { + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + + _, err = s.k.UpdateClassMetadata(s.ctx, &v1beta1.MsgUpdateClassMetadata{ + Admin: s.addr.String(), + ClassId: "FOO", + Metadata: nil, + }) + assert.ErrorContains(t, err, sdkerrors.ErrNotFound.Error()) + + + _, err = s.k.UpdateClassMetadata(s.ctx, &v1beta1.MsgUpdateClassMetadata{ + Admin: addr.String(), + ClassId: "C01", + Metadata: []byte("FOO"), + }) + assert.ErrorContains(t, err, sdkerrors.ErrUnauthorized.Error()) + +} func genAddrs(x int) []types.AccAddress { addrs := make([]types.AccAddress, x) From 3f786c278204a16dac183c12fe6b3fdbc2ece0cd Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 22 Feb 2022 14:29:06 -0800 Subject: [PATCH 26/31] chore: add query utils --- x/ecocredit/server/core/query_utils.go | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 x/ecocredit/server/core/query_utils.go diff --git a/x/ecocredit/server/core/query_utils.go b/x/ecocredit/server/core/query_utils.go new file mode 100644 index 0000000000..923e085ac7 --- /dev/null +++ b/x/ecocredit/server/core/query_utils.go @@ -0,0 +1,50 @@ +package core + +import ( + queryv1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/query/v1beta1" + "github.com/cosmos/cosmos-sdk/types/query" + gogoproto "github.com/gogo/protobuf/proto" + "google.golang.org/protobuf/proto" +) + +func GogoPageReqToPulsarPageReq(from *query.PageRequest) (*queryv1beta1.PageRequest, error) { + if from == nil { + return &queryv1beta1.PageRequest{}, nil + } + + to := &queryv1beta1.PageRequest{} + err := GogoToPulsarSlow(from, to) + return to, err +} + +func PulsarPageResToGogoPageRes(from *queryv1beta1.PageResponse) (*query.PageResponse, error) { + if from == nil { + return nil, nil + } + + to := &query.PageResponse{} + err := PulsarToGogoSlow(from, to) + return to, err +} + +func PulsarToGogoSlow(from proto.Message, to gogoproto.Message) error { + if from == nil { + return nil + } + + bz, err := proto.Marshal(from) + if err != nil { + return err + } + + return gogoproto.Unmarshal(bz, to) +} + +func GogoToPulsarSlow(from gogoproto.Message, to proto.Message) error { + bz, err := gogoproto.Marshal(from) + if err != nil { + return err + } + + return proto.Unmarshal(bz, to) +} From df6d5b3f5a67b202939cab7db40a654fe1520af8 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 22 Feb 2022 15:18:52 -0800 Subject: [PATCH 27/31] chore: cleanup queries --- x/ecocredit/server/core/query_server.go | 225 +++++++++--------------- 1 file changed, 81 insertions(+), 144 deletions(-) diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index 434ffd3308..51d8538919 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -2,12 +2,10 @@ package core import ( "context" - queryv1beta1 "github.com/cosmos/cosmos-sdk/api/cosmos/base/query/v1beta1" "github.com/cosmos/cosmos-sdk/orm/model/ormlist" + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/types/query" - "github.com/gogo/protobuf/types" ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" "github.com/regen-network/regen-ledger/x/ecocredit" "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" @@ -20,35 +18,36 @@ func (k Keeper) Classes(ctx context.Context, request *v1beta1.QueryClassesReques if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } - if request.Pagination == nil { - request.Pagination = &query.PageRequest{} - } - p := request.Pagination - it, err := k.stateStore.ClassInfoStore().List(ctx, &ecocreditv1beta1.ClassInfoPrimaryKey{}, ormlist.Paginate(&queryv1beta1.PageRequest{ - Key: p.Key, - Offset: p.Offset, - Limit: p.Limit, - CountTotal: p.CountTotal, - Reverse: p.Reverse, - })) + + pg, err := GogoPageReqToPulsarPageReq(request.Pagination) + if err != nil { + return nil, err + } + it, err := k.stateStore.ClassInfoStore().List(ctx, &ecocreditv1beta1.ClassInfoPrimaryKey{}, ormlist.Paginate(pg)) if err != nil { return nil, err } + infos := make([]*v1beta1.ClassInfo, 0) for it.Next() { info, err := it.Value() if err != nil { return nil, err } - infos = append(infos, &v1beta1.ClassInfo{ - Id: info.Id, - Name: info.Name, - Admin: info.Admin, - Metadata: info.Metadata, - CreditType: info.CreditType, - }) - } - return nil, err + var ci v1beta1.ClassInfo + if err = PulsarToGogoSlow(info, &ci); err != nil { + return nil, err + } + infos = append(infos, &ci) + } + pr, err := PulsarPageResToGogoPageRes(it.PageResponse()) + if err != nil { + return nil, err + } + return &v1beta1.QueryClassesResponse{ + Classes: infos, + Pagination: pr, + }, err } // ClassInfo queries for information on a credit class. @@ -76,24 +75,22 @@ func (k Keeper) ClassInfo(ctx context.Context, request *v1beta1.QueryClassInfoRe } issuers = append(issuers, val.Issuer) } - - return &v1beta1.QueryClassInfoResponse{Info: &v1beta1.ClassInfo{ - Id: classInfo.Id, - Name: request.ClassId, - Admin: classInfo.Admin, - Metadata: classInfo.Metadata, - CreditType: classInfo.CreditType, - }}, nil + var ci v1beta1.ClassInfo + if err = PulsarToGogoSlow(classInfo, &ci); err != nil { + return nil, err + } + return &v1beta1.QueryClassInfoResponse{Info: &ci}, nil } func (k Keeper) ClassIssuers(ctx context.Context, request *v1beta1.QueryClassIssuersRequest) (*v1beta1.QueryClassIssuersResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } - if request.Pagination == nil { - request.Pagination = &query.PageRequest{} + + pg, err := GogoPageReqToPulsarPageReq(request.Pagination) + if err != nil { + return nil, err } - p := request.Pagination if err := ecocredit.ValidateClassID(request.ClassId); err != nil { return nil, err } @@ -103,13 +100,7 @@ func (k Keeper) ClassIssuers(ctx context.Context, request *v1beta1.QueryClassIss return nil, err } - it, err := k.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ - Key: p.Key, - Offset: p.Offset, - Limit: p.Limit, - CountTotal: p.CountTotal, - Reverse: p.Reverse, - })) + it, err := k.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id), ormlist.Paginate(pg)) if err != nil { return nil, err } @@ -123,14 +114,13 @@ func (k Keeper) ClassIssuers(ctx context.Context, request *v1beta1.QueryClassIss issuers = append(issuers, string(issuer.Issuer)) } - pr := it.PageResponse() - + pr, err := PulsarPageResToGogoPageRes(it.PageResponse()) + if err != nil { + return nil, err + } return &v1beta1.QueryClassIssuersResponse{ - Issuers: issuers, - Pagination: &query.PageResponse{ - NextKey: pr.NextKey, - Total: pr.Total, - }, + Issuers: issuers, + Pagination: pr, }, nil } @@ -139,21 +129,15 @@ func (k Keeper) Projects(ctx context.Context, request *v1beta1.QueryProjectsRequ if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } - if request.Pagination == nil { - request.Pagination = &query.PageRequest{} + pg, err := GogoPageReqToPulsarPageReq(request.Pagination) + if err != nil { + return nil, err } - p := request.Pagination cInfo, err := k.stateStore.ClassInfoStore().GetByName(ctx, request.ClassId) if err != nil { return nil, err } - it, err := k.stateStore.ProjectInfoStore().List(ctx, ecocreditv1beta1.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ - Key: p.Key, - Offset: p.Offset, - Limit: p.Limit, - CountTotal: p.CountTotal, - Reverse: p.Reverse, - })) + it, err := k.stateStore.ProjectInfoStore().List(ctx, ecocreditv1beta1.ProjectInfoClassIdNameIndexKey{}.WithClassId(cInfo.Id), ormlist.Paginate(pg)) if err != nil { return nil, err } @@ -163,25 +147,19 @@ func (k Keeper) Projects(ctx context.Context, request *v1beta1.QueryProjectsRequ if err != nil { return nil, err } - classInfo, err := k.stateStore.ClassInfoStore().Get(ctx, info.ClassId) - if err != nil { + var pi v1beta1.ProjectInfo + if err = PulsarToGogoSlow(info, &pi); err != nil { return nil, err } - projectInfos = append(projectInfos, &v1beta1.ProjectInfo{ - Id: info.Id, - Name: info.Name, - ClassId: classInfo.Id, - ProjectLocation: info.ProjectLocation, - Metadata: info.Metadata, - }) - } - pg := it.PageResponse() + projectInfos = append(projectInfos, &pi) + } + pr, err := PulsarPageResToGogoPageRes(it.PageResponse()) + if err != nil { + return nil, err + } return &v1beta1.QueryProjectsResponse{ - Projects: projectInfos, - Pagination: &query.PageResponse{ - NextKey: pg.NextKey, - Total: pg.Total, - }, + Projects: projectInfos, + Pagination: pr, }, nil } @@ -216,27 +194,15 @@ func (k Keeper) Batches(ctx context.Context, request *v1beta1.QueryBatchesReques if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") } - if request.Pagination == nil { - request.Pagination = &query.PageRequest{} - } - p := request.Pagination - project, err := k.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) + pg, err := GogoPageReqToPulsarPageReq(request.Pagination) if err != nil { return nil, err } - it, err := k.stateStore.BatchInfoStore().List(ctx, ecocreditv1beta1.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(&queryv1beta1.PageRequest{ - Key: p.Key, - Offset: p.Offset, - Limit: p.Limit, - CountTotal: p.CountTotal, - Reverse: p.Reverse, - })) + project, err := k.stateStore.ProjectInfoStore().GetByName(ctx, request.ProjectId) if err != nil { return nil, err } - - projectName := request.ProjectId - pinfo, err := k.stateStore.ProjectInfoStore().GetByName(ctx, projectName) + it, err := k.stateStore.BatchInfoStore().List(ctx, ecocreditv1beta1.BatchInfoProjectIdIndexKey{}.WithProjectId(project.Id), ormlist.Paginate(pg)) if err != nil { return nil, err } @@ -247,30 +213,19 @@ func (k Keeper) Batches(ctx context.Context, request *v1beta1.QueryBatchesReques if err != nil { return nil, err } - - protoStart, err := types.TimestampProto(batch.StartDate.AsTime()) - if err != nil { - return nil, err - } - protoEnd, err := types.TimestampProto(batch.EndDate.AsTime()) - if err != nil { + var bi v1beta1.BatchInfo + if err = PulsarToGogoSlow(batch, &bi); err != nil { return nil, err } - batches = append(batches, &v1beta1.BatchInfo{ - ProjectId: pinfo.Id, - BatchDenom: batch.BatchDenom, - Metadata: batch.Metadata, - StartDate: protoStart, - EndDate: protoEnd, - }) - } - pr := it.PageResponse() + batches = append(batches, &bi) + } + pr, err := PulsarPageResToGogoPageRes(it.PageResponse()) + if err != nil { + return nil, err + } return &v1beta1.QueryBatchesResponse{ - Batches: batches, - Pagination: &query.PageResponse{ - NextKey: pr.NextKey, - Total: pr.Total, - }, + Batches: batches, + Pagination: pr, }, nil } @@ -287,30 +242,11 @@ func (k Keeper) BatchInfo(ctx context.Context, request *v1beta1.QueryBatchInfoRe if err != nil { return nil, err } - - project, err := k.stateStore.ProjectInfoStore().Get(ctx, batch.ProjectId) - if err != nil { - return nil, err - } - - protoStart, err := types.TimestampProto(batch.StartDate.AsTime()) - if err != nil { - return nil, err - } - protoEnd, err := types.TimestampProto(batch.EndDate.AsTime()) - if err != nil { + var bi v1beta1.BatchInfo + if err = PulsarToGogoSlow(batch, &bi); err != nil { return nil, err } - return &v1beta1.QueryBatchInfoResponse{ - Info: &v1beta1.BatchInfo{ - Id: batch.Id, - ProjectId: project.Id, - BatchDenom: request.BatchDenom, - Metadata: batch.Metadata, - StartDate: protoStart, - EndDate: protoEnd, - }, - }, nil + return &v1beta1.QueryBatchInfoResponse{Info: &bi}, nil } // Balance queries the balance (both tradable and retired) of a given credit @@ -333,14 +269,14 @@ func (k Keeper) Balance(ctx context.Context, req *v1beta1.QueryBalanceRequest) ( balance, err := k.stateStore.BatchBalanceStore().Get(ctx, addr, batch.Id) if err != nil { + if ormerrors.IsNotFound(err) { + return &v1beta1.QueryBalanceResponse{ + TradableAmount: "0", + RetiredAmount: "0", + }, nil + } return nil, err } - if balance == nil { - return &v1beta1.QueryBalanceResponse{ - TradableAmount: "0", - RetiredAmount: "0", - }, nil - } return &v1beta1.QueryBalanceResponse{ TradableAmount: balance.Tradable, RetiredAmount: balance.Retired, @@ -386,18 +322,19 @@ func (k Keeper) CreditTypes(ctx context.Context, _ *v1beta1.QueryCreditTypesRequ if err != nil { return nil, err } - creditTypes = append(creditTypes, &v1beta1.CreditType{ - Abbreviation: ct.Abbreviation, - Name: ct.Name, - Unit: ct.Unit, - Precision: ct.Precision, - }) + var cType v1beta1.CreditType + if err = PulsarToGogoSlow(ct, &cType); err != nil { + return nil, err + } + creditTypes = append(creditTypes, &cType) } return &v1beta1.QueryCreditTypesResponse{CreditTypes: creditTypes}, nil } // Params queries the ecocredit module parameters. // TODO: remove params https://github.com/regen-network/regen-ledger/issues/729 +// Currently this is an ugly hack that grabs v1alpha types and converts them into v1beta types. +// will be gone with #729. func (k Keeper) Params(ctx context.Context, _ *v1beta1.QueryParamsRequest) (*v1beta1.QueryParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) var params ecocredit.Params From f01d6782e9570d9d104aa20aa7187d4a4ecbe719 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 22 Feb 2022 15:20:23 -0800 Subject: [PATCH 28/31] chore: go mod tidy --- Makefile | 4 ++++ api/go.sum | 9 +-------- types/go.sum | 4 ---- x/group/go.mod | 6 +++++- x/group/go.sum | 12 ++++++++++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 1dbb8b23a1..5f80b89319 100644 --- a/Makefile +++ b/Makefile @@ -424,3 +424,7 @@ regen-mocks: mockgen -source=x/ecocredit/expected_keepers.go -package mocks -destination x/ecocredit/mocks/expected_keepers.go .PHONY: regen-mocks + +tidy: + ./scripts/go-mod-tidy-all.sh +.PHONY: tidy \ No newline at end of file diff --git a/api/go.sum b/api/go.sum index e6255f50d1..a36b173adc 100644 --- a/api/go.sum +++ b/api/go.sum @@ -23,17 +23,12 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cosmos/cosmos-proto v1.0.0-alpha6/go.mod h1:msdDWOvfStHLG+Z2y2SJ0dcqimZ2vc8M1MPnZ4jOF7U= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3 h1:tqpedvX/1UgQyX3W2hlW6Xg801FyojYT/NOHbW0oG+s= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3/go.mod h1:Ht15guGn9F8b0lv8NkjXE9/asAvVUOt2n4gvQ4q5MyU= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 h1:z2si9sQNUTj2jw+24SujuUxcoNS3TVga/fdYsS4rJII= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.6 h1:ZfS4+Vf+zdX3ABGmThHSJt9KTOOIxCxGg8mbob7JbUw= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.6/go.mod h1:pH7cqdUlm/zbtGUxlg9Lf/KL8poW4N9HkSN1AKAwRKk= github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7 h1:pDxU4OFliJjQ22Tqf9kCfPZFtJla/yfGnV6EojVw+d8= github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7/go.mod h1:woV5EBAWmTaXKs7YXioQsYheXSZkmZIgLPq+Koi/GB8= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -253,8 +248,7 @@ google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTp google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -267,7 +261,6 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/types/go.sum b/types/go.sum index 091060c008..53275877d2 100644 --- a/types/go.sum +++ b/types/go.sum @@ -220,10 +220,8 @@ github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a/go.mod h1:F5haX7 github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/cosmos-proto v1.0.0-alpha6/go.mod h1:msdDWOvfStHLG+Z2y2SJ0dcqimZ2vc8M1MPnZ4jOF7U= github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3/go.mod h1:Ht15guGn9F8b0lv8NkjXE9/asAvVUOt2n4gvQ4q5MyU= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 h1:z2si9sQNUTj2jw+24SujuUxcoNS3TVga/fdYsS4rJII= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= @@ -1591,7 +1589,6 @@ google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1607,7 +1604,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= diff --git a/x/group/go.mod b/x/group/go.mod index d0e26dfc26..35f2b2a021 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -18,7 +18,7 @@ require ( github.com/tendermint/tendermint v0.34.13 github.com/tendermint/tm-db v0.6.6 google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb - google.golang.org/grpc v1.43.0 + google.golang.org/grpc v1.44.0 google.golang.org/protobuf v1.27.1 ) @@ -38,6 +38,9 @@ require ( github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/coinbase/rosetta-sdk-go v0.6.10 // indirect github.com/confio/ics23/go v0.6.6 // indirect + github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 // indirect + github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 // indirect + github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/iavl v0.17.1 // indirect github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect @@ -104,6 +107,7 @@ require ( github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20200313005456-10cdbea86bc0 // indirect github.com/regen-network/cosmos-proto v0.3.1 // indirect + github.com/regen-network/regen-ledger/api v0.1.0-alpha.1 // indirect github.com/rs/cors v1.7.0 // indirect github.com/rs/zerolog v1.23.0 // indirect github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect diff --git a/x/group/go.sum b/x/group/go.sum index 0268b4ecb0..aecf88a3b6 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -224,8 +224,12 @@ github.com/cosmos/cosmos-proto v1.0.0-alpha6/go.mod h1:msdDWOvfStHLG+Z2y2SJ0dcqi github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= github.com/cosmos/cosmos-sdk/api v0.1.0-alpha3/go.mod h1:Ht15guGn9F8b0lv8NkjXE9/asAvVUOt2n4gvQ4q5MyU= +github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4 h1:z2si9sQNUTj2jw+24SujuUxcoNS3TVga/fdYsS4rJII= +github.com/cosmos/cosmos-sdk/api v0.1.0-alpha4/go.mod h1:gZu6sOu2vl4Fd7I+BjDSx2bxndwPgFLGfOegek3SQQo= +github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2 h1:bBglNlra8ZHb4dmbEE8V85ihLA+DkriSm7tcx6x/JWo= github.com/cosmos/cosmos-sdk/errors v1.0.0-beta.2/go.mod h1:Gi7pzVRnvZ1N16JAXpLADzng0ePoE7YeEHaULSFB2Ts= -github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.6/go.mod h1:pH7cqdUlm/zbtGUxlg9Lf/KL8poW4N9HkSN1AKAwRKk= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7 h1:pDxU4OFliJjQ22Tqf9kCfPZFtJla/yfGnV6EojVw+d8= +github.com/cosmos/cosmos-sdk/orm v1.0.0-alpha.7/go.mod h1:woV5EBAWmTaXKs7YXioQsYheXSZkmZIgLPq+Koi/GB8= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -927,6 +931,7 @@ github.com/regen-network/cosmos-sdk v0.44.2-regen-1 h1:Sm7rU4rMwLpEpgrQkF/4w/V/y github.com/regen-network/cosmos-sdk v0.44.2-regen-1/go.mod h1:fwQJdw+aECatpTvQTo1tSfHEsxACdZYU80QCZUPnHr4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= +github.com/regen-network/regen-ledger/api v0.1.0-alpha.1 h1:6Sz8chLlP5yZVFQeXh5pfR457AIlyDB2ocDTxQRCk+0= github.com/regen-network/regen-ledger/api v0.1.0-alpha.1/go.mod h1:wN88p7fU2gFrI23sFcDwiOTrY0KVRnL0RkGolO4C3oY= github.com/regen-network/regen-ledger/x/data v0.0.0-20210602121340-fa967f821a6e h1:CoCwz8MGTn9yReHzqsQWIook/o9yUrO+q4iZoUEFvG0= github.com/regen-network/regen-ledger/x/data v0.0.0-20210602121340-fa967f821a6e/go.mod h1:QFDn0RMBBgxcTjRvmdN9jLFFQdki9aKz2yDYhvP5l9I= @@ -1611,8 +1616,9 @@ google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM= google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -1665,7 +1671,9 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk= gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From f6d8e4b385113e928443168b6331dac19923377e Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Tue, 22 Feb 2022 15:40:47 -0800 Subject: [PATCH 29/31] fix: dec_test should allow empty string --- go.sum | 1 - types/math/dec_test.go | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/go.sum b/go.sum index 48de1fd3c0..540b886362 100644 --- a/go.sum +++ b/go.sum @@ -193,7 +193,6 @@ github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b80 github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/rosetta-sdk-go v0.6.10/go.mod h1:J/JFMsfcePrjJZkwQFLh+hJErkAmdm9Iyy3D5Y0LfXo= github.com/coinbase/rosetta-sdk-go v0.7.0 h1:lmTO/JEpCvZgpbkOITL95rA80CPKb5CtMzLaqF2mCNg= github.com/coinbase/rosetta-sdk-go v0.7.0/go.mod h1:7nD3oBPIiHqhRprqvMgPoGxe/nyq3yftRmpsy29coWE= github.com/confio/ics23/go v0.6.6 h1:pkOy18YxxJ/r0XFDCnrl4Bjv6h4LkBSpLS6F38mrKL8= diff --git a/types/math/dec_test.go b/types/math/dec_test.go index 87a81edcb6..d0fc0f6cdf 100644 --- a/types/math/dec_test.go +++ b/types/math/dec_test.go @@ -187,7 +187,7 @@ func testDecInt64(t *rapid.T) { // Property: invalid_number_string(s) => NewDecFromString(s) == err func testInvalidNewDecFromString(t *rapid.T) { - s := rapid.StringMatching("[[:alpha:]]*").Draw(t, "s").(string) + s := rapid.StringMatching("[[:alpha:]]+").Draw(t, "s").(string) _, err := NewDecFromString(s) require.Error(t, err) } @@ -196,7 +196,7 @@ func testInvalidNewDecFromString(t *rapid.T) { // => NewNonNegativeDecFromString(s) == err func testInvalidNewNonNegativeDecFromString(t *rapid.T) { s := rapid.OneOf( - rapid.StringMatching("[[:alpha:]]*"), + rapid.StringMatching("[[:alpha:]]+"), rapid.StringMatching(`^-\d*\.?\d+$`).Filter( func(s string) bool { return !strings.HasPrefix(s, "-0") && !strings.HasPrefix(s, "-.0") }, ), @@ -210,7 +210,7 @@ func testInvalidNewNonNegativeDecFromString(t *rapid.T) { func testInvalidNewNonNegativeFixedDecFromString(t *rapid.T) { n := rapid.Uint32Range(0, 999).Draw(t, "n").(uint32) s := rapid.OneOf( - rapid.StringMatching("[[:alpha:]]*"), + rapid.StringMatching("[[:alpha:]]+"), rapid.StringMatching(`^-\d*\.?\d+$`).Filter( func(s string) bool { return !strings.HasPrefix(s, "-0") && !strings.HasPrefix(s, "-.0") }, ), @@ -224,7 +224,7 @@ func testInvalidNewNonNegativeFixedDecFromString(t *rapid.T) { // => NewPositiveDecFromString(s) == err func testInvalidNewPositiveDecFromString(t *rapid.T) { s := rapid.OneOf( - rapid.StringMatching("[[:alpha:]]*"), + rapid.StringMatching("[[:alpha:]]+"), rapid.StringMatching(`^-\d*\.?\d+|0$`), ).Draw(t, "s").(string) _, err := NewPositiveDecFromString(s) @@ -236,7 +236,7 @@ func testInvalidNewPositiveDecFromString(t *rapid.T) { func testInvalidNewPositiveFixedDecFromString(t *rapid.T) { n := rapid.Uint32Range(0, 999).Draw(t, "n").(uint32) s := rapid.OneOf( - rapid.StringMatching("[[:alpha:]]*"), + rapid.StringMatching("[[:alpha:]]+"), rapid.StringMatching(`^-\d*\.?\d+|0$`), rapid.StringMatching(fmt.Sprintf(`\d*\.\d{%d,}`, n+1)), ).Draw(t, "s").(string) From 5e06a11b750fe073fc9d8c2d67035461b880b3d2 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Wed, 23 Feb 2022 15:20:01 -0800 Subject: [PATCH 30/31] wip: more tests --- .../server/core/create_project_test.go | 10 + x/ecocredit/server/core/query_server.go | 34 +--- x/ecocredit/server/core/query_server_test.go | 174 ++++++++++++++++++ 3 files changed, 190 insertions(+), 28 deletions(-) create mode 100644 x/ecocredit/server/core/query_server_test.go diff --git a/x/ecocredit/server/core/create_project_test.go b/x/ecocredit/server/core/create_project_test.go index 7e85139a08..c008640248 100644 --- a/x/ecocredit/server/core/create_project_test.go +++ b/x/ecocredit/server/core/create_project_test.go @@ -68,6 +68,16 @@ func TestGeneratedProjectID(t *testing.T) { }) assert.NilError(t, err) assert.Equal(t, res.ProjectId, "C0101", "got project id: %s", res.ProjectId) + + res, err = s.k.CreateProject(s.ctx, &v1beta1.MsgCreateProject{ + Issuer: s.addr.String(), + ClassId: "C01", + Metadata: nil, + ProjectLocation: "US-NY", + ProjectId: "", + }) + assert.NilError(t, err) + assert.Equal(t, res.ProjectId, "C0102", "got project id: %s", res.ProjectId) } func TestBadClassID(t *testing.T) { diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index 51d8538919..ac1d255f8b 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -62,19 +62,6 @@ func (k Keeper) ClassInfo(ctx context.Context, request *v1beta1.QueryClassInfoRe if err != nil { return nil, err } - - issuers := make([]sdk.AccAddress, 0) - it, err := k.stateStore.ClassIssuerStore().List(ctx, ecocreditv1beta1.ClassIssuerClassIdIssuerIndexKey{}.WithClassId(classInfo.Id)) - if err != nil { - return nil, err - } - for it.Next() { - val, err := it.Value() - if err != nil { - return nil, err - } - issuers = append(issuers, val.Issuer) - } var ci v1beta1.ClassInfo if err = PulsarToGogoSlow(classInfo, &ci); err != nil { return nil, err @@ -107,12 +94,11 @@ func (k Keeper) ClassIssuers(ctx context.Context, request *v1beta1.QueryClassIss issuers := make([]string, 0) for it.Next() { - issuer, err := it.Value() + val, err := it.Value() if err != nil { return nil, err } - - issuers = append(issuers, string(issuer.Issuer)) + issuers = append(issuers, sdk.AccAddress(val.Issuer).String()) } pr, err := PulsarPageResToGogoPageRes(it.PageResponse()) if err != nil { @@ -124,7 +110,7 @@ func (k Keeper) ClassIssuers(ctx context.Context, request *v1beta1.QueryClassIss }, nil } -// Projects queries projects of a given credit batch. +// Projects queries all projects of a given credit class. func (k Keeper) Projects(ctx context.Context, request *v1beta1.QueryProjectsRequest) (*v1beta1.QueryProjectsResponse, error) { if request == nil { return nil, status.Errorf(codes.InvalidArgument, "empty request") @@ -174,19 +160,11 @@ func (k Keeper) ProjectInfo(ctx context.Context, request *v1beta1.QueryProjectIn if err != nil { return nil, err } - - cInfo, err := k.stateStore.ClassInfoStore().Get(ctx, pInfo.ClassId) - if err != nil { + var pi v1beta1.ProjectInfo + if err = PulsarToGogoSlow(pInfo, &pi); err != nil { return nil, err } - - return &v1beta1.QueryProjectInfoResponse{Info: &v1beta1.ProjectInfo{ - Id: pInfo.Id, - Name: request.ProjectId, - ClassId: cInfo.Id, - ProjectLocation: pInfo.ProjectLocation, - Metadata: pInfo.Metadata, - }}, nil + return &v1beta1.QueryProjectInfoResponse{Info: &pi}, nil } // Batches queries for all batches in the given credit class. diff --git a/x/ecocredit/server/core/query_server_test.go b/x/ecocredit/server/core/query_server_test.go new file mode 100644 index 0000000000..7fc363cdcd --- /dev/null +++ b/x/ecocredit/server/core/query_server_test.go @@ -0,0 +1,174 @@ +package core + +import ( + "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" + "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" + "gotest.tools/v3/assert" + "testing" +) + +func TestClasses(t *testing.T) { + t.Parallel() + s := setupBase(t) + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo{ + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + err = s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo{ + Name: "C02", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + + res, err := s.k.Classes(s.ctx, &v1beta1.QueryClassesRequest{}) + assert.NilError(t, err) + assert.Equal(t, 2, len(res.Classes)) + assert.Equal(t, "C01", res.Classes[0].Name) + + res, err = s.k.Classes(s.ctx, &v1beta1.QueryClassesRequest{Pagination: &query.PageRequest{ + Limit: 1, + CountTotal: true, + Reverse: true, + }}) + assert.NilError(t, err) + assert.Equal(t, 1, len(res.Classes)) + assert.Equal(t, uint64(2), res.Pagination.Total) +} + +func TestClassInfo(t *testing.T) { + t.Parallel() + s := setupBase(t) + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo{ + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + + _, err = s.k.ClassInfo(s.ctx, &v1beta1.QueryClassInfoRequest{ClassId: "C02"}) + assert.ErrorContains(t, err, ormerrors.NotFound.Error()) + + res, err := s.k.ClassInfo(s.ctx, &v1beta1.QueryClassInfoRequest{ClassId: "C01"}) + assert.NilError(t, err) + assert.Equal(t, "C01", res.Info.Name) + assert.DeepEqual(t, s.addr.Bytes(), res.Info.Admin) +} + +func TestClassIssuers(t *testing.T) { + t.Parallel() + s := setupBase(t) + addrs := genAddrs(2) + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo{ + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + assert.NilError(t, s.stateStore.ClassIssuerStore().Insert(s.ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: 1, + Issuer: s.addr, + })) + assert.NilError(t, s.stateStore.ClassIssuerStore().Insert(s.ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: 1, + Issuer: addrs[0], + })) + assert.NilError(t, s.stateStore.ClassIssuerStore().Insert(s.ctx, &ecocreditv1beta1.ClassIssuer{ + ClassId: 1, + Issuer: addrs[1], + })) + + res, err := s.k.ClassIssuers(s.ctx, &v1beta1.QueryClassIssuersRequest{ClassId: "C01"}) + assert.NilError(t, err) + assert.Equal(t, 3, len(res.Issuers)) + addrs = append(addrs, s.addr) + for _, issuer := range res.Issuers { + addr, _ := types.AccAddressFromBech32(issuer) + found := false + for _, addr2 := range addrs { + if addr.Equals(addr2) { + found = true + break + } + } + assert.Equal(t, true, found, "address %s not found in issuer list", issuer) + } + + _, err = s.k.ClassIssuers(s.ctx, &v1beta1.QueryClassIssuersRequest{ClassId: "F01"}) + assert.ErrorContains(t, err, ormerrors.NotFound.Error()) + + res, err = s.k.ClassIssuers(s.ctx, &v1beta1.QueryClassIssuersRequest{ClassId: "C01", Pagination: &query.PageRequest{Limit: 1, CountTotal: true}}) + assert.NilError(t, err) + assert.Equal(t, 1, len(res.Issuers)) + assert.Equal(t, uint64(3), res.Pagination.Total) +} + +func TestProjects(t *testing.T) { + t.Parallel() + s := setupBase(t) + err := s.stateStore.ClassInfoStore().Insert(s.ctx, &ecocreditv1beta1.ClassInfo{ + Name: "C01", + Admin: s.addr, + Metadata: nil, + CreditType: "C", + }) + assert.NilError(t, err) + err= s.stateStore.ProjectInfoStore().Insert(s.ctx, &ecocreditv1beta1.ProjectInfo{ + Name: "P01", + ClassId: 1, + ProjectLocation: "US-CA", + Metadata: nil, + }) + assert.NilError(t, err) + err= s.stateStore.ProjectInfoStore().Insert(s.ctx, &ecocreditv1beta1.ProjectInfo{ + Name: "P02", + ClassId: 1, + ProjectLocation: "US-CA", + Metadata: nil, + }) + assert.NilError(t, err) + + res, err := s.k.Projects(s.ctx, &v1beta1.QueryProjectsRequest{ClassId: "C01"}) + assert.NilError(t, err) + assert.Equal(t, 2, len(res.Projects)) + assert.Equal(t, "US-CA", res.Projects[0].ProjectLocation) + + _, err = s.k.Projects(s.ctx, &v1beta1.QueryProjectsRequest{ClassId: "F01"}) + assert.ErrorContains(t, err, ormerrors.NotFound.Error()) + + res, err = s.k.Projects(s.ctx, &v1beta1.QueryProjectsRequest{ + ClassId: "C01", + Pagination: &query.PageRequest{Limit: 1, CountTotal: true}, + }) + assert.NilError(t, err) + assert.Equal(t, 1, len(res.Projects)) + assert.Equal(t, uint64(2), res.Pagination.Total) +} + +func TestProjectInfo(t *testing.T) { + t.Parallel() + s := setupBase(t) + err := s.stateStore.ProjectInfoStore().Insert(s.ctx, &ecocreditv1beta1.ProjectInfo{ + Name: "P01", + ClassId: 1, + ProjectLocation: "US-CA", + Metadata: nil, + }) + assert.NilError(t, err) + + res, err := s.k.ProjectInfo(s.ctx, &v1beta1.QueryProjectInfoRequest{ProjectId: "P01"}) + assert.NilError(t, err) + assert.Equal(t, "P01", res.Info.Name) + + _, err = s.k.ProjectInfo(s.ctx, &v1beta1.QueryProjectInfoRequest{ProjectId: "F01"}) + assert.ErrorContains(t, err, ormerrors.NotFound.Error()) +} \ No newline at end of file From f60c8bcfb42f60e180b27b26337e70651ac95b60 Mon Sep 17 00:00:00 2001 From: technicallyty <48813565+tytech3@users.noreply.github.com> Date: Wed, 23 Feb 2022 16:08:46 -0800 Subject: [PATCH 31/31] feat: query unit tests --- x/ecocredit/server/core/query_server.go | 5 +- x/ecocredit/server/core/query_server_test.go | 187 +++++++++++++++++++ 2 files changed, 191 insertions(+), 1 deletion(-) diff --git a/x/ecocredit/server/core/query_server.go b/x/ecocredit/server/core/query_server.go index ac1d255f8b..5a00c89d2b 100644 --- a/x/ecocredit/server/core/query_server.go +++ b/x/ecocredit/server/core/query_server.go @@ -243,7 +243,10 @@ func (k Keeper) Balance(ctx context.Context, req *v1beta1.QueryBalanceRequest) ( if batch == nil { return nil, sdkerrors.ErrNotFound.Wrapf("batch with denom %s not found", req.BatchDenom) } - addr, _ := sdk.AccAddressFromBech32(req.Account) + addr, err := sdk.AccAddressFromBech32(req.Account) + if err != nil { + return nil, err + } balance, err := k.stateStore.BatchBalanceStore().Get(ctx, addr, batch.Id) if err != nil { diff --git a/x/ecocredit/server/core/query_server_test.go b/x/ecocredit/server/core/query_server_test.go index 7fc363cdcd..0c190b38b2 100644 --- a/x/ecocredit/server/core/query_server_test.go +++ b/x/ecocredit/server/core/query_server_test.go @@ -4,7 +4,9 @@ import ( "github.com/cosmos/cosmos-sdk/orm/types/ormerrors" "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/golang/mock/gomock" ecocreditv1beta1 "github.com/regen-network/regen-ledger/api/regen/ecocredit/v1beta1" + "github.com/regen-network/regen-ledger/x/ecocredit" "github.com/regen-network/regen-ledger/x/ecocredit/v1beta1" "gotest.tools/v3/assert" "testing" @@ -171,4 +173,189 @@ func TestProjectInfo(t *testing.T) { _, err = s.k.ProjectInfo(s.ctx, &v1beta1.QueryProjectInfoRequest{ProjectId: "F01"}) assert.ErrorContains(t, err, ormerrors.NotFound.Error()) +} + +func TestBatches(t *testing.T) { + t.Parallel() + s := setupBase(t) + err := s.stateStore.ProjectInfoStore().Insert(s.ctx, &ecocreditv1beta1.ProjectInfo{ + Name: "P01", + ClassId: 1, + ProjectLocation: "US-CA", + Metadata: nil, + }) + assert.NilError(t, err) + + assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: 1, + BatchDenom: "C01-20200101-20220101-001", + Metadata: nil, + StartDate: nil, + EndDate: nil, + })) + assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: 1, + BatchDenom: "C01-20200101-20220101-002", + Metadata: nil, + StartDate: nil, + EndDate: nil, + })) + + _, err = s.k.Batches(s.ctx, &v1beta1.QueryBatchesRequest{ProjectId: "F01"}) + assert.ErrorContains(t, err, ormerrors.NotFound.Error()) + + res, err := s.k.Batches(s.ctx, &v1beta1.QueryBatchesRequest{ProjectId: "P01"}) + assert.NilError(t, err) + assert.Equal(t, 2, len(res.Batches)) + assert.Equal(t, "C01-20200101-20220101-001", res.Batches[0].BatchDenom) + + res, err = s.k.Batches(s.ctx, &v1beta1.QueryBatchesRequest{ProjectId: "P01", Pagination: &query.PageRequest{Limit: 1, CountTotal: true}}) + assert.NilError(t, err) + assert.Equal(t, 1, len(res.Batches)) + assert.Equal(t, uint64(2), res.Pagination.Total) +} + +func TestBatchInfo(t *testing.T) { + t.Parallel() + s := setupBase(t) + batchDenom := "C01-20200101-20220101-001" + assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: 1, + BatchDenom: batchDenom, + Metadata: nil, + StartDate: nil, + EndDate: nil, + })) + + _, err := s.k.BatchInfo(s.ctx, &v1beta1.QueryBatchInfoRequest{BatchDenom: "A00-00000000-00000000-000"}) + assert.ErrorContains(t, err, ormerrors.NotFound.Error()) + + res, err := s.k.BatchInfo(s.ctx, &v1beta1.QueryBatchInfoRequest{BatchDenom: batchDenom}) + assert.NilError(t, err) + assert.Equal(t, uint64(1), res.Info.ProjectId) +} + +func TestBalance(t *testing.T) { + t.Parallel() + s := setupBase(t) + noBalanceAddr := genAddrs(1)[0] + batchDenom := "C01-20200101-20220101-001" + tradable := "10.54321" + retired := "50.3214" + assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: 1, + BatchDenom: batchDenom, + Metadata: nil, + StartDate: nil, + EndDate: nil, + })) + assert.NilError(t, s.stateStore.BatchBalanceStore().Insert(s.ctx, &ecocreditv1beta1.BatchBalance{ + Address: s.addr, + BatchId: 1, + Tradable: tradable, + Retired: retired, + })) + res, err := s.k.Balance(s.ctx, &v1beta1.QueryBalanceRequest{ + Account: s.addr.String(), + BatchDenom: batchDenom, + }) + assert.NilError(t, err) + assert.Equal(t, tradable, res.TradableAmount) + assert.Equal(t, retired, res.RetiredAmount) + + res, err = s.k.Balance(s.ctx, &v1beta1.QueryBalanceRequest{ + Account: noBalanceAddr.String(), + BatchDenom: batchDenom, + }) + assert.NilError(t, err) + assert.Equal(t, "0", res.TradableAmount) + assert.Equal(t, "0", res.RetiredAmount) + + _, err = s.k.Balance(s.ctx, &v1beta1.QueryBalanceRequest{ + Account: s.addr.String(), + BatchDenom: "A00-00000000-00000000-001", + }) + assert.ErrorContains(t, err, ormerrors.NotFound.Error()) +} + +func TestSupply(t *testing.T) { + t.Parallel() + s := setupBase(t) + batchDenom := "C01-20200101-20220101-001" + tradable := "10.54321" + retired := "50.3214" + cancelled := "0.3215" + assert.NilError(t, s.stateStore.BatchInfoStore().Insert(s.ctx, &ecocreditv1beta1.BatchInfo{ + ProjectId: 1, + BatchDenom: batchDenom, + Metadata: nil, + StartDate: nil, + EndDate: nil, + })) + assert.NilError(t, s.stateStore.BatchSupplyStore().Insert(s.ctx, &ecocreditv1beta1.BatchSupply{ + BatchId: 1, + TradableAmount: tradable, + RetiredAmount: retired, + CancelledAmount: cancelled, + })) + + res, err := s.k.Supply(s.ctx, &v1beta1.QuerySupplyRequest{BatchDenom: batchDenom}) + assert.NilError(t, err) + assert.Equal(t, tradable, res.TradableSupply) + assert.Equal(t, retired, res.RetiredSupply) + assert.Equal(t, cancelled, res.CancelledAmount) + + _, err = s.k.Supply(s.ctx, &v1beta1.QuerySupplyRequest{BatchDenom: "A00-00000000-00000000-001"}) + assert.ErrorContains(t, err, ormerrors.NotFound.Error()) +} + +func TestCreditTypes(t *testing.T) { + t.Parallel() + s := setupBase(t) + assert.NilError(t, s.stateStore.CreditTypeStore().Insert(s.ctx, &ecocreditv1beta1.CreditType{ + Abbreviation: "C", + Name: "carbon", + Unit: "a ton", + Precision: 6, + })) + assert.NilError(t, s.stateStore.CreditTypeStore().Insert(s.ctx, &ecocreditv1beta1.CreditType{ + Abbreviation: "F", + Name: "foobar", + Unit: "foo per inch", + Precision: 18, + })) + + res, err := s.k.CreditTypes(s.ctx, &v1beta1.QueryCreditTypesRequest{}) + assert.NilError(t, err) + assert.Equal(t, 2, len(res.CreditTypes)) + assert.Equal(t, uint32(6), res.CreditTypes[0].Precision) + assert.Equal(t, "foobar", res.CreditTypes[1].Name) +} + +func TestParams(t *testing.T) { + t.Parallel() + s := setupBase(t) + assert.NilError(t, s.stateStore.CreditTypeStore().Insert(s.ctx, &ecocreditv1beta1.CreditType{ + Abbreviation: "C", + Name: "carbon", + Unit: "a ton", + Precision: 6, + })) + + s.paramsKeeper.EXPECT().GetParamSet(gomock.Any(), gomock.Any()).SetArg(1, ecocredit.Params{ + CreditClassFee: types.NewCoins(types.NewInt64Coin("foo", 30)), + AllowedClassCreators: []string{s.addr.String()}, + AllowlistEnabled: false, + CreditTypes: []*ecocredit.CreditType{{ + Abbreviation: "C", + Name: "carbon", + Unit: "a ton", + Precision: 6, + }}, + }) + + res, err := s.k.Params(s.ctx, &v1beta1.QueryParamsRequest{}) + assert.NilError(t, err) + assert.Equal(t,false, res.Params.AllowlistEnabled) + assert.Equal(t, s.addr.String(), res.Params.AllowedClassCreators[0]) } \ No newline at end of file