From fa11df432422e9ea824011d30a3c4430c4862074 Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Wed, 17 Apr 2024 19:11:20 -0500 Subject: [PATCH 1/8] Add in first section of create-pool msg logic --- x/market/keeper/msg_server_create_pool.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/x/market/keeper/msg_server_create_pool.go b/x/market/keeper/msg_server_create_pool.go index 6b88a0f..7f148e7 100644 --- a/x/market/keeper/msg_server_create_pool.go +++ b/x/market/keeper/msg_server_create_pool.go @@ -4,6 +4,7 @@ import ( "context" "onex/x/market/types" + "strings" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -11,7 +12,26 @@ import ( func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (*types.MsgCreatePoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // TODO: Handling the message + // CoinAmsg and CoinBmsg pre-sort from raw msg + coinA, err := sdk.ParseCoinNormalized(msg.CoinA) + if err != nil { + panic(err) + } + + coinB, err := sdk.ParseCoinNormalized(msg.CoinB) + if err != nil { + panic(err) + } + + coinPair := sdk.NewCoins(coinA, coinB) + + // NewCoins sorts denoms. + // The sorted pair joined by "," is used as the key for the pool. + denom1 := coinPair.GetDenomByIndex(0) + denom2 := coinPair.GetDenomByIndex(1) + pair := strings.Join([]string{denom1, denom2}, ",") + + _ = pair _ = ctx return &types.MsgCreatePoolResponse{}, nil From 3d6881e181991b46f93625b9ce6d3e49323a6c31 Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Wed, 17 Apr 2024 19:46:47 -0500 Subject: [PATCH 2/8] ignite scaffold type member --- api/onex/market/member.pulsar.go | 972 +++++++++++++++++++++++++++++++ docs/static/openapi.yml | 92 +-- proto/onex/market/member.proto | 15 + x/market/types/member.pb.go | 592 +++++++++++++++++++ 4 files changed, 1625 insertions(+), 46 deletions(-) create mode 100644 api/onex/market/member.pulsar.go create mode 100644 proto/onex/market/member.proto create mode 100644 x/market/types/member.pb.go diff --git a/api/onex/market/member.pulsar.go b/api/onex/market/member.pulsar.go new file mode 100644 index 0000000..b85535c --- /dev/null +++ b/api/onex/market/member.pulsar.go @@ -0,0 +1,972 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package market + +import ( + fmt "fmt" + runtime "github.com/cosmos/cosmos-proto/runtime" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var ( + md_Member protoreflect.MessageDescriptor + fd_Member_pair protoreflect.FieldDescriptor + fd_Member_denomA protoreflect.FieldDescriptor + fd_Member_denomB protoreflect.FieldDescriptor + fd_Member_balance protoreflect.FieldDescriptor + fd_Member_previous protoreflect.FieldDescriptor + fd_Member_limit protoreflect.FieldDescriptor + fd_Member_stop protoreflect.FieldDescriptor +) + +func init() { + file_onex_market_member_proto_init() + md_Member = File_onex_market_member_proto.Messages().ByName("Member") + fd_Member_pair = md_Member.Fields().ByName("pair") + fd_Member_denomA = md_Member.Fields().ByName("denomA") + fd_Member_denomB = md_Member.Fields().ByName("denomB") + fd_Member_balance = md_Member.Fields().ByName("balance") + fd_Member_previous = md_Member.Fields().ByName("previous") + fd_Member_limit = md_Member.Fields().ByName("limit") + fd_Member_stop = md_Member.Fields().ByName("stop") +} + +var _ protoreflect.Message = (*fastReflection_Member)(nil) + +type fastReflection_Member Member + +func (x *Member) ProtoReflect() protoreflect.Message { + return (*fastReflection_Member)(x) +} + +func (x *Member) slowProtoReflect() protoreflect.Message { + mi := &file_onex_market_member_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Member_messageType fastReflection_Member_messageType +var _ protoreflect.MessageType = fastReflection_Member_messageType{} + +type fastReflection_Member_messageType struct{} + +func (x fastReflection_Member_messageType) Zero() protoreflect.Message { + return (*fastReflection_Member)(nil) +} +func (x fastReflection_Member_messageType) New() protoreflect.Message { + return new(fastReflection_Member) +} +func (x fastReflection_Member_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Member +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Member) Descriptor() protoreflect.MessageDescriptor { + return md_Member +} + +// 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_Member) Type() protoreflect.MessageType { + return _fastReflection_Member_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Member) New() protoreflect.Message { + return new(fastReflection_Member) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Member) Interface() protoreflect.ProtoMessage { + return (*Member)(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_Member) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pair != "" { + value := protoreflect.ValueOfString(x.Pair) + if !f(fd_Member_pair, value) { + return + } + } + if x.DenomA != "" { + value := protoreflect.ValueOfString(x.DenomA) + if !f(fd_Member_denomA, value) { + return + } + } + if x.DenomB != "" { + value := protoreflect.ValueOfString(x.DenomB) + if !f(fd_Member_denomB, value) { + return + } + } + if x.Balance != "" { + value := protoreflect.ValueOfString(x.Balance) + if !f(fd_Member_balance, value) { + return + } + } + if x.Previous != "" { + value := protoreflect.ValueOfString(x.Previous) + if !f(fd_Member_previous, value) { + return + } + } + if x.Limit != uint64(0) { + value := protoreflect.ValueOfUint64(x.Limit) + if !f(fd_Member_limit, value) { + return + } + } + if x.Stop != uint64(0) { + value := protoreflect.ValueOfUint64(x.Stop) + if !f(fd_Member_stop, 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_Member) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "onex.market.Member.pair": + return x.Pair != "" + case "onex.market.Member.denomA": + return x.DenomA != "" + case "onex.market.Member.denomB": + return x.DenomB != "" + case "onex.market.Member.balance": + return x.Balance != "" + case "onex.market.Member.previous": + return x.Previous != "" + case "onex.market.Member.limit": + return x.Limit != uint64(0) + case "onex.market.Member.stop": + return x.Stop != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Member")) + } + panic(fmt.Errorf("message onex.market.Member 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_Member) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "onex.market.Member.pair": + x.Pair = "" + case "onex.market.Member.denomA": + x.DenomA = "" + case "onex.market.Member.denomB": + x.DenomB = "" + case "onex.market.Member.balance": + x.Balance = "" + case "onex.market.Member.previous": + x.Previous = "" + case "onex.market.Member.limit": + x.Limit = uint64(0) + case "onex.market.Member.stop": + x.Stop = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Member")) + } + panic(fmt.Errorf("message onex.market.Member 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_Member) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "onex.market.Member.pair": + value := x.Pair + return protoreflect.ValueOfString(value) + case "onex.market.Member.denomA": + value := x.DenomA + return protoreflect.ValueOfString(value) + case "onex.market.Member.denomB": + value := x.DenomB + return protoreflect.ValueOfString(value) + case "onex.market.Member.balance": + value := x.Balance + return protoreflect.ValueOfString(value) + case "onex.market.Member.previous": + value := x.Previous + return protoreflect.ValueOfString(value) + case "onex.market.Member.limit": + value := x.Limit + return protoreflect.ValueOfUint64(value) + case "onex.market.Member.stop": + value := x.Stop + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Member")) + } + panic(fmt.Errorf("message onex.market.Member 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_Member) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "onex.market.Member.pair": + x.Pair = value.Interface().(string) + case "onex.market.Member.denomA": + x.DenomA = value.Interface().(string) + case "onex.market.Member.denomB": + x.DenomB = value.Interface().(string) + case "onex.market.Member.balance": + x.Balance = value.Interface().(string) + case "onex.market.Member.previous": + x.Previous = value.Interface().(string) + case "onex.market.Member.limit": + x.Limit = value.Uint() + case "onex.market.Member.stop": + x.Stop = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Member")) + } + panic(fmt.Errorf("message onex.market.Member 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_Member) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.Member.pair": + panic(fmt.Errorf("field pair of message onex.market.Member is not mutable")) + case "onex.market.Member.denomA": + panic(fmt.Errorf("field denomA of message onex.market.Member is not mutable")) + case "onex.market.Member.denomB": + panic(fmt.Errorf("field denomB of message onex.market.Member is not mutable")) + case "onex.market.Member.balance": + panic(fmt.Errorf("field balance of message onex.market.Member is not mutable")) + case "onex.market.Member.previous": + panic(fmt.Errorf("field previous of message onex.market.Member is not mutable")) + case "onex.market.Member.limit": + panic(fmt.Errorf("field limit of message onex.market.Member is not mutable")) + case "onex.market.Member.stop": + panic(fmt.Errorf("field stop of message onex.market.Member is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Member")) + } + panic(fmt.Errorf("message onex.market.Member 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_Member) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.Member.pair": + return protoreflect.ValueOfString("") + case "onex.market.Member.denomA": + return protoreflect.ValueOfString("") + case "onex.market.Member.denomB": + return protoreflect.ValueOfString("") + case "onex.market.Member.balance": + return protoreflect.ValueOfString("") + case "onex.market.Member.previous": + return protoreflect.ValueOfString("") + case "onex.market.Member.limit": + return protoreflect.ValueOfUint64(uint64(0)) + case "onex.market.Member.stop": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Member")) + } + panic(fmt.Errorf("message onex.market.Member 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_Member) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in onex.market.Member", 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_Member) 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_Member) 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_Member) 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_Member) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Member) + 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.Pair) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.DenomA) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.DenomB) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Balance) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Previous) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Limit != 0 { + n += 1 + runtime.Sov(uint64(x.Limit)) + } + if x.Stop != 0 { + n += 1 + runtime.Sov(uint64(x.Stop)) + } + 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().(*Member) + 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.Stop != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Stop)) + i-- + dAtA[i] = 0x38 + } + if x.Limit != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Limit)) + i-- + dAtA[i] = 0x30 + } + if len(x.Previous) > 0 { + i -= len(x.Previous) + copy(dAtA[i:], x.Previous) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Previous))) + i-- + dAtA[i] = 0x2a + } + if len(x.Balance) > 0 { + i -= len(x.Balance) + copy(dAtA[i:], x.Balance) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Balance))) + i-- + dAtA[i] = 0x22 + } + if len(x.DenomB) > 0 { + i -= len(x.DenomB) + copy(dAtA[i:], x.DenomB) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DenomB))) + i-- + dAtA[i] = 0x1a + } + if len(x.DenomA) > 0 { + i -= len(x.DenomA) + copy(dAtA[i:], x.DenomA) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.DenomA))) + i-- + dAtA[i] = 0x12 + } + if len(x.Pair) > 0 { + i -= len(x.Pair) + copy(dAtA[i:], x.Pair) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Pair))) + 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().(*Member) + 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: Member: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Member: 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 Pair", 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.Pair = 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 DenomA", 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.DenomA = 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 DenomB", 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.DenomB = string(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 Balance", 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.Balance = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Previous", 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.Previous = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + x.Limit = 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.Limit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Stop", wireType) + } + x.Stop = 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.Stop |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: onex/market/member.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Member struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` + DenomA string `protobuf:"bytes,2,opt,name=denomA,proto3" json:"denomA,omitempty"` + DenomB string `protobuf:"bytes,3,opt,name=denomB,proto3" json:"denomB,omitempty"` + Balance string `protobuf:"bytes,4,opt,name=balance,proto3" json:"balance,omitempty"` + Previous string `protobuf:"bytes,5,opt,name=previous,proto3" json:"previous,omitempty"` + Limit uint64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` + Stop uint64 `protobuf:"varint,7,opt,name=stop,proto3" json:"stop,omitempty"` +} + +func (x *Member) Reset() { + *x = Member{} + if protoimpl.UnsafeEnabled { + mi := &file_onex_market_member_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Member) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Member) ProtoMessage() {} + +// Deprecated: Use Member.ProtoReflect.Descriptor instead. +func (*Member) Descriptor() ([]byte, []int) { + return file_onex_market_member_proto_rawDescGZIP(), []int{0} +} + +func (x *Member) GetPair() string { + if x != nil { + return x.Pair + } + return "" +} + +func (x *Member) GetDenomA() string { + if x != nil { + return x.DenomA + } + return "" +} + +func (x *Member) GetDenomB() string { + if x != nil { + return x.DenomB + } + return "" +} + +func (x *Member) GetBalance() string { + if x != nil { + return x.Balance + } + return "" +} + +func (x *Member) GetPrevious() string { + if x != nil { + return x.Previous + } + return "" +} + +func (x *Member) GetLimit() uint64 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *Member) GetStop() uint64 { + if x != nil { + return x.Stop + } + return 0 +} + +var File_onex_market_member_proto protoreflect.FileDescriptor + +var file_onex_market_member_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x6f, 0x6e, 0x65, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6f, 0x6e, 0x65, 0x78, + 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x22, 0xac, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x41, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x41, 0x12, 0x16, + 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x42, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x42, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x6f, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x04, 0x73, 0x74, 0x6f, 0x70, 0x42, 0x89, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6f, + 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0x0b, 0x4d, 0x65, 0x6d, 0x62, + 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1c, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x6e, 0x65, 0x78, + 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xa2, 0x02, 0x03, 0x4f, 0x4d, 0x58, 0xaa, 0x02, 0x0b, + 0x4f, 0x6e, 0x65, 0x78, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xca, 0x02, 0x0b, 0x4f, 0x6e, + 0x65, 0x78, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xe2, 0x02, 0x17, 0x4f, 0x6e, 0x65, 0x78, + 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4f, 0x6e, 0x65, 0x78, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_onex_market_member_proto_rawDescOnce sync.Once + file_onex_market_member_proto_rawDescData = file_onex_market_member_proto_rawDesc +) + +func file_onex_market_member_proto_rawDescGZIP() []byte { + file_onex_market_member_proto_rawDescOnce.Do(func() { + file_onex_market_member_proto_rawDescData = protoimpl.X.CompressGZIP(file_onex_market_member_proto_rawDescData) + }) + return file_onex_market_member_proto_rawDescData +} + +var file_onex_market_member_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_onex_market_member_proto_goTypes = []interface{}{ + (*Member)(nil), // 0: onex.market.Member +} +var file_onex_market_member_proto_depIdxs = []int32{ + 0, // [0:0] is the sub-list for method output_type + 0, // [0:0] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_onex_market_member_proto_init() } +func file_onex_market_member_proto_init() { + if File_onex_market_member_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_onex_market_member_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Member); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_onex_market_member_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_onex_market_member_proto_goTypes, + DependencyIndexes: file_onex_market_member_proto_depIdxs, + MessageInfos: file_onex_market_member_proto_msgTypes, + }.Build() + File_onex_market_member_proto = out.File + file_onex_market_member_proto_rawDesc = nil + file_onex_market_member_proto_goTypes = nil + file_onex_market_member_proto_depIdxs = nil +} diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 90b475f..03d08c2 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -13156,42 +13156,6 @@ paths: description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - Msg - /onex/market/params: - get: - summary: Parameters queries the parameters of the module. - operationId: OnexMarketQuery_Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query /onex.market.Msg/CreatePool: post: operationId: OnexMarketMsg_CreatePool @@ -13286,6 +13250,42 @@ paths: description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - Msg + /onex/market/params: + get: + summary: Parameters queries the parameters of the module. + operationId: OnexMarketQuery_Params + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query definitions: cosmos.auth.v1beta1.MsgUpdateParams: type: object @@ -20421,16 +20421,6 @@ definitions: onex.denom.Params: type: object description: Params defines the parameters for the module. - onex.market.Params: - type: object - description: Params defines the parameters for the module. - onex.market.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. onex.market.MsgCreatePool: type: object properties: @@ -20459,3 +20449,13 @@ definitions: description: |- MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. + onex.market.Params: + type: object + description: Params defines the parameters for the module. + onex.market.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: QueryParamsResponse is response type for the Query/Params RPC method. diff --git a/proto/onex/market/member.proto b/proto/onex/market/member.proto new file mode 100644 index 0000000..7188cd5 --- /dev/null +++ b/proto/onex/market/member.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package onex.market; + +option go_package = "onex/x/market/types"; + +message Member { + + string pair = 1; + string denomA = 2; + string denomB = 3; + string balance = 4; + string previous = 5; + uint64 limit = 6; + uint64 stop = 7; +} diff --git a/x/market/types/member.pb.go b/x/market/types/member.pb.go new file mode 100644 index 0000000..4f6b6bd --- /dev/null +++ b/x/market/types/member.pb.go @@ -0,0 +1,592 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: onex/market/member.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/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 + +type Member struct { + Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` + DenomA string `protobuf:"bytes,2,opt,name=denomA,proto3" json:"denomA,omitempty"` + DenomB string `protobuf:"bytes,3,opt,name=denomB,proto3" json:"denomB,omitempty"` + Balance string `protobuf:"bytes,4,opt,name=balance,proto3" json:"balance,omitempty"` + Previous string `protobuf:"bytes,5,opt,name=previous,proto3" json:"previous,omitempty"` + Limit uint64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` + Stop uint64 `protobuf:"varint,7,opt,name=stop,proto3" json:"stop,omitempty"` +} + +func (m *Member) Reset() { *m = Member{} } +func (m *Member) String() string { return proto.CompactTextString(m) } +func (*Member) ProtoMessage() {} +func (*Member) Descriptor() ([]byte, []int) { + return fileDescriptor_8367e44475f24af7, []int{0} +} +func (m *Member) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Member) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Member.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 *Member) XXX_Merge(src proto.Message) { + xxx_messageInfo_Member.Merge(m, src) +} +func (m *Member) XXX_Size() int { + return m.Size() +} +func (m *Member) XXX_DiscardUnknown() { + xxx_messageInfo_Member.DiscardUnknown(m) +} + +var xxx_messageInfo_Member proto.InternalMessageInfo + +func (m *Member) GetPair() string { + if m != nil { + return m.Pair + } + return "" +} + +func (m *Member) GetDenomA() string { + if m != nil { + return m.DenomA + } + return "" +} + +func (m *Member) GetDenomB() string { + if m != nil { + return m.DenomB + } + return "" +} + +func (m *Member) GetBalance() string { + if m != nil { + return m.Balance + } + return "" +} + +func (m *Member) GetPrevious() string { + if m != nil { + return m.Previous + } + return "" +} + +func (m *Member) GetLimit() uint64 { + if m != nil { + return m.Limit + } + return 0 +} + +func (m *Member) GetStop() uint64 { + if m != nil { + return m.Stop + } + return 0 +} + +func init() { + proto.RegisterType((*Member)(nil), "onex.market.Member") +} + +func init() { proto.RegisterFile("onex/market/member.proto", fileDescriptor_8367e44475f24af7) } + +var fileDescriptor_8367e44475f24af7 = []byte{ + // 212 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8f, 0x31, 0x4e, 0x87, 0x30, + 0x14, 0x87, 0xa9, 0x42, 0xd1, 0xba, 0x55, 0x63, 0x5e, 0x1c, 0x1a, 0xe2, 0xc4, 0x22, 0x0c, 0x9e, + 0x40, 0x76, 0x17, 0x46, 0xb7, 0xa2, 0x6f, 0x68, 0xa4, 0xb4, 0x29, 0xd5, 0xe8, 0x2d, 0x3c, 0x88, + 0x07, 0x71, 0x64, 0x74, 0x34, 0x70, 0x11, 0xc3, 0x43, 0xc9, 0x7f, 0x7b, 0xdf, 0xf7, 0x2d, 0xef, + 0x27, 0xc0, 0x0d, 0xf8, 0x56, 0x5b, 0x1d, 0x9e, 0x31, 0xd6, 0x16, 0x6d, 0x87, 0xa1, 0xf2, 0xc1, + 0x45, 0x27, 0xcf, 0xd6, 0x52, 0x6d, 0xe5, 0xfa, 0x93, 0x09, 0x7e, 0x4f, 0x55, 0x4a, 0x91, 0x7a, + 0x6d, 0x02, 0xb0, 0x82, 0x95, 0xa7, 0x2d, 0xdd, 0xf2, 0x52, 0xf0, 0x27, 0x1c, 0x9c, 0xbd, 0x83, + 0x23, 0xb2, 0x7f, 0xb4, 0xfb, 0x06, 0x8e, 0x0f, 0x7c, 0x23, 0x41, 0xe4, 0x9d, 0xee, 0xf5, 0xf0, + 0x88, 0x90, 0x52, 0xf8, 0x47, 0x79, 0x25, 0x4e, 0x7c, 0xc0, 0x57, 0xe3, 0x5e, 0x46, 0xc8, 0x28, + 0xed, 0x2c, 0x2f, 0x44, 0xd6, 0x1b, 0x6b, 0x22, 0xf0, 0x82, 0x95, 0x69, 0xbb, 0xc1, 0xfa, 0xcf, + 0x18, 0x9d, 0x87, 0x9c, 0x24, 0xdd, 0xcd, 0xcd, 0xd7, 0xac, 0xd8, 0x34, 0x2b, 0xf6, 0x33, 0x2b, + 0xf6, 0xb1, 0xa8, 0x64, 0x5a, 0x54, 0xf2, 0xbd, 0xa8, 0xe4, 0xe1, 0x9c, 0xf6, 0xee, 0x8b, 0xe3, + 0xbb, 0xc7, 0xb1, 0xe3, 0xb4, 0xf8, 0xf6, 0x37, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x96, 0x02, 0x95, + 0x0d, 0x01, 0x00, 0x00, +} + +func (m *Member) 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 *Member) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Member) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Stop != 0 { + i = encodeVarintMember(dAtA, i, uint64(m.Stop)) + i-- + dAtA[i] = 0x38 + } + if m.Limit != 0 { + i = encodeVarintMember(dAtA, i, uint64(m.Limit)) + i-- + dAtA[i] = 0x30 + } + if len(m.Previous) > 0 { + i -= len(m.Previous) + copy(dAtA[i:], m.Previous) + i = encodeVarintMember(dAtA, i, uint64(len(m.Previous))) + i-- + dAtA[i] = 0x2a + } + if len(m.Balance) > 0 { + i -= len(m.Balance) + copy(dAtA[i:], m.Balance) + i = encodeVarintMember(dAtA, i, uint64(len(m.Balance))) + i-- + dAtA[i] = 0x22 + } + if len(m.DenomB) > 0 { + i -= len(m.DenomB) + copy(dAtA[i:], m.DenomB) + i = encodeVarintMember(dAtA, i, uint64(len(m.DenomB))) + i-- + dAtA[i] = 0x1a + } + if len(m.DenomA) > 0 { + i -= len(m.DenomA) + copy(dAtA[i:], m.DenomA) + i = encodeVarintMember(dAtA, i, uint64(len(m.DenomA))) + i-- + dAtA[i] = 0x12 + } + if len(m.Pair) > 0 { + i -= len(m.Pair) + copy(dAtA[i:], m.Pair) + i = encodeVarintMember(dAtA, i, uint64(len(m.Pair))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintMember(dAtA []byte, offset int, v uint64) int { + offset -= sovMember(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Member) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Pair) + if l > 0 { + n += 1 + l + sovMember(uint64(l)) + } + l = len(m.DenomA) + if l > 0 { + n += 1 + l + sovMember(uint64(l)) + } + l = len(m.DenomB) + if l > 0 { + n += 1 + l + sovMember(uint64(l)) + } + l = len(m.Balance) + if l > 0 { + n += 1 + l + sovMember(uint64(l)) + } + l = len(m.Previous) + if l > 0 { + n += 1 + l + sovMember(uint64(l)) + } + if m.Limit != 0 { + n += 1 + sovMember(uint64(m.Limit)) + } + if m.Stop != 0 { + n += 1 + sovMember(uint64(m.Stop)) + } + return n +} + +func sovMember(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMember(x uint64) (n int) { + return sovMember(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Member) 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 ErrIntOverflowMember + } + 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: Member: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Member: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pair", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMember + } + 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 ErrInvalidLengthMember + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMember + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pair = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomA", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMember + } + 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 ErrInvalidLengthMember + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMember + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomA = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomB", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMember + } + 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 ErrInvalidLengthMember + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMember + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomB = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 ErrIntOverflowMember + } + 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 ErrInvalidLengthMember + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMember + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Balance = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Previous", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMember + } + 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 ErrInvalidLengthMember + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMember + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Previous = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) + } + m.Limit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMember + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Limit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Stop", wireType) + } + m.Stop = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMember + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Stop |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMember(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMember + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMember(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, ErrIntOverflowMember + } + 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, ErrIntOverflowMember + } + 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, ErrIntOverflowMember + } + 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, ErrInvalidLengthMember + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMember + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMember + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMember = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMember = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMember = fmt.Errorf("proto: unexpected end of group") +) From e8fb9c4c6bccca7562abff44120fe340e996556e Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Wed, 17 Apr 2024 21:51:44 -0500 Subject: [PATCH 3/8] Add member key and SetMember func --- x/market/keeper/member.go | 27 +++++++++++++++++++++++ x/market/keeper/msg_server_create_pool.go | 8 +++++++ x/market/types/key_member.go | 24 ++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 x/market/keeper/member.go create mode 100644 x/market/types/key_member.go diff --git a/x/market/keeper/member.go b/x/market/keeper/member.go new file mode 100644 index 0000000..315641f --- /dev/null +++ b/x/market/keeper/member.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/runtime" + + "context" + "onex/x/market/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetMember( + ctx context.Context, + denomA string, + denomB string, +) (member types.Member, found bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.MemberKey( + denomA, + denomB, + )) + if bz == nil { + return member, false + } + + k.cdc.MustUnmarshal(bz, &member) + return member, true +} diff --git a/x/market/keeper/msg_server_create_pool.go b/x/market/keeper/msg_server_create_pool.go index 7f148e7..77e6ba9 100644 --- a/x/market/keeper/msg_server_create_pool.go +++ b/x/market/keeper/msg_server_create_pool.go @@ -31,6 +31,14 @@ func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) ( denom2 := coinPair.GetDenomByIndex(1) pair := strings.Join([]string{denom1, denom2}, ",") + // Test if pool either exists and active or exists and inactive + // Inactive pool will be dry or have no drops + member1, _ := k.GetMember(ctx, denom2, denom1) + + member2, _ := k.GetMember(ctx, denom1, denom2) + + _ = member1 + _ = member2 _ = pair _ = ctx diff --git a/x/market/types/key_member.go b/x/market/types/key_member.go new file mode 100644 index 0000000..cd41a6f --- /dev/null +++ b/x/market/types/key_member.go @@ -0,0 +1,24 @@ +package types + +const ( + // MemberKeyPrefix is the prefix to retrieve all Member + MemberKeyPrefix = "Member/value/" +) + +// MemberKey returns the store key to retrieve a Member from the index fields +func MemberKey( + denomA string, + denomB string, +) []byte { + var key []byte + + denomABytes := []byte(denomA) + key = append(key, denomABytes...) + key = append(key, []byte("/")...) + + denomBBytes := []byte(denomB) + key = append(key, denomBBytes...) + key = append(key, []byte("/")...) + + return key +} From edc3a6eaef37e147784bd3567c1cb8803c83b792 Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Thu, 18 Apr 2024 02:41:12 -0500 Subject: [PATCH 4/8] Add pool proto types --- api/onex/market/pool.pulsar.go | 2277 ++++++++++++++++++++++++++++++++ go.mod | 2 +- proto/onex/market/pool.proto | 42 + x/market/types/pool.pb.go | 1133 ++++++++++++++++ 4 files changed, 3453 insertions(+), 1 deletion(-) create mode 100644 api/onex/market/pool.pulsar.go create mode 100644 proto/onex/market/pool.proto create mode 100644 x/market/types/pool.pb.go diff --git a/api/onex/market/pool.pulsar.go b/api/onex/market/pool.pulsar.go new file mode 100644 index 0000000..40beef3 --- /dev/null +++ b/api/onex/market/pool.pulsar.go @@ -0,0 +1,2277 @@ +// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. +package market + +import ( + _ "cosmossdk.io/api/amino" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoiface "google.golang.org/protobuf/runtime/protoiface" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + io "io" + reflect "reflect" + sync "sync" +) + +var _ protoreflect.List = (*_Pool_6_list)(nil) + +type _Pool_6_list struct { + list *[]*Leader +} + +func (x *_Pool_6_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Pool_6_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_Pool_6_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Leader) + (*x.list)[i] = concreteValue +} + +func (x *_Pool_6_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Leader) + *x.list = append(*x.list, concreteValue) +} + +func (x *_Pool_6_list) AppendMutable() protoreflect.Value { + v := new(Leader) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Pool_6_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_Pool_6_list) NewElement() protoreflect.Value { + v := new(Leader) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Pool_6_list) IsValid() bool { + return x.list != nil +} + +var ( + md_Pool protoreflect.MessageDescriptor + fd_Pool_pair protoreflect.FieldDescriptor + fd_Pool_denom1 protoreflect.FieldDescriptor + fd_Pool_denom2 protoreflect.FieldDescriptor + fd_Pool_volume1 protoreflect.FieldDescriptor + fd_Pool_volume2 protoreflect.FieldDescriptor + fd_Pool_leaders protoreflect.FieldDescriptor + fd_Pool_drops protoreflect.FieldDescriptor + fd_Pool_history protoreflect.FieldDescriptor +) + +func init() { + file_onex_market_pool_proto_init() + md_Pool = File_onex_market_pool_proto.Messages().ByName("Pool") + fd_Pool_pair = md_Pool.Fields().ByName("pair") + fd_Pool_denom1 = md_Pool.Fields().ByName("denom1") + fd_Pool_denom2 = md_Pool.Fields().ByName("denom2") + fd_Pool_volume1 = md_Pool.Fields().ByName("volume1") + fd_Pool_volume2 = md_Pool.Fields().ByName("volume2") + fd_Pool_leaders = md_Pool.Fields().ByName("leaders") + fd_Pool_drops = md_Pool.Fields().ByName("drops") + fd_Pool_history = md_Pool.Fields().ByName("history") +} + +var _ protoreflect.Message = (*fastReflection_Pool)(nil) + +type fastReflection_Pool Pool + +func (x *Pool) ProtoReflect() protoreflect.Message { + return (*fastReflection_Pool)(x) +} + +func (x *Pool) slowProtoReflect() protoreflect.Message { + mi := &file_onex_market_pool_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Pool_messageType fastReflection_Pool_messageType +var _ protoreflect.MessageType = fastReflection_Pool_messageType{} + +type fastReflection_Pool_messageType struct{} + +func (x fastReflection_Pool_messageType) Zero() protoreflect.Message { + return (*fastReflection_Pool)(nil) +} +func (x fastReflection_Pool_messageType) New() protoreflect.Message { + return new(fastReflection_Pool) +} +func (x fastReflection_Pool_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Pool +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Pool) Descriptor() protoreflect.MessageDescriptor { + return md_Pool +} + +// 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_Pool) Type() protoreflect.MessageType { + return _fastReflection_Pool_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Pool) New() protoreflect.Message { + return new(fastReflection_Pool) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Pool) Interface() protoreflect.ProtoMessage { + return (*Pool)(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_Pool) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Pair != "" { + value := protoreflect.ValueOfString(x.Pair) + if !f(fd_Pool_pair, value) { + return + } + } + if x.Denom1 != "" { + value := protoreflect.ValueOfString(x.Denom1) + if !f(fd_Pool_denom1, value) { + return + } + } + if x.Denom2 != "" { + value := protoreflect.ValueOfString(x.Denom2) + if !f(fd_Pool_denom2, value) { + return + } + } + if x.Volume1 != nil { + value := protoreflect.ValueOfMessage(x.Volume1.ProtoReflect()) + if !f(fd_Pool_volume1, value) { + return + } + } + if x.Volume2 != nil { + value := protoreflect.ValueOfMessage(x.Volume2.ProtoReflect()) + if !f(fd_Pool_volume2, value) { + return + } + } + if len(x.Leaders) != 0 { + value := protoreflect.ValueOfList(&_Pool_6_list{list: &x.Leaders}) + if !f(fd_Pool_leaders, value) { + return + } + } + if x.Drops != "" { + value := protoreflect.ValueOfString(x.Drops) + if !f(fd_Pool_drops, value) { + return + } + } + if x.History != uint64(0) { + value := protoreflect.ValueOfUint64(x.History) + if !f(fd_Pool_history, 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_Pool) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "onex.market.Pool.pair": + return x.Pair != "" + case "onex.market.Pool.denom1": + return x.Denom1 != "" + case "onex.market.Pool.denom2": + return x.Denom2 != "" + case "onex.market.Pool.volume1": + return x.Volume1 != nil + case "onex.market.Pool.volume2": + return x.Volume2 != nil + case "onex.market.Pool.leaders": + return len(x.Leaders) != 0 + case "onex.market.Pool.drops": + return x.Drops != "" + case "onex.market.Pool.history": + return x.History != uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Pool")) + } + panic(fmt.Errorf("message onex.market.Pool 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_Pool) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "onex.market.Pool.pair": + x.Pair = "" + case "onex.market.Pool.denom1": + x.Denom1 = "" + case "onex.market.Pool.denom2": + x.Denom2 = "" + case "onex.market.Pool.volume1": + x.Volume1 = nil + case "onex.market.Pool.volume2": + x.Volume2 = nil + case "onex.market.Pool.leaders": + x.Leaders = nil + case "onex.market.Pool.drops": + x.Drops = "" + case "onex.market.Pool.history": + x.History = uint64(0) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Pool")) + } + panic(fmt.Errorf("message onex.market.Pool 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_Pool) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "onex.market.Pool.pair": + value := x.Pair + return protoreflect.ValueOfString(value) + case "onex.market.Pool.denom1": + value := x.Denom1 + return protoreflect.ValueOfString(value) + case "onex.market.Pool.denom2": + value := x.Denom2 + return protoreflect.ValueOfString(value) + case "onex.market.Pool.volume1": + value := x.Volume1 + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "onex.market.Pool.volume2": + value := x.Volume2 + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "onex.market.Pool.leaders": + if len(x.Leaders) == 0 { + return protoreflect.ValueOfList(&_Pool_6_list{}) + } + listValue := &_Pool_6_list{list: &x.Leaders} + return protoreflect.ValueOfList(listValue) + case "onex.market.Pool.drops": + value := x.Drops + return protoreflect.ValueOfString(value) + case "onex.market.Pool.history": + value := x.History + return protoreflect.ValueOfUint64(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Pool")) + } + panic(fmt.Errorf("message onex.market.Pool 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_Pool) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "onex.market.Pool.pair": + x.Pair = value.Interface().(string) + case "onex.market.Pool.denom1": + x.Denom1 = value.Interface().(string) + case "onex.market.Pool.denom2": + x.Denom2 = value.Interface().(string) + case "onex.market.Pool.volume1": + x.Volume1 = value.Message().Interface().(*Volume) + case "onex.market.Pool.volume2": + x.Volume2 = value.Message().Interface().(*Volume) + case "onex.market.Pool.leaders": + lv := value.List() + clv := lv.(*_Pool_6_list) + x.Leaders = *clv.list + case "onex.market.Pool.drops": + x.Drops = value.Interface().(string) + case "onex.market.Pool.history": + x.History = value.Uint() + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Pool")) + } + panic(fmt.Errorf("message onex.market.Pool 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_Pool) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.Pool.volume1": + if x.Volume1 == nil { + x.Volume1 = new(Volume) + } + return protoreflect.ValueOfMessage(x.Volume1.ProtoReflect()) + case "onex.market.Pool.volume2": + if x.Volume2 == nil { + x.Volume2 = new(Volume) + } + return protoreflect.ValueOfMessage(x.Volume2.ProtoReflect()) + case "onex.market.Pool.leaders": + if x.Leaders == nil { + x.Leaders = []*Leader{} + } + value := &_Pool_6_list{list: &x.Leaders} + return protoreflect.ValueOfList(value) + case "onex.market.Pool.pair": + panic(fmt.Errorf("field pair of message onex.market.Pool is not mutable")) + case "onex.market.Pool.denom1": + panic(fmt.Errorf("field denom1 of message onex.market.Pool is not mutable")) + case "onex.market.Pool.denom2": + panic(fmt.Errorf("field denom2 of message onex.market.Pool is not mutable")) + case "onex.market.Pool.drops": + panic(fmt.Errorf("field drops of message onex.market.Pool is not mutable")) + case "onex.market.Pool.history": + panic(fmt.Errorf("field history of message onex.market.Pool is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Pool")) + } + panic(fmt.Errorf("message onex.market.Pool 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_Pool) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.Pool.pair": + return protoreflect.ValueOfString("") + case "onex.market.Pool.denom1": + return protoreflect.ValueOfString("") + case "onex.market.Pool.denom2": + return protoreflect.ValueOfString("") + case "onex.market.Pool.volume1": + m := new(Volume) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "onex.market.Pool.volume2": + m := new(Volume) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "onex.market.Pool.leaders": + list := []*Leader{} + return protoreflect.ValueOfList(&_Pool_6_list{list: &list}) + case "onex.market.Pool.drops": + return protoreflect.ValueOfString("") + case "onex.market.Pool.history": + return protoreflect.ValueOfUint64(uint64(0)) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Pool")) + } + panic(fmt.Errorf("message onex.market.Pool 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_Pool) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in onex.market.Pool", 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_Pool) 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_Pool) 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_Pool) 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_Pool) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Pool) + 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.Pair) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Denom1) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Denom2) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Volume1 != nil { + l = options.Size(x.Volume1) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Volume2 != nil { + l = options.Size(x.Volume2) + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.Leaders) > 0 { + for _, e := range x.Leaders { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + l = len(x.Drops) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.History != 0 { + n += 1 + runtime.Sov(uint64(x.History)) + } + 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().(*Pool) + 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.History != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.History)) + i-- + dAtA[i] = 0x40 + } + if len(x.Drops) > 0 { + i -= len(x.Drops) + copy(dAtA[i:], x.Drops) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Drops))) + i-- + dAtA[i] = 0x3a + } + if len(x.Leaders) > 0 { + for iNdEx := len(x.Leaders) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.Leaders[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x32 + } + } + if x.Volume2 != nil { + encoded, err := options.Marshal(x.Volume2) + 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] = 0x2a + } + if x.Volume1 != nil { + encoded, err := options.Marshal(x.Volume1) + 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] = 0x22 + } + if len(x.Denom2) > 0 { + i -= len(x.Denom2) + copy(dAtA[i:], x.Denom2) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom2))) + i-- + dAtA[i] = 0x1a + } + if len(x.Denom1) > 0 { + i -= len(x.Denom1) + copy(dAtA[i:], x.Denom1) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom1))) + i-- + dAtA[i] = 0x12 + } + if len(x.Pair) > 0 { + i -= len(x.Pair) + copy(dAtA[i:], x.Pair) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Pair))) + 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().(*Pool) + 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: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Pool: 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 Pair", 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.Pair = 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 Denom1", 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.Denom1 = 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 Denom2", 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.Denom2 = string(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 Volume1", 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.Volume1 == nil { + x.Volume1 = &Volume{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Volume1); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Volume2", 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.Volume2 == nil { + x.Volume2 = &Volume{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Volume2); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Leaders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Leaders = append(x.Leaders, &Leader{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Leaders[len(x.Leaders)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Drops", 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.Drops = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field History", wireType) + } + x.History = 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.History |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_Leader protoreflect.MessageDescriptor + fd_Leader_address protoreflect.FieldDescriptor + fd_Leader_drops protoreflect.FieldDescriptor +) + +func init() { + file_onex_market_pool_proto_init() + md_Leader = File_onex_market_pool_proto.Messages().ByName("Leader") + fd_Leader_address = md_Leader.Fields().ByName("address") + fd_Leader_drops = md_Leader.Fields().ByName("drops") +} + +var _ protoreflect.Message = (*fastReflection_Leader)(nil) + +type fastReflection_Leader Leader + +func (x *Leader) ProtoReflect() protoreflect.Message { + return (*fastReflection_Leader)(x) +} + +func (x *Leader) slowProtoReflect() protoreflect.Message { + mi := &file_onex_market_pool_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_Leader_messageType fastReflection_Leader_messageType +var _ protoreflect.MessageType = fastReflection_Leader_messageType{} + +type fastReflection_Leader_messageType struct{} + +func (x fastReflection_Leader_messageType) Zero() protoreflect.Message { + return (*fastReflection_Leader)(nil) +} +func (x fastReflection_Leader_messageType) New() protoreflect.Message { + return new(fastReflection_Leader) +} +func (x fastReflection_Leader_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Leader +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Leader) Descriptor() protoreflect.MessageDescriptor { + return md_Leader +} + +// 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_Leader) Type() protoreflect.MessageType { + return _fastReflection_Leader_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Leader) New() protoreflect.Message { + return new(fastReflection_Leader) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Leader) Interface() protoreflect.ProtoMessage { + return (*Leader)(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_Leader) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Address != "" { + value := protoreflect.ValueOfString(x.Address) + if !f(fd_Leader_address, value) { + return + } + } + if x.Drops != "" { + value := protoreflect.ValueOfString(x.Drops) + if !f(fd_Leader_drops, 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_Leader) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "onex.market.Leader.address": + return x.Address != "" + case "onex.market.Leader.drops": + return x.Drops != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Leader")) + } + panic(fmt.Errorf("message onex.market.Leader 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_Leader) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "onex.market.Leader.address": + x.Address = "" + case "onex.market.Leader.drops": + x.Drops = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Leader")) + } + panic(fmt.Errorf("message onex.market.Leader 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_Leader) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "onex.market.Leader.address": + value := x.Address + return protoreflect.ValueOfString(value) + case "onex.market.Leader.drops": + value := x.Drops + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Leader")) + } + panic(fmt.Errorf("message onex.market.Leader 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_Leader) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "onex.market.Leader.address": + x.Address = value.Interface().(string) + case "onex.market.Leader.drops": + x.Drops = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Leader")) + } + panic(fmt.Errorf("message onex.market.Leader 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_Leader) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.Leader.address": + panic(fmt.Errorf("field address of message onex.market.Leader is not mutable")) + case "onex.market.Leader.drops": + panic(fmt.Errorf("field drops of message onex.market.Leader is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Leader")) + } + panic(fmt.Errorf("message onex.market.Leader 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_Leader) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.Leader.address": + return protoreflect.ValueOfString("") + case "onex.market.Leader.drops": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Leader")) + } + panic(fmt.Errorf("message onex.market.Leader 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_Leader) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in onex.market.Leader", 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_Leader) 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_Leader) 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_Leader) 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_Leader) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Leader) + 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.Address) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Drops) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Leader) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Drops) > 0 { + i -= len(x.Drops) + copy(dAtA[i:], x.Drops) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Drops))) + i-- + dAtA[i] = 0x3a + } + if len(x.Address) > 0 { + i -= len(x.Address) + copy(dAtA[i:], x.Address) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Address))) + 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().(*Leader) + 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: Leader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Leader: 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 Address", 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Drops", 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.Drops = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_Volume protoreflect.MessageDescriptor + fd_Volume_denom protoreflect.FieldDescriptor + fd_Volume_amount protoreflect.FieldDescriptor +) + +func init() { + file_onex_market_pool_proto_init() + md_Volume = File_onex_market_pool_proto.Messages().ByName("Volume") + fd_Volume_denom = md_Volume.Fields().ByName("denom") + fd_Volume_amount = md_Volume.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_Volume)(nil) + +type fastReflection_Volume Volume + +func (x *Volume) ProtoReflect() protoreflect.Message { + return (*fastReflection_Volume)(x) +} + +func (x *Volume) slowProtoReflect() protoreflect.Message { + mi := &file_onex_market_pool_proto_msgTypes[2] + 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_Volume_messageType fastReflection_Volume_messageType +var _ protoreflect.MessageType = fastReflection_Volume_messageType{} + +type fastReflection_Volume_messageType struct{} + +func (x fastReflection_Volume_messageType) Zero() protoreflect.Message { + return (*fastReflection_Volume)(nil) +} +func (x fastReflection_Volume_messageType) New() protoreflect.Message { + return new(fastReflection_Volume) +} +func (x fastReflection_Volume_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Volume +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_Volume) Descriptor() protoreflect.MessageDescriptor { + return md_Volume +} + +// 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_Volume) Type() protoreflect.MessageType { + return _fastReflection_Volume_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_Volume) New() protoreflect.Message { + return new(fastReflection_Volume) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_Volume) Interface() protoreflect.ProtoMessage { + return (*Volume)(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_Volume) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Denom != "" { + value := protoreflect.ValueOfString(x.Denom) + if !f(fd_Volume_denom, value) { + return + } + } + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) + if !f(fd_Volume_amount, 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_Volume) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "onex.market.Volume.denom": + return x.Denom != "" + case "onex.market.Volume.amount": + return x.Amount != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Volume")) + } + panic(fmt.Errorf("message onex.market.Volume 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_Volume) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "onex.market.Volume.denom": + x.Denom = "" + case "onex.market.Volume.amount": + x.Amount = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Volume")) + } + panic(fmt.Errorf("message onex.market.Volume 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_Volume) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "onex.market.Volume.denom": + value := x.Denom + return protoreflect.ValueOfString(value) + case "onex.market.Volume.amount": + value := x.Amount + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Volume")) + } + panic(fmt.Errorf("message onex.market.Volume 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_Volume) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "onex.market.Volume.denom": + x.Denom = value.Interface().(string) + case "onex.market.Volume.amount": + x.Amount = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Volume")) + } + panic(fmt.Errorf("message onex.market.Volume 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_Volume) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.Volume.denom": + panic(fmt.Errorf("field denom of message onex.market.Volume is not mutable")) + case "onex.market.Volume.amount": + panic(fmt.Errorf("field amount of message onex.market.Volume is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Volume")) + } + panic(fmt.Errorf("message onex.market.Volume 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_Volume) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.Volume.denom": + return protoreflect.ValueOfString("") + case "onex.market.Volume.amount": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.Volume")) + } + panic(fmt.Errorf("message onex.market.Volume 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_Volume) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in onex.market.Volume", 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_Volume) 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_Volume) 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_Volume) 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_Volume) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*Volume) + 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.Denom) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Amount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*Volume) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Amount) > 0 { + i -= len(x.Amount) + copy(dAtA[i:], x.Amount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) + i-- + dAtA[i] = 0x12 + } + if len(x.Denom) > 0 { + i -= len(x.Denom) + copy(dAtA[i:], x.Denom) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Denom))) + i-- + dAtA[i] = 0xa + } + if 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().(*Volume) + 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: Volume: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Volume: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + 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.Denom = 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 Amount", 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.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.0 +// protoc (unknown) +// source: onex/market/pool.proto + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Pool struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` + Denom1 string `protobuf:"bytes,2,opt,name=denom1,proto3" json:"denom1,omitempty"` + Denom2 string `protobuf:"bytes,3,opt,name=denom2,proto3" json:"denom2,omitempty"` + Volume1 *Volume `protobuf:"bytes,4,opt,name=volume1,proto3" json:"volume1,omitempty"` + Volume2 *Volume `protobuf:"bytes,5,opt,name=volume2,proto3" json:"volume2,omitempty"` + Leaders []*Leader `protobuf:"bytes,6,rep,name=leaders,proto3" json:"leaders,omitempty"` + // Pool liquidity + Drops string `protobuf:"bytes,7,opt,name=drops,proto3" json:"drops,omitempty"` + History uint64 `protobuf:"varint,8,opt,name=history,proto3" json:"history,omitempty"` +} + +func (x *Pool) Reset() { + *x = Pool{} + if protoimpl.UnsafeEnabled { + mi := &file_onex_market_pool_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Pool) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Pool) ProtoMessage() {} + +// Deprecated: Use Pool.ProtoReflect.Descriptor instead. +func (*Pool) Descriptor() ([]byte, []int) { + return file_onex_market_pool_proto_rawDescGZIP(), []int{0} +} + +func (x *Pool) GetPair() string { + if x != nil { + return x.Pair + } + return "" +} + +func (x *Pool) GetDenom1() string { + if x != nil { + return x.Denom1 + } + return "" +} + +func (x *Pool) GetDenom2() string { + if x != nil { + return x.Denom2 + } + return "" +} + +func (x *Pool) GetVolume1() *Volume { + if x != nil { + return x.Volume1 + } + return nil +} + +func (x *Pool) GetVolume2() *Volume { + if x != nil { + return x.Volume2 + } + return nil +} + +func (x *Pool) GetLeaders() []*Leader { + if x != nil { + return x.Leaders + } + return nil +} + +func (x *Pool) GetDrops() string { + if x != nil { + return x.Drops + } + return "" +} + +func (x *Pool) GetHistory() uint64 { + if x != nil { + return x.History + } + return 0 +} + +type Leader struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Pool liquidity + Drops string `protobuf:"bytes,7,opt,name=drops,proto3" json:"drops,omitempty"` +} + +func (x *Leader) Reset() { + *x = Leader{} + if protoimpl.UnsafeEnabled { + mi := &file_onex_market_pool_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Leader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Leader) ProtoMessage() {} + +// Deprecated: Use Leader.ProtoReflect.Descriptor instead. +func (*Leader) Descriptor() ([]byte, []int) { + return file_onex_market_pool_proto_rawDescGZIP(), []int{1} +} + +func (x *Leader) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *Leader) GetDrops() string { + if x != nil { + return x.Drops + } + return "" +} + +type Volume struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *Volume) Reset() { + *x = Volume{} + if protoimpl.UnsafeEnabled { + mi := &file_onex_market_pool_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Volume) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Volume) ProtoMessage() {} + +// Deprecated: Use Volume.ProtoReflect.Descriptor instead. +func (*Volume) Descriptor() ([]byte, []int) { + return file_onex_market_pool_proto_rawDescGZIP(), []int{2} +} + +func (x *Volume) GetDenom() string { + if x != nil { + return x.Denom + } + return "" +} + +func (x *Volume) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +var File_onex_market_pool_proto protoreflect.FileDescriptor + +var file_onex_market_pool_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x6f, 0x6e, 0x65, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x70, 0x6f, + 0x6f, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, + 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb4, 0x02, 0x0a, 0x04, 0x50, 0x6f, + 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x31, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x31, 0x12, 0x16, + 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x32, 0x12, 0x2d, 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, + 0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x07, 0x76, 0x6f, + 0x6c, 0x75, 0x6d, 0x65, 0x31, 0x12, 0x2d, 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x32, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x07, 0x76, 0x6f, 0x6c, + 0x75, 0x6d, 0x65, 0x32, 0x12, 0x2d, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, + 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x2e, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, + 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, + 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, + 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, + 0x22, 0x65, 0x0a, 0x06, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, + 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, + 0x52, 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x22, 0x63, 0x0a, 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, + 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, + 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x87, 0x01, 0x0a, + 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x42, 0x09, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1c, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x6f, 0x6e, 0x65, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xa2, 0x02, 0x03, 0x4f, 0x4d, + 0x58, 0xaa, 0x02, 0x0b, 0x4f, 0x6e, 0x65, 0x78, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xca, + 0x02, 0x0b, 0x4f, 0x6e, 0x65, 0x78, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xe2, 0x02, 0x17, + 0x4f, 0x6e, 0x65, 0x78, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4f, 0x6e, 0x65, 0x78, 0x3a, 0x3a, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_onex_market_pool_proto_rawDescOnce sync.Once + file_onex_market_pool_proto_rawDescData = file_onex_market_pool_proto_rawDesc +) + +func file_onex_market_pool_proto_rawDescGZIP() []byte { + file_onex_market_pool_proto_rawDescOnce.Do(func() { + file_onex_market_pool_proto_rawDescData = protoimpl.X.CompressGZIP(file_onex_market_pool_proto_rawDescData) + }) + return file_onex_market_pool_proto_rawDescData +} + +var file_onex_market_pool_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_onex_market_pool_proto_goTypes = []interface{}{ + (*Pool)(nil), // 0: onex.market.Pool + (*Leader)(nil), // 1: onex.market.Leader + (*Volume)(nil), // 2: onex.market.Volume +} +var file_onex_market_pool_proto_depIdxs = []int32{ + 2, // 0: onex.market.Pool.volume1:type_name -> onex.market.Volume + 2, // 1: onex.market.Pool.volume2:type_name -> onex.market.Volume + 1, // 2: onex.market.Pool.leaders:type_name -> onex.market.Leader + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_onex_market_pool_proto_init() } +func file_onex_market_pool_proto_init() { + if File_onex_market_pool_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_onex_market_pool_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Pool); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_onex_market_pool_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Leader); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_onex_market_pool_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Volume); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_onex_market_pool_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_onex_market_pool_proto_goTypes, + DependencyIndexes: file_onex_market_pool_proto_depIdxs, + MessageInfos: file_onex_market_pool_proto_msgTypes, + }.Build() + File_onex_market_pool_proto = out.File + file_onex_market_pool_proto_rawDesc = nil + file_onex_market_pool_proto_goTypes = nil + file_onex_market_pool_proto_depIdxs = nil +} diff --git a/go.mod b/go.mod index c3bb292..a839ff4 100644 --- a/go.mod +++ b/go.mod @@ -16,6 +16,7 @@ require ( cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.3.1 + cosmossdk.io/math v1.3.0 cosmossdk.io/store v1.0.2 cosmossdk.io/tools/confix v0.1.1 cosmossdk.io/x/circuit v0.1.0 @@ -57,7 +58,6 @@ require ( connectrpc.com/connect v1.15.0 // indirect connectrpc.com/otelconnect v0.7.0 // indirect cosmossdk.io/collections v0.4.0 // indirect - cosmossdk.io/math v1.3.0 // indirect cosmossdk.io/x/tx v0.13.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect diff --git a/proto/onex/market/pool.proto b/proto/onex/market/pool.proto new file mode 100644 index 0000000..067fd70 --- /dev/null +++ b/proto/onex/market/pool.proto @@ -0,0 +1,42 @@ +syntax = "proto3"; +package onex.market; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; + +option go_package = "onex/x/market/types"; + +message Pool { + string pair = 1; + string denom1 = 2; + string denom2 = 3; + Volume volume1 = 4; + Volume volume2 = 5; + repeated Leader leaders = 6; + // Pool liquidity + string drops = 7 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + uint64 history = 8; +} + +message Leader { + string address = 1; + // Pool liquidity + string drops = 7 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} + +message Volume { + string denom = 1; + string amount = 2 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; +} diff --git a/x/market/types/pool.pb.go b/x/market/types/pool.pb.go new file mode 100644 index 0000000..873a648 --- /dev/null +++ b/x/market/types/pool.pb.go @@ -0,0 +1,1133 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: onex/market/pool.proto + +package types + +import ( + cosmossdk_io_math "cosmossdk.io/math" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/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 + +type Pool struct { + Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` + Denom1 string `protobuf:"bytes,2,opt,name=denom1,proto3" json:"denom1,omitempty"` + Denom2 string `protobuf:"bytes,3,opt,name=denom2,proto3" json:"denom2,omitempty"` + Volume1 *Volume `protobuf:"bytes,4,opt,name=volume1,proto3" json:"volume1,omitempty"` + Volume2 *Volume `protobuf:"bytes,5,opt,name=volume2,proto3" json:"volume2,omitempty"` + Leaders []*Leader `protobuf:"bytes,6,rep,name=leaders,proto3" json:"leaders,omitempty"` + // Pool liquidity + Drops cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=drops,proto3,customtype=cosmossdk.io/math.Int" json:"drops"` + History uint64 `protobuf:"varint,8,opt,name=history,proto3" json:"history,omitempty"` +} + +func (m *Pool) Reset() { *m = Pool{} } +func (m *Pool) String() string { return proto.CompactTextString(m) } +func (*Pool) ProtoMessage() {} +func (*Pool) Descriptor() ([]byte, []int) { + return fileDescriptor_a75aff76c4a68782, []int{0} +} +func (m *Pool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Pool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Pool.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 *Pool) XXX_Merge(src proto.Message) { + xxx_messageInfo_Pool.Merge(m, src) +} +func (m *Pool) XXX_Size() int { + return m.Size() +} +func (m *Pool) XXX_DiscardUnknown() { + xxx_messageInfo_Pool.DiscardUnknown(m) +} + +var xxx_messageInfo_Pool proto.InternalMessageInfo + +func (m *Pool) GetPair() string { + if m != nil { + return m.Pair + } + return "" +} + +func (m *Pool) GetDenom1() string { + if m != nil { + return m.Denom1 + } + return "" +} + +func (m *Pool) GetDenom2() string { + if m != nil { + return m.Denom2 + } + return "" +} + +func (m *Pool) GetVolume1() *Volume { + if m != nil { + return m.Volume1 + } + return nil +} + +func (m *Pool) GetVolume2() *Volume { + if m != nil { + return m.Volume2 + } + return nil +} + +func (m *Pool) GetLeaders() []*Leader { + if m != nil { + return m.Leaders + } + return nil +} + +func (m *Pool) GetHistory() uint64 { + if m != nil { + return m.History + } + return 0 +} + +type Leader struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // Pool liquidity + Drops cosmossdk_io_math.Int `protobuf:"bytes,7,opt,name=drops,proto3,customtype=cosmossdk.io/math.Int" json:"drops"` +} + +func (m *Leader) Reset() { *m = Leader{} } +func (m *Leader) String() string { return proto.CompactTextString(m) } +func (*Leader) ProtoMessage() {} +func (*Leader) Descriptor() ([]byte, []int) { + return fileDescriptor_a75aff76c4a68782, []int{1} +} +func (m *Leader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Leader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Leader.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 *Leader) XXX_Merge(src proto.Message) { + xxx_messageInfo_Leader.Merge(m, src) +} +func (m *Leader) XXX_Size() int { + return m.Size() +} +func (m *Leader) XXX_DiscardUnknown() { + xxx_messageInfo_Leader.DiscardUnknown(m) +} + +var xxx_messageInfo_Leader proto.InternalMessageInfo + +func (m *Leader) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +type Volume struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` +} + +func (m *Volume) Reset() { *m = Volume{} } +func (m *Volume) String() string { return proto.CompactTextString(m) } +func (*Volume) ProtoMessage() {} +func (*Volume) Descriptor() ([]byte, []int) { + return fileDescriptor_a75aff76c4a68782, []int{2} +} +func (m *Volume) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Volume) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Volume.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 *Volume) XXX_Merge(src proto.Message) { + xxx_messageInfo_Volume.Merge(m, src) +} +func (m *Volume) XXX_Size() int { + return m.Size() +} +func (m *Volume) XXX_DiscardUnknown() { + xxx_messageInfo_Volume.DiscardUnknown(m) +} + +var xxx_messageInfo_Volume proto.InternalMessageInfo + +func (m *Volume) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func init() { + proto.RegisterType((*Pool)(nil), "onex.market.Pool") + proto.RegisterType((*Leader)(nil), "onex.market.Leader") + proto.RegisterType((*Volume)(nil), "onex.market.Volume") +} + +func init() { proto.RegisterFile("onex/market/pool.proto", fileDescriptor_a75aff76c4a68782) } + +var fileDescriptor_a75aff76c4a68782 = []byte{ + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0xcd, 0x4e, 0xc2, 0x40, + 0x10, 0x6e, 0xa1, 0x14, 0x5d, 0x4e, 0x2e, 0x48, 0x56, 0x0e, 0xa5, 0xe1, 0x44, 0x62, 0x68, 0x43, + 0x7d, 0x02, 0xf1, 0x44, 0xe2, 0xc1, 0xf4, 0xe0, 0xc1, 0x8b, 0xa9, 0x74, 0x03, 0x0d, 0x6d, 0xa7, + 0xd9, 0x5d, 0x8c, 0xbc, 0x85, 0x0f, 0xc3, 0x43, 0x70, 0x24, 0x9e, 0x8c, 0x07, 0x62, 0xe0, 0x45, + 0x4c, 0x77, 0x5b, 0x24, 0xf1, 0x60, 0x4c, 0xbc, 0x34, 0xf3, 0xfd, 0x4c, 0x67, 0xf2, 0xed, 0xa0, + 0x36, 0xa4, 0xf4, 0xc5, 0x4d, 0x02, 0x36, 0xa7, 0xc2, 0xcd, 0x00, 0x62, 0x27, 0x63, 0x20, 0x00, + 0x37, 0x72, 0xde, 0x51, 0x7c, 0xa7, 0x35, 0x85, 0x29, 0x48, 0xde, 0xcd, 0x2b, 0x65, 0xe9, 0x5c, + 0x4c, 0x80, 0x27, 0xc0, 0x1f, 0x95, 0xa0, 0x40, 0x21, 0x9d, 0x05, 0x49, 0x94, 0x82, 0x2b, 0xbf, + 0x8a, 0xea, 0xad, 0x2a, 0xc8, 0xb8, 0x03, 0x88, 0x31, 0x46, 0x46, 0x16, 0x44, 0x8c, 0xe8, 0xb6, + 0xde, 0x3f, 0xf5, 0x65, 0x8d, 0xdb, 0xc8, 0x0c, 0x69, 0x0a, 0xc9, 0x90, 0x54, 0x24, 0x5b, 0xa0, + 0x03, 0xef, 0x91, 0xea, 0x11, 0xef, 0xe1, 0x01, 0xaa, 0x3f, 0x43, 0xbc, 0x48, 0xe8, 0x90, 0x18, + 0xb6, 0xde, 0x6f, 0x78, 0x4d, 0xe7, 0x68, 0x5f, 0xe7, 0x5e, 0x6a, 0x7e, 0xe9, 0xf9, 0xb6, 0x7b, + 0xa4, 0xf6, 0xab, 0x5d, 0xfe, 0x3d, 0xa6, 0x41, 0x48, 0x19, 0x27, 0xa6, 0x5d, 0xfd, 0x61, 0xbf, + 0x95, 0x9a, 0x5f, 0x7a, 0xf0, 0x35, 0xaa, 0x85, 0x0c, 0x32, 0x4e, 0xea, 0xf9, 0x8e, 0xa3, 0xcb, + 0xf5, 0xb6, 0xab, 0x7d, 0x6c, 0xbb, 0xe7, 0x2a, 0x11, 0x1e, 0xce, 0x9d, 0x08, 0xdc, 0x24, 0x10, + 0x33, 0x67, 0x9c, 0x8a, 0xb7, 0xd5, 0x00, 0x15, 0x51, 0x8d, 0x53, 0xe1, 0xab, 0x4e, 0x4c, 0x50, + 0x7d, 0x16, 0x71, 0x01, 0x6c, 0x49, 0x4e, 0x6c, 0xbd, 0x6f, 0xf8, 0x25, 0xec, 0x51, 0x64, 0xaa, + 0x79, 0xb9, 0x27, 0x08, 0x43, 0x46, 0x39, 0x2f, 0xa2, 0x2b, 0xe1, 0x3f, 0x2c, 0xd0, 0x9b, 0x20, + 0x53, 0xa5, 0x80, 0x5b, 0xa8, 0x26, 0x43, 0x2e, 0x86, 0x28, 0x80, 0x6f, 0x90, 0x19, 0x24, 0xb0, + 0x48, 0x85, 0x7a, 0xa0, 0xbf, 0xcd, 0x28, 0x5a, 0x47, 0x83, 0xf5, 0xce, 0xd2, 0x37, 0x3b, 0x4b, + 0xff, 0xdc, 0x59, 0xfa, 0xeb, 0xde, 0xd2, 0x36, 0x7b, 0x4b, 0x7b, 0xdf, 0x5b, 0xda, 0x43, 0x53, + 0x5e, 0xe1, 0xe1, 0x0e, 0xc5, 0x32, 0xa3, 0xfc, 0xc9, 0x94, 0x87, 0x73, 0xf5, 0x15, 0x00, 0x00, + 0xff, 0xff, 0xfc, 0xe7, 0x9b, 0xd4, 0xa3, 0x02, 0x00, 0x00, +} + +func (m *Pool) 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 *Pool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Pool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.History != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.History)) + i-- + dAtA[i] = 0x40 + } + { + size := m.Drops.Size() + i -= size + if _, err := m.Drops.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.Leaders) > 0 { + for iNdEx := len(m.Leaders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Leaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.Volume2 != nil { + { + size, err := m.Volume2.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.Volume1 != nil { + { + size, err := m.Volume1.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.Denom2) > 0 { + i -= len(m.Denom2) + copy(dAtA[i:], m.Denom2) + i = encodeVarintPool(dAtA, i, uint64(len(m.Denom2))) + i-- + dAtA[i] = 0x1a + } + if len(m.Denom1) > 0 { + i -= len(m.Denom1) + copy(dAtA[i:], m.Denom1) + i = encodeVarintPool(dAtA, i, uint64(len(m.Denom1))) + i-- + dAtA[i] = 0x12 + } + if len(m.Pair) > 0 { + i -= len(m.Pair) + copy(dAtA[i:], m.Pair) + i = encodeVarintPool(dAtA, i, uint64(len(m.Pair))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Leader) 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 *Leader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Leader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Drops.Size() + i -= size + if _, err := m.Drops.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintPool(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Volume) 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 *Volume) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Volume) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintPool(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintPool(dAtA []byte, offset int, v uint64) int { + offset -= sovPool(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Pool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Pair) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Denom1) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.Denom2) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.Volume1 != nil { + l = m.Volume1.Size() + n += 1 + l + sovPool(uint64(l)) + } + if m.Volume2 != nil { + l = m.Volume2.Size() + n += 1 + l + sovPool(uint64(l)) + } + if len(m.Leaders) > 0 { + for _, e := range m.Leaders { + l = e.Size() + n += 1 + l + sovPool(uint64(l)) + } + } + l = m.Drops.Size() + n += 1 + l + sovPool(uint64(l)) + if m.History != 0 { + n += 1 + sovPool(uint64(m.History)) + } + return n +} + +func (m *Leader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = m.Drops.Size() + n += 1 + l + sovPool(uint64(l)) + return n +} + +func (m *Volume) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovPool(uint64(l)) + return n +} + +func sovPool(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPool(x uint64) (n int) { + return sovPool(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Pool) 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 ErrIntOverflowPool + } + 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: Pool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Pool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pair", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Pair = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom1", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom1 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom2", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom2 = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Volume1", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Volume1 == nil { + m.Volume1 = &Volume{} + } + if err := m.Volume1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Volume2", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Volume2 == nil { + m.Volume2 = &Volume{} + } + if err := m.Volume2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leaders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Leaders = append(m.Leaders, &Leader{}) + if err := m.Leaders[len(m.Leaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Drops", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Drops.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field History", wireType) + } + m.History = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.History |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Leader) 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 ErrIntOverflowPool + } + 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: Leader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Leader: 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 ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Drops", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Drops.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Volume) 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 ErrIntOverflowPool + } + 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: Volume: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Volume: 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 ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + 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 Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + 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 ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPool(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, ErrIntOverflowPool + } + 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, ErrIntOverflowPool + } + 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, ErrIntOverflowPool + } + 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, ErrInvalidLengthPool + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPool + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPool + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPool = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPool = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPool = fmt.Errorf("proto: unexpected end of group") +) From f6128ea6377c5f4b427bf6eab129bd930d1806d9 Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Thu, 18 Apr 2024 03:14:17 -0500 Subject: [PATCH 5/8] Added in pool type --- x/market/keeper/msg_server_create_pool.go | 4 +++ x/market/keeper/pool.go | 27 ++++++++++++++++++++ x/market/types/key_pool.go | 31 +++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 x/market/keeper/pool.go create mode 100644 x/market/types/key_pool.go diff --git a/x/market/keeper/msg_server_create_pool.go b/x/market/keeper/msg_server_create_pool.go index 77e6ba9..767abfd 100644 --- a/x/market/keeper/msg_server_create_pool.go +++ b/x/market/keeper/msg_server_create_pool.go @@ -37,9 +37,13 @@ func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) ( member2, _ := k.GetMember(ctx, denom1, denom2) + pool, found := k.GetPool(ctx, denom1, denom2) + _ = member1 _ = member2 _ = pair + _ = pool + _ = found _ = ctx return &types.MsgCreatePoolResponse{}, nil diff --git a/x/market/keeper/pool.go b/x/market/keeper/pool.go new file mode 100644 index 0000000..3b6a002 --- /dev/null +++ b/x/market/keeper/pool.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/runtime" + + "context" + "onex/x/market/types" +) + +// GetParams get all parameters as types.Params +func (k Keeper) GetPool( + ctx context.Context, + denomA string, + denomB string, +) (pool types.Pool, found bool) { + store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) + bz := store.Get(types.PoolKey( + denomA, + denomB, + )) + if bz == nil { + return pool, false + } + + k.cdc.MustUnmarshal(bz, &pool) + return pool, true +} diff --git a/x/market/types/key_pool.go b/x/market/types/key_pool.go new file mode 100644 index 0000000..4fd870e --- /dev/null +++ b/x/market/types/key_pool.go @@ -0,0 +1,31 @@ +package types + +import ( + "slices" + "strings" +) + +const ( + // PoolKeyPrefix is the prefix to retrieve all Pool + PoolKeyPrefix = "Pool/value/" +) + +// PoolKey returns the store key to retrieve a Pool +func PoolKey( + denomA string, + denomB string, +) []byte { + + denoms := []string{denomA, denomB} + // CoinAmsg and CoinBmsg pre-sort from raw msg + + slices.Sort(denoms) + + var key []byte + + pairBytes := []byte(strings.Join(denoms, ", ")) + key = append(key, pairBytes...) + key = append(key, []byte("/")...) + + return key +} From a8721f091fac49b364558fbce2e0367e377bd4fe Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Thu, 18 Apr 2024 10:41:01 -0500 Subject: [PATCH 6/8] Add in market errors --- api/onex/market/member.pulsar.go | 70 +++++++++-------- api/onex/market/pool.pulsar.go | 89 +++++++++++----------- docs/static/openapi.yml | 92 +++++++++++------------ proto/onex/market/member.proto | 15 +++- proto/onex/market/pool.proto | 4 +- x/market/keeper/msg_server_create_pool.go | 16 ++++ x/market/types/errors.go | 42 +++++++++++ x/market/types/member.pb.go | 85 +++++++++++---------- x/market/types/pool.pb.go | 52 +++++++------ 9 files changed, 275 insertions(+), 190 deletions(-) diff --git a/api/onex/market/member.pulsar.go b/api/onex/market/member.pulsar.go index b85535c..b3486e4 100644 --- a/api/onex/market/member.pulsar.go +++ b/api/onex/market/member.pulsar.go @@ -3,7 +3,9 @@ package market import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" + _ "github.com/cosmos/gogoproto/gogoproto" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -15,8 +17,8 @@ import ( var ( md_Member protoreflect.MessageDescriptor fd_Member_pair protoreflect.FieldDescriptor - fd_Member_denomA protoreflect.FieldDescriptor - fd_Member_denomB protoreflect.FieldDescriptor + fd_Member_denom_a protoreflect.FieldDescriptor + fd_Member_denom_b protoreflect.FieldDescriptor fd_Member_balance protoreflect.FieldDescriptor fd_Member_previous protoreflect.FieldDescriptor fd_Member_limit protoreflect.FieldDescriptor @@ -27,8 +29,8 @@ func init() { file_onex_market_member_proto_init() md_Member = File_onex_market_member_proto.Messages().ByName("Member") fd_Member_pair = md_Member.Fields().ByName("pair") - fd_Member_denomA = md_Member.Fields().ByName("denomA") - fd_Member_denomB = md_Member.Fields().ByName("denomB") + fd_Member_denom_a = md_Member.Fields().ByName("denom_a") + fd_Member_denom_b = md_Member.Fields().ByName("denom_b") fd_Member_balance = md_Member.Fields().ByName("balance") fd_Member_previous = md_Member.Fields().ByName("previous") fd_Member_limit = md_Member.Fields().ByName("limit") @@ -108,13 +110,13 @@ func (x *fastReflection_Member) Range(f func(protoreflect.FieldDescriptor, proto } if x.DenomA != "" { value := protoreflect.ValueOfString(x.DenomA) - if !f(fd_Member_denomA, value) { + if !f(fd_Member_denom_a, value) { return } } if x.DenomB != "" { value := protoreflect.ValueOfString(x.DenomB) - if !f(fd_Member_denomB, value) { + if !f(fd_Member_denom_b, value) { return } } @@ -159,9 +161,9 @@ func (x *fastReflection_Member) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "onex.market.Member.pair": return x.Pair != "" - case "onex.market.Member.denomA": + case "onex.market.Member.denom_a": return x.DenomA != "" - case "onex.market.Member.denomB": + case "onex.market.Member.denom_b": return x.DenomB != "" case "onex.market.Member.balance": return x.Balance != "" @@ -189,9 +191,9 @@ func (x *fastReflection_Member) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "onex.market.Member.pair": x.Pair = "" - case "onex.market.Member.denomA": + case "onex.market.Member.denom_a": x.DenomA = "" - case "onex.market.Member.denomB": + case "onex.market.Member.denom_b": x.DenomB = "" case "onex.market.Member.balance": x.Balance = "" @@ -220,10 +222,10 @@ func (x *fastReflection_Member) Get(descriptor protoreflect.FieldDescriptor) pro case "onex.market.Member.pair": value := x.Pair return protoreflect.ValueOfString(value) - case "onex.market.Member.denomA": + case "onex.market.Member.denom_a": value := x.DenomA return protoreflect.ValueOfString(value) - case "onex.market.Member.denomB": + case "onex.market.Member.denom_b": value := x.DenomB return protoreflect.ValueOfString(value) case "onex.market.Member.balance": @@ -260,9 +262,9 @@ func (x *fastReflection_Member) Set(fd protoreflect.FieldDescriptor, value proto switch fd.FullName() { case "onex.market.Member.pair": x.Pair = value.Interface().(string) - case "onex.market.Member.denomA": + case "onex.market.Member.denom_a": x.DenomA = value.Interface().(string) - case "onex.market.Member.denomB": + case "onex.market.Member.denom_b": x.DenomB = value.Interface().(string) case "onex.market.Member.balance": x.Balance = value.Interface().(string) @@ -294,10 +296,10 @@ func (x *fastReflection_Member) Mutable(fd protoreflect.FieldDescriptor) protore switch fd.FullName() { case "onex.market.Member.pair": panic(fmt.Errorf("field pair of message onex.market.Member is not mutable")) - case "onex.market.Member.denomA": - panic(fmt.Errorf("field denomA of message onex.market.Member is not mutable")) - case "onex.market.Member.denomB": - panic(fmt.Errorf("field denomB of message onex.market.Member is not mutable")) + case "onex.market.Member.denom_a": + panic(fmt.Errorf("field denom_a of message onex.market.Member is not mutable")) + case "onex.market.Member.denom_b": + panic(fmt.Errorf("field denom_b of message onex.market.Member is not mutable")) case "onex.market.Member.balance": panic(fmt.Errorf("field balance of message onex.market.Member is not mutable")) case "onex.market.Member.previous": @@ -321,9 +323,9 @@ func (x *fastReflection_Member) NewField(fd protoreflect.FieldDescriptor) protor switch fd.FullName() { case "onex.market.Member.pair": return protoreflect.ValueOfString("") - case "onex.market.Member.denomA": + case "onex.market.Member.denom_a": return protoreflect.ValueOfString("") - case "onex.market.Member.denomB": + case "onex.market.Member.denom_b": return protoreflect.ValueOfString("") case "onex.market.Member.balance": return protoreflect.ValueOfString("") @@ -797,14 +799,16 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Member defines the parameters for a member of a pair for pool. type Member struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` - DenomA string `protobuf:"bytes,2,opt,name=denomA,proto3" json:"denomA,omitempty"` - DenomB string `protobuf:"bytes,3,opt,name=denomB,proto3" json:"denomB,omitempty"` + Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` + DenomA string `protobuf:"bytes,2,opt,name=denom_a,json=denomA,proto3" json:"denom_a,omitempty"` + DenomB string `protobuf:"bytes,3,opt,name=denom_b,json=denomB,proto3" json:"denom_b,omitempty"` + // Member Balance of denom b Balance string `protobuf:"bytes,4,opt,name=balance,proto3" json:"balance,omitempty"` Previous string `protobuf:"bytes,5,opt,name=previous,proto3" json:"previous,omitempty"` Limit uint64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` @@ -885,13 +889,19 @@ var File_onex_market_member_proto protoreflect.FileDescriptor var file_onex_market_member_proto_rawDesc = []byte{ 0x0a, 0x18, 0x6f, 0x6e, 0x65, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x6d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6f, 0x6e, 0x65, 0x78, - 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x22, 0xac, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x6d, 0x62, - 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x41, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x41, 0x12, 0x16, - 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x42, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x42, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdb, 0x01, 0x0a, 0x06, 0x4d, 0x65, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x64, 0x65, 0x6e, 0x6f, 0x6d, + 0x5f, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x41, + 0x12, 0x17, 0x0a, 0x07, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x5f, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x42, 0x12, 0x45, 0x0a, 0x07, 0x62, 0x61, 0x6c, + 0x61, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x65, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x6c, 0x69, 0x6d, diff --git a/api/onex/market/pool.pulsar.go b/api/onex/market/pool.pulsar.go index 40beef3..d2c47db 100644 --- a/api/onex/market/pool.pulsar.go +++ b/api/onex/market/pool.pulsar.go @@ -2,7 +2,6 @@ package market import ( - _ "cosmossdk.io/api/amino" fmt "fmt" _ "github.com/cosmos/cosmos-proto" runtime "github.com/cosmos/cosmos-proto/runtime" @@ -1952,6 +1951,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// Pool defines the parameters for type Pool struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2044,6 +2044,7 @@ func (x *Pool) GetHistory() uint64 { return 0 } +// Leader defines the parameters for type Leader struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2088,6 +2089,7 @@ func (x *Leader) GetDrops() string { return "" } +// Volume defines the parameters for type Volume struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -2139,49 +2141,48 @@ var file_onex_market_pool_proto_rawDesc = []byte{ 0x61, 0x72, 0x6b, 0x65, 0x74, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x61, 0x6d, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x6d, - 0x69, 0x6e, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb4, 0x02, 0x0a, 0x04, 0x50, 0x6f, - 0x6f, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x70, 0x61, 0x69, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x31, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x31, 0x12, 0x16, - 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x32, 0x12, 0x2d, 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, - 0x31, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x07, 0x76, 0x6f, - 0x6c, 0x75, 0x6d, 0x65, 0x31, 0x12, 0x2d, 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x32, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x07, 0x76, 0x6f, 0x6c, - 0x75, 0x6d, 0x65, 0x32, 0x12, 0x2d, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x2e, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, - 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, - 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, - 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, - 0x22, 0x65, 0x0a, 0x06, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, - 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, - 0x52, 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x22, 0x63, 0x0a, 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, - 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, - 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x87, 0x01, 0x0a, - 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x42, 0x09, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1c, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x6f, 0x6e, 0x65, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xa2, 0x02, 0x03, 0x4f, 0x4d, - 0x58, 0xaa, 0x02, 0x0b, 0x4f, 0x6e, 0x65, 0x78, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xca, - 0x02, 0x0b, 0x4f, 0x6e, 0x65, 0x78, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xe2, 0x02, 0x17, - 0x4f, 0x6e, 0x65, 0x78, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4f, 0x6e, 0x65, 0x78, 0x3a, 0x3a, - 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb4, 0x02, 0x0a, 0x04, 0x50, 0x6f, 0x6f, 0x6c, 0x12, + 0x12, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, + 0x61, 0x69, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x31, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x31, 0x12, 0x16, 0x0a, 0x06, 0x64, + 0x65, 0x6e, 0x6f, 0x6d, 0x32, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x6e, + 0x6f, 0x6d, 0x32, 0x12, 0x2d, 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x31, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, + 0x65, 0x31, 0x12, 0x2d, 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x32, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x52, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, + 0x32, 0x12, 0x2d, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x2e, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, + 0x12, 0x41, 0x0a, 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, + 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x05, 0x64, 0x72, + 0x6f, 0x70, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x22, 0x65, 0x0a, + 0x06, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x41, 0x0a, 0x05, 0x64, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x05, 0x64, + 0x72, 0x6f, 0x70, 0x73, 0x22, 0x63, 0x0a, 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x64, + 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x43, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, + 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, + 0x74, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x87, 0x01, 0x0a, 0x0f, 0x63, 0x6f, + 0x6d, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0x09, 0x50, + 0x6f, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x1c, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6f, 0x6e, 0x65, + 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xa2, 0x02, 0x03, 0x4f, 0x4d, 0x58, 0xaa, 0x02, + 0x0b, 0x4f, 0x6e, 0x65, 0x78, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xca, 0x02, 0x0b, 0x4f, + 0x6e, 0x65, 0x78, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0xe2, 0x02, 0x17, 0x4f, 0x6e, 0x65, + 0x78, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4f, 0x6e, 0x65, 0x78, 0x3a, 0x3a, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 03d08c2..90b475f 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -13156,6 +13156,42 @@ paths: description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - Msg + /onex/market/params: + get: + summary: Parameters queries the parameters of the module. + operationId: OnexMarketQuery_Params + responses: + '200': + description: A successful response. + schema: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: >- + QueryParamsResponse is response type for the Query/Params RPC + method. + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query /onex.market.Msg/CreatePool: post: operationId: OnexMarketMsg_CreatePool @@ -13250,42 +13286,6 @@ paths: description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - Msg - /onex/market/params: - get: - summary: Parameters queries the parameters of the module. - operationId: OnexMarketQuery_Params - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - code: - type: integer - format: int32 - message: - type: string - details: - type: array - items: - type: object - properties: - '@type': - type: string - additionalProperties: {} - tags: - - Query definitions: cosmos.auth.v1beta1.MsgUpdateParams: type: object @@ -20421,6 +20421,16 @@ definitions: onex.denom.Params: type: object description: Params defines the parameters for the module. + onex.market.Params: + type: object + description: Params defines the parameters for the module. + onex.market.QueryParamsResponse: + type: object + properties: + params: + description: params holds all the parameters of this module. + type: object + description: QueryParamsResponse is response type for the Query/Params RPC method. onex.market.MsgCreatePool: type: object properties: @@ -20449,13 +20459,3 @@ definitions: description: |- MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. - onex.market.Params: - type: object - description: Params defines the parameters for the module. - onex.market.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. diff --git a/proto/onex/market/member.proto b/proto/onex/market/member.proto index 7188cd5..3d882ab 100644 --- a/proto/onex/market/member.proto +++ b/proto/onex/market/member.proto @@ -1,14 +1,21 @@ syntax = "proto3"; package onex.market; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "onex/x/market/types"; +// Member defines the parameters for a member of a pair for pool. message Member { - string pair = 1; - string denomA = 2; - string denomB = 3; - string balance = 4; + string denom_a = 2; + string denom_b = 3; + // Member Balance of denom b + string balance = 4 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; string previous = 5; uint64 limit = 6; uint64 stop = 7; diff --git a/proto/onex/market/pool.proto b/proto/onex/market/pool.proto index 067fd70..cb10fe1 100644 --- a/proto/onex/market/pool.proto +++ b/proto/onex/market/pool.proto @@ -2,10 +2,10 @@ syntax = "proto3"; package onex.market; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; -import "amino/amino.proto"; option go_package = "onex/x/market/types"; +// Pool defines the parameters for message Pool { string pair = 1; string denom1 = 2; @@ -22,6 +22,7 @@ message Pool { uint64 history = 8; } +// Leader defines the parameters for message Leader { string address = 1; // Pool liquidity @@ -32,6 +33,7 @@ message Leader { ]; } +// Volume defines the parameters for message Volume { string denom = 1; string amount = 2 [ diff --git a/x/market/keeper/msg_server_create_pool.go b/x/market/keeper/msg_server_create_pool.go index 767abfd..f3efeae 100644 --- a/x/market/keeper/msg_server_create_pool.go +++ b/x/market/keeper/msg_server_create_pool.go @@ -6,6 +6,8 @@ import ( "onex/x/market/types" "strings" + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -39,6 +41,20 @@ func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) ( pool, found := k.GetPool(ctx, denom1, denom2) + if found { + if !member1.Balance.Equal(math.ZeroInt()) { + return nil, types.ErrPoolAlreadyExists + } + + if !member2.Balance.Equal(math.ZeroInt()) { + return nil, types.ErrPoolAlreadyExists + } + + if !pool.Drops.Equal(math.ZeroInt()) { + return nil, types.ErrPoolAlreadyExists + } + } + _ = member1 _ = member2 _ = pair diff --git a/x/market/types/errors.go b/x/market/types/errors.go index b818f01..7c5f421 100644 --- a/x/market/types/errors.go +++ b/x/market/types/errors.go @@ -10,4 +10,46 @@ import ( var ( ErrInvalidSigner = sdkerrors.Register(ModuleName, 1100, "expected gov account as only signer for proposal message") ErrSample = sdkerrors.Register(ModuleName, 1101, "sample error") + // ErrInvalidCoins - coin/coins are invalid. + ErrInvalidCoins = sdkerrors.Register(ModuleName, 1, "coins are invalid") + // ErrInsufficientBalance - the user balance is insufficient for the operation. + ErrInsufficientBalance = sdkerrors.Register(ModuleName, 2, "insufficient balance") // nolint: gomnd + // ErrPoolAlreadyExists - the pool is already exist. + ErrPoolAlreadyExists = sdkerrors.Register(ModuleName, 3, "the pool already exists") // nolint: gomnd + // ErrPoolNotFound - the pool not found. + ErrPoolNotFound = sdkerrors.Register(ModuleName, 4, "the pool not found") // nolint: gomnd + // ErrPoolNotFound - the drop not found. + ErrDropNotFound = sdkerrors.Register(ModuleName, 5, "the pool not found") // nolint: gomnd + // ErrPoolNotFound - the drop not found. + ErrNotDrops = sdkerrors.Register(ModuleName, 6, "not order owner") // nolint: gomnd + // ErrMemberNotFound - the pool member not found. + ErrMemberNotFound = sdkerrors.Register(ModuleName, 7, "the pool member not found") // nolint: gomnd + // ErrInvalidDropAmount - the drop amount is invalid. + ErrInvalidDropAmount = sdkerrors.Register(ModuleName, 8, "invalid drop amount") // nolint: gomnd + // ErrInvalidDenomsPair - invalid demos pair. + ErrInvalidDenomsPair = sdkerrors.Register(ModuleName, 9, "invalid demos pair") // nolint: gomnd + // ErrInvalidOrder - invalid demos pair. + ErrInvalidOrder = sdkerrors.Register(ModuleName, 10, "invalid order") // nolint: gomnd + // ErrPoolNotFound - the drop not found. + ErrOrderNotFound = sdkerrors.Register(ModuleName, 11, "order not found") // nolint: gomnd + // ErrPoolNotFound - the drop not found. + ErrNotOrderOwner = sdkerrors.Register(ModuleName, 12, "not order owner") // nolint: gomnd + // ErrInvalidOrderAmount - invalid bid amount + ErrInvalidOrderAmount = sdkerrors.Register(ModuleName, 13, "invalid order amount") // nolint: gomnd + // ErrSlippageTooGreat - slippage over limit + ErrSlippageTooGreat = sdkerrors.Register(ModuleName, 14, "slippage too great") // nolint: gomnd + // ErrPoolInactive - the pool is not active and has 0 drops. + ErrPoolInactive = sdkerrors.Register(ModuleName, 15, "the pool is inactive") // nolint: gomnd + // ErrDropSumNotFound - the drop sum of owner with drop not found + ErrDropSumNotFound = sdkerrors.Register(ModuleName, 16, "drop sum not found") // nolint: gomnd + // ErrAmtZero - Not greater than zero + ErrAmtZero = sdkerrors.Register(ModuleName, 17, "payment amount equal to zero") // nolint: gomnd + // ErrMemberBalanceZero - the drop sum of owner with drop not found + ErrMemberBalanceZero = sdkerrors.Register(ModuleName, 18, "member balance zero - pool empty") // nolint: gomnd + // ErrDenomMismatch - mismatch of denoms entered + ErrDenomMismatch = sdkerrors.Register(ModuleName, 19, "denoms are not matching") // nolint: gomnd + // ErrLiquidityLow - liquidity is too low + ErrLiquidityLow = sdkerrors.Register(ModuleName, 20, "liquidity too low") // nolint: gomnd + // ErrProductInvalid - liquidity is too low + ErrProductInvalid = sdkerrors.Register(ModuleName, 21, "product less than beg") // nolint: gomnd ) diff --git a/x/market/types/member.pb.go b/x/market/types/member.pb.go index 4f6b6bd..2d34bbc 100644 --- a/x/market/types/member.pb.go +++ b/x/market/types/member.pb.go @@ -4,7 +4,10 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" math "math" @@ -22,14 +25,16 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Member defines the parameters for a member of a pair for pool. type Member struct { - Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` - DenomA string `protobuf:"bytes,2,opt,name=denomA,proto3" json:"denomA,omitempty"` - DenomB string `protobuf:"bytes,3,opt,name=denomB,proto3" json:"denomB,omitempty"` - Balance string `protobuf:"bytes,4,opt,name=balance,proto3" json:"balance,omitempty"` - Previous string `protobuf:"bytes,5,opt,name=previous,proto3" json:"previous,omitempty"` - Limit uint64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` - Stop uint64 `protobuf:"varint,7,opt,name=stop,proto3" json:"stop,omitempty"` + Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` + DenomA string `protobuf:"bytes,2,opt,name=denom_a,json=denomA,proto3" json:"denom_a,omitempty"` + DenomB string `protobuf:"bytes,3,opt,name=denom_b,json=denomB,proto3" json:"denom_b,omitempty"` + // Member Balance of denom b + Balance cosmossdk_io_math.Int `protobuf:"bytes,4,opt,name=balance,proto3,customtype=cosmossdk.io/math.Int" json:"balance"` + Previous string `protobuf:"bytes,5,opt,name=previous,proto3" json:"previous,omitempty"` + Limit uint64 `protobuf:"varint,6,opt,name=limit,proto3" json:"limit,omitempty"` + Stop uint64 `protobuf:"varint,7,opt,name=stop,proto3" json:"stop,omitempty"` } func (m *Member) Reset() { *m = Member{} } @@ -86,13 +91,6 @@ func (m *Member) GetDenomB() string { return "" } -func (m *Member) GetBalance() string { - if m != nil { - return m.Balance - } - return "" -} - func (m *Member) GetPrevious() string { if m != nil { return m.Previous @@ -121,21 +119,25 @@ func init() { func init() { proto.RegisterFile("onex/market/member.proto", fileDescriptor_8367e44475f24af7) } var fileDescriptor_8367e44475f24af7 = []byte{ - // 212 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x8f, 0x31, 0x4e, 0x87, 0x30, - 0x14, 0x87, 0xa9, 0x42, 0xd1, 0xba, 0x55, 0x63, 0x5e, 0x1c, 0x1a, 0xe2, 0xc4, 0x22, 0x0c, 0x9e, - 0x40, 0x76, 0x17, 0x46, 0xb7, 0xa2, 0x6f, 0x68, 0xa4, 0xb4, 0x29, 0xd5, 0xe8, 0x2d, 0x3c, 0x88, - 0x07, 0x71, 0x64, 0x74, 0x34, 0x70, 0x11, 0xc3, 0x43, 0xc9, 0x7f, 0x7b, 0xdf, 0xf7, 0x2d, 0xef, - 0x27, 0xc0, 0x0d, 0xf8, 0x56, 0x5b, 0x1d, 0x9e, 0x31, 0xd6, 0x16, 0x6d, 0x87, 0xa1, 0xf2, 0xc1, - 0x45, 0x27, 0xcf, 0xd6, 0x52, 0x6d, 0xe5, 0xfa, 0x93, 0x09, 0x7e, 0x4f, 0x55, 0x4a, 0x91, 0x7a, - 0x6d, 0x02, 0xb0, 0x82, 0x95, 0xa7, 0x2d, 0xdd, 0xf2, 0x52, 0xf0, 0x27, 0x1c, 0x9c, 0xbd, 0x83, - 0x23, 0xb2, 0x7f, 0xb4, 0xfb, 0x06, 0x8e, 0x0f, 0x7c, 0x23, 0x41, 0xe4, 0x9d, 0xee, 0xf5, 0xf0, - 0x88, 0x90, 0x52, 0xf8, 0x47, 0x79, 0x25, 0x4e, 0x7c, 0xc0, 0x57, 0xe3, 0x5e, 0x46, 0xc8, 0x28, - 0xed, 0x2c, 0x2f, 0x44, 0xd6, 0x1b, 0x6b, 0x22, 0xf0, 0x82, 0x95, 0x69, 0xbb, 0xc1, 0xfa, 0xcf, - 0x18, 0x9d, 0x87, 0x9c, 0x24, 0xdd, 0xcd, 0xcd, 0xd7, 0xac, 0xd8, 0x34, 0x2b, 0xf6, 0x33, 0x2b, - 0xf6, 0xb1, 0xa8, 0x64, 0x5a, 0x54, 0xf2, 0xbd, 0xa8, 0xe4, 0xe1, 0x9c, 0xf6, 0xee, 0x8b, 0xe3, - 0xbb, 0xc7, 0xb1, 0xe3, 0xb4, 0xf8, 0xf6, 0x37, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x96, 0x02, 0x95, - 0x0d, 0x01, 0x00, 0x00, + // 281 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x31, 0x4e, 0xc3, 0x30, + 0x14, 0x86, 0x63, 0x48, 0x13, 0x30, 0x9b, 0x29, 0xc2, 0x64, 0x70, 0x2b, 0xa6, 0x4a, 0xa8, 0xc9, + 0xc0, 0x09, 0x88, 0xc4, 0xd0, 0x81, 0x25, 0x23, 0x4b, 0xe5, 0xb4, 0x56, 0x89, 0x5a, 0xe7, 0x45, + 0xb1, 0x41, 0x70, 0x0b, 0x0e, 0xc3, 0x21, 0x3a, 0x56, 0x4c, 0x08, 0xa4, 0x0a, 0x25, 0x17, 0x41, + 0x79, 0x86, 0xd2, 0xed, 0xff, 0xff, 0xcf, 0x7e, 0xef, 0xe9, 0xa7, 0x1c, 0x4a, 0xf5, 0x9c, 0x68, + 0x59, 0x2f, 0x95, 0x4d, 0xb4, 0xd2, 0xb9, 0xaa, 0xe3, 0xaa, 0x06, 0x0b, 0xec, 0xa4, 0x23, 0xb1, + 0x23, 0x51, 0x7f, 0x01, 0x0b, 0xc0, 0x3c, 0xe9, 0x94, 0x7b, 0x12, 0x5d, 0xcc, 0xc0, 0x68, 0x30, + 0x53, 0x07, 0x9c, 0x71, 0xe8, 0xf2, 0x8b, 0xd0, 0xe0, 0x0e, 0xc7, 0x31, 0x46, 0xfd, 0x4a, 0x16, + 0x35, 0x27, 0x43, 0x32, 0x3a, 0xce, 0x50, 0xb3, 0x73, 0x1a, 0xce, 0x55, 0x09, 0x7a, 0x2a, 0xf9, + 0x01, 0xc6, 0x01, 0xda, 0x9b, 0x7f, 0x90, 0xf3, 0xc3, 0x3d, 0x90, 0xb2, 0x5b, 0x1a, 0xe6, 0x72, + 0x25, 0xcb, 0x99, 0xe2, 0x7e, 0x07, 0xd2, 0xab, 0xf5, 0x76, 0xe0, 0x7d, 0x6e, 0x07, 0x67, 0x6e, + 0xaf, 0x99, 0x2f, 0xe3, 0x02, 0x12, 0x2d, 0xed, 0x43, 0x3c, 0x29, 0xed, 0xfb, 0xdb, 0x98, 0xfe, + 0x1e, 0x34, 0x29, 0x6d, 0xf6, 0xf7, 0x97, 0x45, 0xf4, 0xa8, 0xaa, 0xd5, 0x53, 0x01, 0x8f, 0x86, + 0xf7, 0x70, 0xc1, 0xce, 0xb3, 0x3e, 0xed, 0xad, 0x0a, 0x5d, 0x58, 0x1e, 0x0c, 0xc9, 0xc8, 0xcf, + 0x9c, 0xe9, 0xce, 0x37, 0x16, 0x2a, 0x1e, 0x62, 0x88, 0x3a, 0x1d, 0xaf, 0x1b, 0x41, 0x36, 0x8d, + 0x20, 0xdf, 0x8d, 0x20, 0xaf, 0xad, 0xf0, 0x36, 0xad, 0xf0, 0x3e, 0x5a, 0xe1, 0xdd, 0x9f, 0x62, + 0x9f, 0xbb, 0x46, 0xed, 0x4b, 0xa5, 0x4c, 0x1e, 0x60, 0x27, 0xd7, 0x3f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0xde, 0x03, 0x06, 0xe2, 0x6d, 0x01, 0x00, 0x00, } func (m *Member) Marshal() (dAtA []byte, err error) { @@ -175,13 +177,16 @@ func (m *Member) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if len(m.Balance) > 0 { - i -= len(m.Balance) - copy(dAtA[i:], m.Balance) - i = encodeVarintMember(dAtA, i, uint64(len(m.Balance))) - i-- - dAtA[i] = 0x22 + { + size := m.Balance.Size() + i -= size + if _, err := m.Balance.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintMember(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x22 if len(m.DenomB) > 0 { i -= len(m.DenomB) copy(dAtA[i:], m.DenomB) @@ -235,10 +240,8 @@ func (m *Member) Size() (n int) { if l > 0 { n += 1 + l + sovMember(uint64(l)) } - l = len(m.Balance) - if l > 0 { - n += 1 + l + sovMember(uint64(l)) - } + l = m.Balance.Size() + n += 1 + l + sovMember(uint64(l)) l = len(m.Previous) if l > 0 { n += 1 + l + sovMember(uint64(l)) @@ -413,7 +416,9 @@ func (m *Member) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Balance = string(dAtA[iNdEx:postIndex]) + if err := m.Balance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 5: if wireType != 2 { diff --git a/x/market/types/pool.pb.go b/x/market/types/pool.pb.go index 873a648..c762c2d 100644 --- a/x/market/types/pool.pb.go +++ b/x/market/types/pool.pb.go @@ -7,7 +7,6 @@ import ( cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -26,6 +25,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Pool defines the parameters for type Pool struct { Pair string `protobuf:"bytes,1,opt,name=pair,proto3" json:"pair,omitempty"` Denom1 string `protobuf:"bytes,2,opt,name=denom1,proto3" json:"denom1,omitempty"` @@ -120,6 +120,7 @@ func (m *Pool) GetHistory() uint64 { return 0 } +// Leader defines the parameters for type Leader struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Pool liquidity @@ -166,6 +167,7 @@ func (m *Leader) GetAddress() string { return "" } +// Volume defines the parameters for type Volume struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount"` @@ -220,30 +222,30 @@ func init() { func init() { proto.RegisterFile("onex/market/pool.proto", fileDescriptor_a75aff76c4a68782) } var fileDescriptor_a75aff76c4a68782 = []byte{ - // 362 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0xcd, 0x4e, 0xc2, 0x40, - 0x10, 0x6e, 0xa1, 0x14, 0x5d, 0x4e, 0x2e, 0x48, 0x56, 0x0e, 0xa5, 0xe1, 0x44, 0x62, 0x68, 0x43, - 0x7d, 0x02, 0xf1, 0x44, 0xe2, 0xc1, 0xf4, 0xe0, 0xc1, 0x8b, 0xa9, 0x74, 0x03, 0x0d, 0x6d, 0xa7, - 0xd9, 0x5d, 0x8c, 0xbc, 0x85, 0x0f, 0xc3, 0x43, 0x70, 0x24, 0x9e, 0x8c, 0x07, 0x62, 0xe0, 0x45, - 0x4c, 0x77, 0x5b, 0x24, 0xf1, 0x60, 0x4c, 0xbc, 0x34, 0xf3, 0xfd, 0x4c, 0x67, 0xf2, 0xed, 0xa0, - 0x36, 0xa4, 0xf4, 0xc5, 0x4d, 0x02, 0x36, 0xa7, 0xc2, 0xcd, 0x00, 0x62, 0x27, 0x63, 0x20, 0x00, - 0x37, 0x72, 0xde, 0x51, 0x7c, 0xa7, 0x35, 0x85, 0x29, 0x48, 0xde, 0xcd, 0x2b, 0x65, 0xe9, 0x5c, - 0x4c, 0x80, 0x27, 0xc0, 0x1f, 0x95, 0xa0, 0x40, 0x21, 0x9d, 0x05, 0x49, 0x94, 0x82, 0x2b, 0xbf, - 0x8a, 0xea, 0xad, 0x2a, 0xc8, 0xb8, 0x03, 0x88, 0x31, 0x46, 0x46, 0x16, 0x44, 0x8c, 0xe8, 0xb6, - 0xde, 0x3f, 0xf5, 0x65, 0x8d, 0xdb, 0xc8, 0x0c, 0x69, 0x0a, 0xc9, 0x90, 0x54, 0x24, 0x5b, 0xa0, - 0x03, 0xef, 0x91, 0xea, 0x11, 0xef, 0xe1, 0x01, 0xaa, 0x3f, 0x43, 0xbc, 0x48, 0xe8, 0x90, 0x18, - 0xb6, 0xde, 0x6f, 0x78, 0x4d, 0xe7, 0x68, 0x5f, 0xe7, 0x5e, 0x6a, 0x7e, 0xe9, 0xf9, 0xb6, 0x7b, - 0xa4, 0xf6, 0xab, 0x5d, 0xfe, 0x3d, 0xa6, 0x41, 0x48, 0x19, 0x27, 0xa6, 0x5d, 0xfd, 0x61, 0xbf, - 0x95, 0x9a, 0x5f, 0x7a, 0xf0, 0x35, 0xaa, 0x85, 0x0c, 0x32, 0x4e, 0xea, 0xf9, 0x8e, 0xa3, 0xcb, - 0xf5, 0xb6, 0xab, 0x7d, 0x6c, 0xbb, 0xe7, 0x2a, 0x11, 0x1e, 0xce, 0x9d, 0x08, 0xdc, 0x24, 0x10, - 0x33, 0x67, 0x9c, 0x8a, 0xb7, 0xd5, 0x00, 0x15, 0x51, 0x8d, 0x53, 0xe1, 0xab, 0x4e, 0x4c, 0x50, - 0x7d, 0x16, 0x71, 0x01, 0x6c, 0x49, 0x4e, 0x6c, 0xbd, 0x6f, 0xf8, 0x25, 0xec, 0x51, 0x64, 0xaa, - 0x79, 0xb9, 0x27, 0x08, 0x43, 0x46, 0x39, 0x2f, 0xa2, 0x2b, 0xe1, 0x3f, 0x2c, 0xd0, 0x9b, 0x20, - 0x53, 0xa5, 0x80, 0x5b, 0xa8, 0x26, 0x43, 0x2e, 0x86, 0x28, 0x80, 0x6f, 0x90, 0x19, 0x24, 0xb0, - 0x48, 0x85, 0x7a, 0xa0, 0xbf, 0xcd, 0x28, 0x5a, 0x47, 0x83, 0xf5, 0xce, 0xd2, 0x37, 0x3b, 0x4b, - 0xff, 0xdc, 0x59, 0xfa, 0xeb, 0xde, 0xd2, 0x36, 0x7b, 0x4b, 0x7b, 0xdf, 0x5b, 0xda, 0x43, 0x53, - 0x5e, 0xe1, 0xe1, 0x0e, 0xc5, 0x32, 0xa3, 0xfc, 0xc9, 0x94, 0x87, 0x73, 0xf5, 0x15, 0x00, 0x00, - 0xff, 0xff, 0xfc, 0xe7, 0x9b, 0xd4, 0xa3, 0x02, 0x00, 0x00, + // 354 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0xcf, 0x4e, 0xf2, 0x40, + 0x10, 0xef, 0x42, 0x29, 0xdf, 0xb7, 0xdc, 0x16, 0x24, 0x2b, 0x87, 0xd2, 0x70, 0x22, 0x31, 0xb4, + 0xa1, 0x3e, 0x81, 0x78, 0x22, 0xf1, 0x60, 0x7a, 0xf0, 0xe0, 0xc5, 0x54, 0xba, 0x01, 0x42, 0xdb, + 0x69, 0x76, 0x17, 0x23, 0x6f, 0xe1, 0xc3, 0xf0, 0x10, 0x1c, 0x89, 0x27, 0xe3, 0x81, 0x18, 0x78, + 0x11, 0xd3, 0xdd, 0x16, 0x49, 0x3c, 0x18, 0x13, 0x6f, 0xf3, 0xfb, 0x33, 0x9d, 0xe9, 0x6f, 0x07, + 0xb7, 0x21, 0x65, 0xcf, 0x5e, 0x12, 0xf2, 0x05, 0x93, 0x5e, 0x06, 0x10, 0xbb, 0x19, 0x07, 0x09, + 0xa4, 0x91, 0xf3, 0xae, 0xe6, 0x3b, 0xad, 0x29, 0x4c, 0x41, 0xf1, 0x5e, 0x5e, 0x69, 0x4b, 0xe7, + 0x7c, 0x02, 0x22, 0x01, 0xf1, 0xa0, 0x05, 0x0d, 0xb4, 0xd4, 0x5b, 0x57, 0xb0, 0x79, 0x0b, 0x10, + 0x13, 0x82, 0xcd, 0x2c, 0x9c, 0x73, 0x8a, 0x1c, 0xd4, 0xff, 0x1f, 0xa8, 0x9a, 0xb4, 0xb1, 0x15, + 0xb1, 0x14, 0x92, 0x21, 0xad, 0x28, 0xb6, 0x40, 0x47, 0xde, 0xa7, 0xd5, 0x13, 0xde, 0x27, 0x03, + 0x5c, 0x7f, 0x82, 0x78, 0x99, 0xb0, 0x21, 0x35, 0x1d, 0xd4, 0x6f, 0xf8, 0x4d, 0xf7, 0x64, 0x39, + 0xf7, 0x4e, 0x69, 0x41, 0xe9, 0xf9, 0xb2, 0xfb, 0xb4, 0xf6, 0xa3, 0x5d, 0x7d, 0x3d, 0x66, 0x61, + 0xc4, 0xb8, 0xa0, 0x96, 0x53, 0xfd, 0x66, 0xbf, 0x51, 0x5a, 0x50, 0x7a, 0xc8, 0x15, 0xae, 0x45, + 0x1c, 0x32, 0x41, 0xeb, 0xf9, 0x8e, 0xa3, 0x8b, 0xcd, 0xae, 0x6b, 0xbc, 0xef, 0xba, 0x67, 0xfa, + 0xf7, 0x45, 0xb4, 0x70, 0xe7, 0xe0, 0x25, 0xa1, 0x9c, 0xb9, 0xe3, 0x54, 0xbe, 0xae, 0x07, 0xb8, + 0xc8, 0x65, 0x9c, 0xca, 0x40, 0x77, 0x12, 0x8a, 0xeb, 0xb3, 0xb9, 0x90, 0xc0, 0x57, 0xf4, 0x9f, + 0x83, 0xfa, 0x66, 0x50, 0xc2, 0x1e, 0xc3, 0x96, 0x9e, 0x97, 0x7b, 0xc2, 0x28, 0xe2, 0x4c, 0x88, + 0x22, 0xba, 0x12, 0xfe, 0xc1, 0x02, 0xbd, 0x09, 0xb6, 0x74, 0x0a, 0xa4, 0x85, 0x6b, 0x2a, 0xe4, + 0x62, 0x88, 0x06, 0xe4, 0x1a, 0x5b, 0x61, 0x02, 0xcb, 0x54, 0xea, 0x07, 0xfa, 0xdd, 0x8c, 0xa2, + 0x75, 0x34, 0xd8, 0xec, 0x6d, 0xb4, 0xdd, 0xdb, 0xe8, 0x63, 0x6f, 0xa3, 0x97, 0x83, 0x6d, 0x6c, + 0x0f, 0xb6, 0xf1, 0x76, 0xb0, 0x8d, 0xfb, 0xa6, 0x3a, 0xb9, 0xe3, 0xd1, 0xc9, 0x55, 0xc6, 0xc4, + 0xa3, 0xa5, 0x0e, 0xe7, 0xf2, 0x33, 0x00, 0x00, 0xff, 0xff, 0x70, 0x31, 0x83, 0xab, 0x90, 0x02, + 0x00, 0x00, } func (m *Pool) Marshal() (dAtA []byte, err error) { From 9fd76c07d7f31aa9af08f012bc2b76918641fa20 Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Thu, 18 Apr 2024 12:47:32 -0500 Subject: [PATCH 7/8] Add in send coins from account to module --- x/market/keeper/msg_server_create_pool.go | 10 ++++++++++ x/market/types/expected_keepers.go | 1 + 2 files changed, 11 insertions(+) diff --git a/x/market/keeper/msg_server_create_pool.go b/x/market/keeper/msg_server_create_pool.go index f3efeae..a3aef1a 100644 --- a/x/market/keeper/msg_server_create_pool.go +++ b/x/market/keeper/msg_server_create_pool.go @@ -55,12 +55,22 @@ func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) ( } } + // Get the borrower address + creator, _ := sdk.AccAddressFromBech32(msg.Creator) + + // All coins added to pools are deposited into the module account until redemption + sdkError := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creator, types.ModuleName, coinPair) + if sdkError != nil { + return nil, sdkError + } + _ = member1 _ = member2 _ = pair _ = pool _ = found _ = ctx + _ = creator return &types.MsgCreatePoolResponse{}, nil } diff --git a/x/market/types/expected_keepers.go b/x/market/types/expected_keepers.go index 4a50d01..ec5922c 100644 --- a/x/market/types/expected_keepers.go +++ b/x/market/types/expected_keepers.go @@ -15,6 +15,7 @@ type AccountKeeper interface { // BankKeeper defines the expected interface for the Bank module. type BankKeeper interface { SpendableCoins(context.Context, sdk.AccAddress) sdk.Coins + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error // Methods imported from bank should be defined here } From 964eaba0a5d6344989a2900ec9743a097d77ba5f Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Thu, 18 Apr 2024 13:30:09 -0500 Subject: [PATCH 8/8] Create Pool Logic finished --- x/market/keeper/msg_server_create_pool.go | 56 ++++++++++++++++++++--- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/x/market/keeper/msg_server_create_pool.go b/x/market/keeper/msg_server_create_pool.go index a3aef1a..4e8cd4f 100644 --- a/x/market/keeper/msg_server_create_pool.go +++ b/x/market/keeper/msg_server_create_pool.go @@ -64,13 +64,55 @@ func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) ( return nil, sdkError } - _ = member1 - _ = member2 - _ = pair - _ = pool - _ = found - _ = ctx - _ = creator + // Drops define proportional ownership to the liquidity in the pool + drops := coinPair.AmountOf(denom1).Mul(coinPair.AmountOf(denom2)) + + leader := types.Leader{ + Address: msg.Creator, + Drops: drops, + } + + if found { + pool.Drops = drops + pool.Leaders = []*types.Leader{&leader} + member1.Balance = coinPair.AmountOf(denom1) + member2.Balance = coinPair.AmountOf(denom2) + } else { + pool = types.Pool{ + Pair: pair, + Leaders: []*types.Leader{&leader}, + Denom1: coinPair.GetDenomByIndex(0), + Denom2: coinPair.GetDenomByIndex(1), + Volume1: &types.Volume{ + Denom: coinPair.GetDenomByIndex(0), + Amount: math.ZeroInt(), + }, + Volume2: &types.Volume{ + Denom: coinPair.GetDenomByIndex(1), + Amount: math.ZeroInt(), + }, + Drops: drops, + History: uint64(0), + } + + member1 = types.Member{ + Pair: pair, + DenomA: denom2, + DenomB: denom1, + Balance: coinPair.AmountOf(denom1), + Limit: 0, + Stop: 0, + } + + member2 = types.Member{ + Pair: pair, + DenomA: denom1, + DenomB: denom2, + Balance: coinPair.AmountOf(denom2), + Limit: 0, + Stop: 0, + } + } return &types.MsgCreatePoolResponse{}, nil }