From 1f2ba9bfcd48c347b96d591fc03d7830f84488a8 Mon Sep 17 00:00:00 2001 From: Charles Dusek Date: Wed, 17 Apr 2024 18:42:38 -0500 Subject: [PATCH] Add create-pool TX --- api/onex/market/tx.pulsar.go | 1070 +++++++++++++++++++- api/onex/market/tx_grpc.pb.go | 37 + docs/static/openapi.yml | 136 ++- proto/onex/market/tx.proto | 32 +- x/market/keeper/msg_server_create_pool.go | 18 + x/market/module/autocli.go | 6 + x/market/module/simulation.go | 25 +- x/market/simulation/create_pool.go | 30 + x/market/types/codec.go | 3 + x/market/types/message_create_pool.go | 25 + x/market/types/message_create_pool_test.go | 41 + x/market/types/tx.pb.go | 449 +++++++- 12 files changed, 1780 insertions(+), 92 deletions(-) create mode 100644 x/market/keeper/msg_server_create_pool.go create mode 100644 x/market/simulation/create_pool.go create mode 100644 x/market/types/message_create_pool.go create mode 100644 x/market/types/message_create_pool_test.go diff --git a/api/onex/market/tx.pulsar.go b/api/onex/market/tx.pulsar.go index 6ad41af..762224e 100644 --- a/api/onex/market/tx.pulsar.go +++ b/api/onex/market/tx.pulsar.go @@ -871,6 +871,910 @@ func (x *fastReflection_MsgUpdateParamsResponse) ProtoMethods() *protoiface.Meth } } +var ( + md_MsgCreatePool protoreflect.MessageDescriptor + fd_MsgCreatePool_creator protoreflect.FieldDescriptor + fd_MsgCreatePool_coinA protoreflect.FieldDescriptor + fd_MsgCreatePool_coinB protoreflect.FieldDescriptor +) + +func init() { + file_onex_market_tx_proto_init() + md_MsgCreatePool = File_onex_market_tx_proto.Messages().ByName("MsgCreatePool") + fd_MsgCreatePool_creator = md_MsgCreatePool.Fields().ByName("creator") + fd_MsgCreatePool_coinA = md_MsgCreatePool.Fields().ByName("coinA") + fd_MsgCreatePool_coinB = md_MsgCreatePool.Fields().ByName("coinB") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreatePool)(nil) + +type fastReflection_MsgCreatePool MsgCreatePool + +func (x *MsgCreatePool) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreatePool)(x) +} + +func (x *MsgCreatePool) slowProtoReflect() protoreflect.Message { + mi := &file_onex_market_tx_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_MsgCreatePool_messageType fastReflection_MsgCreatePool_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreatePool_messageType{} + +type fastReflection_MsgCreatePool_messageType struct{} + +func (x fastReflection_MsgCreatePool_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreatePool)(nil) +} +func (x fastReflection_MsgCreatePool_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreatePool) +} +func (x fastReflection_MsgCreatePool_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePool +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreatePool) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePool +} + +// 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_MsgCreatePool) Type() protoreflect.MessageType { + return _fastReflection_MsgCreatePool_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreatePool) New() protoreflect.Message { + return new(fastReflection_MsgCreatePool) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreatePool) Interface() protoreflect.ProtoMessage { + return (*MsgCreatePool)(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_MsgCreatePool) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Creator != "" { + value := protoreflect.ValueOfString(x.Creator) + if !f(fd_MsgCreatePool_creator, value) { + return + } + } + if x.CoinA != "" { + value := protoreflect.ValueOfString(x.CoinA) + if !f(fd_MsgCreatePool_coinA, value) { + return + } + } + if x.CoinB != "" { + value := protoreflect.ValueOfString(x.CoinB) + if !f(fd_MsgCreatePool_coinB, 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_MsgCreatePool) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "onex.market.MsgCreatePool.creator": + return x.Creator != "" + case "onex.market.MsgCreatePool.coinA": + return x.CoinA != "" + case "onex.market.MsgCreatePool.coinB": + return x.CoinB != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePool")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePool 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_MsgCreatePool) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "onex.market.MsgCreatePool.creator": + x.Creator = "" + case "onex.market.MsgCreatePool.coinA": + x.CoinA = "" + case "onex.market.MsgCreatePool.coinB": + x.CoinB = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePool")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePool 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_MsgCreatePool) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "onex.market.MsgCreatePool.creator": + value := x.Creator + return protoreflect.ValueOfString(value) + case "onex.market.MsgCreatePool.coinA": + value := x.CoinA + return protoreflect.ValueOfString(value) + case "onex.market.MsgCreatePool.coinB": + value := x.CoinB + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePool")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePool 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_MsgCreatePool) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "onex.market.MsgCreatePool.creator": + x.Creator = value.Interface().(string) + case "onex.market.MsgCreatePool.coinA": + x.CoinA = value.Interface().(string) + case "onex.market.MsgCreatePool.coinB": + x.CoinB = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePool")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePool 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_MsgCreatePool) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.MsgCreatePool.creator": + panic(fmt.Errorf("field creator of message onex.market.MsgCreatePool is not mutable")) + case "onex.market.MsgCreatePool.coinA": + panic(fmt.Errorf("field coinA of message onex.market.MsgCreatePool is not mutable")) + case "onex.market.MsgCreatePool.coinB": + panic(fmt.Errorf("field coinB of message onex.market.MsgCreatePool is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePool")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePool 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_MsgCreatePool) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "onex.market.MsgCreatePool.creator": + return protoreflect.ValueOfString("") + case "onex.market.MsgCreatePool.coinA": + return protoreflect.ValueOfString("") + case "onex.market.MsgCreatePool.coinB": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePool")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePool 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_MsgCreatePool) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in onex.market.MsgCreatePool", 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_MsgCreatePool) 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_MsgCreatePool) 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_MsgCreatePool) 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_MsgCreatePool) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreatePool) + 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.Creator) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.CoinA) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.CoinB) + 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().(*MsgCreatePool) + 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.CoinB) > 0 { + i -= len(x.CoinB) + copy(dAtA[i:], x.CoinB) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.CoinB))) + i-- + dAtA[i] = 0x1a + } + if len(x.CoinA) > 0 { + i -= len(x.CoinA) + copy(dAtA[i:], x.CoinA) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.CoinA))) + i-- + dAtA[i] = 0x12 + } + if len(x.Creator) > 0 { + i -= len(x.Creator) + copy(dAtA[i:], x.Creator) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Creator))) + 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().(*MsgCreatePool) + 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: MsgCreatePool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePool: 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 Creator", 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.Creator = 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 CoinA", 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.CoinA = 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 CoinB", 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.CoinB = 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_MsgCreatePoolResponse protoreflect.MessageDescriptor +) + +func init() { + file_onex_market_tx_proto_init() + md_MsgCreatePoolResponse = File_onex_market_tx_proto.Messages().ByName("MsgCreatePoolResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgCreatePoolResponse)(nil) + +type fastReflection_MsgCreatePoolResponse MsgCreatePoolResponse + +func (x *MsgCreatePoolResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreatePoolResponse)(x) +} + +func (x *MsgCreatePoolResponse) slowProtoReflect() protoreflect.Message { + mi := &file_onex_market_tx_proto_msgTypes[3] + 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_MsgCreatePoolResponse_messageType fastReflection_MsgCreatePoolResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreatePoolResponse_messageType{} + +type fastReflection_MsgCreatePoolResponse_messageType struct{} + +func (x fastReflection_MsgCreatePoolResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreatePoolResponse)(nil) +} +func (x fastReflection_MsgCreatePoolResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreatePoolResponse) +} +func (x fastReflection_MsgCreatePoolResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePoolResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgCreatePoolResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreatePoolResponse +} + +// 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_MsgCreatePoolResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreatePoolResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgCreatePoolResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreatePoolResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgCreatePoolResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreatePoolResponse)(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_MsgCreatePoolResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_MsgCreatePoolResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePoolResponse")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePoolResponse 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_MsgCreatePoolResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePoolResponse")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePoolResponse 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_MsgCreatePoolResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePoolResponse")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePoolResponse 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_MsgCreatePoolResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePoolResponse")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePoolResponse 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_MsgCreatePoolResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePoolResponse")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePoolResponse 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_MsgCreatePoolResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: onex.market.MsgCreatePoolResponse")) + } + panic(fmt.Errorf("message onex.market.MsgCreatePoolResponse 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_MsgCreatePoolResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in onex.market.MsgCreatePoolResponse", 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_MsgCreatePoolResponse) 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_MsgCreatePoolResponse) 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_MsgCreatePoolResponse) 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_MsgCreatePoolResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreatePoolResponse) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePoolResponse) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgCreatePoolResponse) + 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: MsgCreatePoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreatePoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -892,8 +1796,6 @@ type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the module parameters to update. - // // NOTE: All parameters must be supplied. Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty"` } @@ -960,6 +1862,83 @@ func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return file_onex_market_tx_proto_rawDescGZIP(), []int{1} } +type MsgCreatePool struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + CoinA string `protobuf:"bytes,2,opt,name=coinA,proto3" json:"coinA,omitempty"` + CoinB string `protobuf:"bytes,3,opt,name=coinB,proto3" json:"coinB,omitempty"` +} + +func (x *MsgCreatePool) Reset() { + *x = MsgCreatePool{} + if protoimpl.UnsafeEnabled { + mi := &file_onex_market_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreatePool) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreatePool) ProtoMessage() {} + +// Deprecated: Use MsgCreatePool.ProtoReflect.Descriptor instead. +func (*MsgCreatePool) Descriptor() ([]byte, []int) { + return file_onex_market_tx_proto_rawDescGZIP(), []int{2} +} + +func (x *MsgCreatePool) GetCreator() string { + if x != nil { + return x.Creator + } + return "" +} + +func (x *MsgCreatePool) GetCoinA() string { + if x != nil { + return x.CoinA + } + return "" +} + +func (x *MsgCreatePool) GetCoinB() string { + if x != nil { + return x.CoinB + } + return "" +} + +type MsgCreatePoolResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgCreatePoolResponse) Reset() { + *x = MsgCreatePoolResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_onex_market_tx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgCreatePoolResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreatePoolResponse) ProtoMessage() {} + +// Deprecated: Use MsgCreatePoolResponse.ProtoReflect.Descriptor instead. +func (*MsgCreatePoolResponse) Descriptor() ([]byte, []int) { + return file_onex_market_tx_proto_rawDescGZIP(), []int{3} +} + var File_onex_market_tx_proto protoreflect.FileDescriptor var file_onex_market_tx_proto_rawDesc = []byte{ @@ -985,22 +1964,35 @@ var file_onex_market_tx_proto_rawDesc = []byte{ 0xb0, 0x2a, 0x1d, 0x6f, 0x6e, 0x65, 0x78, 0x2f, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x60, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x52, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x1c, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x1a, 0x24, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x85, 0x01, - 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x42, 0x07, 0x54, 0x78, 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, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x63, 0x0a, 0x0d, 0x4d, + 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x18, 0x0a, 0x07, + 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x69, 0x6e, 0x41, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x69, 0x6e, 0x41, 0x12, 0x14, 0x0a, 0x05, + 0x63, 0x6f, 0x69, 0x6e, 0x42, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x69, + 0x6e, 0x42, 0x3a, 0x0c, 0x82, 0xe7, 0xb0, 0x2a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, + 0x22, 0x17, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, + 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xae, 0x01, 0x0a, 0x03, 0x4d, 0x73, + 0x67, 0x12, 0x52, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x1c, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, + 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, + 0x24, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x4d, 0x73, + 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x6f, 0x6f, 0x6c, 0x12, 0x1a, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x1a, + 0x22, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x4d, 0x73, + 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x85, 0x01, 0x0a, 0x0f, 0x63, + 0x6f, 0x6d, 0x2e, 0x6f, 0x6e, 0x65, 0x78, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0x07, + 0x54, 0x78, 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 ( @@ -1015,18 +2007,22 @@ func file_onex_market_tx_proto_rawDescGZIP() []byte { return file_onex_market_tx_proto_rawDescData } -var file_onex_market_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_onex_market_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_onex_market_tx_proto_goTypes = []interface{}{ (*MsgUpdateParams)(nil), // 0: onex.market.MsgUpdateParams (*MsgUpdateParamsResponse)(nil), // 1: onex.market.MsgUpdateParamsResponse - (*Params)(nil), // 2: onex.market.Params + (*MsgCreatePool)(nil), // 2: onex.market.MsgCreatePool + (*MsgCreatePoolResponse)(nil), // 3: onex.market.MsgCreatePoolResponse + (*Params)(nil), // 4: onex.market.Params } var file_onex_market_tx_proto_depIdxs = []int32{ - 2, // 0: onex.market.MsgUpdateParams.params:type_name -> onex.market.Params + 4, // 0: onex.market.MsgUpdateParams.params:type_name -> onex.market.Params 0, // 1: onex.market.Msg.UpdateParams:input_type -> onex.market.MsgUpdateParams - 1, // 2: onex.market.Msg.UpdateParams:output_type -> onex.market.MsgUpdateParamsResponse - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] is the sub-list for method input_type + 2, // 2: onex.market.Msg.CreatePool:input_type -> onex.market.MsgCreatePool + 1, // 3: onex.market.Msg.UpdateParams:output_type -> onex.market.MsgUpdateParamsResponse + 3, // 4: onex.market.Msg.CreatePool:output_type -> onex.market.MsgCreatePoolResponse + 3, // [3:5] is the sub-list for method output_type + 1, // [1:3] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name 1, // [1:1] is the sub-list for extension extendee 0, // [0:1] is the sub-list for field type_name @@ -1063,6 +2059,30 @@ func file_onex_market_tx_proto_init() { return nil } } + file_onex_market_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreatePool); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_onex_market_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgCreatePoolResponse); 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{ @@ -1070,7 +2090,7 @@ func file_onex_market_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_onex_market_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/api/onex/market/tx_grpc.pb.go b/api/onex/market/tx_grpc.pb.go index 2803129..19958e0 100644 --- a/api/onex/market/tx_grpc.pb.go +++ b/api/onex/market/tx_grpc.pb.go @@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( Msg_UpdateParams_FullMethodName = "/onex.market.Msg/UpdateParams" + Msg_CreatePool_FullMethodName = "/onex.market.Msg/CreatePool" ) // MsgClient is the client API for Msg service. @@ -29,6 +30,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + CreatePool(ctx context.Context, in *MsgCreatePool, opts ...grpc.CallOption) (*MsgCreatePoolResponse, error) } type msgClient struct { @@ -48,6 +50,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) CreatePool(ctx context.Context, in *MsgCreatePool, opts ...grpc.CallOption) (*MsgCreatePoolResponse, error) { + out := new(MsgCreatePoolResponse) + err := c.cc.Invoke(ctx, Msg_CreatePool_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. // All implementations must embed UnimplementedMsgServer // for forward compatibility @@ -55,6 +66,7 @@ type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + CreatePool(context.Context, *MsgCreatePool) (*MsgCreatePoolResponse, error) mustEmbedUnimplementedMsgServer() } @@ -65,6 +77,9 @@ type UnimplementedMsgServer struct { func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (UnimplementedMsgServer) CreatePool(context.Context, *MsgCreatePool) (*MsgCreatePoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePool not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -96,6 +111,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_CreatePool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreatePool) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreatePool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_CreatePool_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreatePool(ctx, req.(*MsgCreatePool)) + } + return interceptor(ctx, in, info, handler) +} + // Msg_ServiceDesc is the grpc.ServiceDesc for Msg service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -107,6 +140,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "CreatePool", + Handler: _Msg_CreatePool_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "onex/market/tx.proto", diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 1a09b39..90b475f 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -13100,10 +13100,66 @@ paths: title: MsgUpdateParams is the Msg/UpdateParams request type tags: - Msg - /onex/denom/params: + /onex.denom.Msg/UpdateParams: + post: + summary: |- + UpdateParams defines a (governance) operation for updating the module + parameters. The authority defaults to the x/gov module account. + operationId: OnexDenomMsg_UpdateParams + responses: + '200': + description: A successful response. + schema: + type: object + description: >- + MsgUpdateParamsResponse defines the response structure for + executing a + + MsgUpdateParams message. + 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: {} + parameters: + - name: body + description: MsgUpdateParams is the Msg/UpdateParams request type. + in: body + required: true + schema: + type: object + properties: + authority: + type: string + description: >- + authority is the address that controls the module (defaults to + x/gov unless overwritten). + params: + description: |- + params defines the module parameters to update. + + NOTE: All parameters must be supplied. + type: object + description: MsgUpdateParams is the Msg/UpdateParams request type. + tags: + - Msg + /onex/market/params: get: summary: Parameters queries the parameters of the module. - operationId: OnexDenomQuery_Params + operationId: OnexMarketQuery_Params responses: '200': description: A successful response. @@ -13136,22 +13192,14 @@ paths: additionalProperties: {} tags: - Query - /onex.denom.Msg/UpdateParams: + /onex.market.Msg/CreatePool: post: - summary: |- - UpdateParams defines a (governance) operation for updating the module - parameters. The authority defaults to the x/gov module account. - operationId: OnexDenomMsg_UpdateParams + operationId: OnexMarketMsg_CreatePool responses: '200': description: A successful response. schema: type: object - description: >- - MsgUpdateParamsResponse defines the response structure for - executing a - - MsgUpdateParams message. default: description: An unexpected error response. schema: @@ -13172,24 +13220,17 @@ paths: additionalProperties: {} parameters: - name: body - description: MsgUpdateParams is the Msg/UpdateParams request type. in: body required: true schema: type: object properties: - authority: + creator: + type: string + coinA: + type: string + coinB: type: string - description: >- - authority is the address that controls the module (defaults to - x/gov unless overwritten). - params: - description: |- - params defines the module parameters to update. - - NOTE: All parameters must be supplied. - type: object - description: MsgUpdateParams is the Msg/UpdateParams request type. tags: - Msg /onex.market.Msg/UpdateParams: @@ -13240,10 +13281,7 @@ paths: authority is the address that controls the module (defaults to x/gov unless overwritten). params: - description: |- - params defines the module parameters to update. - - NOTE: All parameters must be supplied. + description: 'NOTE: All parameters must be supplied.' type: object description: MsgUpdateParams is the Msg/UpdateParams request type. tags: @@ -20360,16 +20398,6 @@ definitions: NOTE: The amount field is an Int which implements the custom method signatures required by gogoproto. title: Params defines the parameters for CCV Provider module - onex.denom.Params: - type: object - description: Params defines the parameters for the module. - onex.denom.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.denom.MsgUpdateParams: type: object properties: @@ -20390,6 +20418,30 @@ definitions: description: |- MsgUpdateParamsResponse defines the response structure for executing a MsgUpdateParams message. + 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: + creator: + type: string + coinA: + type: string + coinB: + type: string + onex.market.MsgCreatePoolResponse: + type: object onex.market.MsgUpdateParams: type: object properties: @@ -20399,10 +20451,7 @@ definitions: authority is the address that controls the module (defaults to x/gov unless overwritten). params: - description: |- - params defines the module parameters to update. - - NOTE: All parameters must be supplied. + description: 'NOTE: All parameters must be supplied.' type: object description: MsgUpdateParams is the Msg/UpdateParams request type. onex.market.MsgUpdateParamsResponse: @@ -20410,6 +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. diff --git a/proto/onex/market/tx.proto b/proto/onex/market/tx.proto index f464b7e..a7328ba 100644 --- a/proto/onex/market/tx.proto +++ b/proto/onex/market/tx.proto @@ -1,4 +1,5 @@ syntax = "proto3"; + package onex.market; import "amino/amino.proto"; @@ -12,29 +13,36 @@ option go_package = "onex/x/market/types"; // Msg defines the Msg service. service Msg { option (cosmos.msg.v1.service) = true; - + // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse); + rpc CreatePool (MsgCreatePool ) returns (MsgCreatePoolResponse ); } - // MsgUpdateParams is the Msg/UpdateParams request type. message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "onex/x/market/MsgUpdateParams"; - + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "onex/x/market/MsgUpdateParams"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; // params defines the module parameters to update. - // + // NOTE: All parameters must be supplied. - Params params = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; + Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgUpdateParamsResponse defines the response structure for executing a // MsgUpdateParams message. -message MsgUpdateParamsResponse {} \ No newline at end of file +message MsgUpdateParamsResponse {} + +message MsgCreatePool { + option (cosmos.msg.v1.signer) = "creator"; + string creator = 1; + string coinA = 2; + string coinB = 3; +} + +message MsgCreatePoolResponse {} + diff --git a/x/market/keeper/msg_server_create_pool.go b/x/market/keeper/msg_server_create_pool.go new file mode 100644 index 0000000..6b88a0f --- /dev/null +++ b/x/market/keeper/msg_server_create_pool.go @@ -0,0 +1,18 @@ +package keeper + +import ( + "context" + + "onex/x/market/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (*types.MsgCreatePoolResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgCreatePoolResponse{}, nil +} diff --git a/x/market/module/autocli.go b/x/market/module/autocli.go index bc18224..1c7e677 100644 --- a/x/market/module/autocli.go +++ b/x/market/module/autocli.go @@ -28,6 +28,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcMethod: "UpdateParams", Skip: true, // skipped because authority gated }, + { + RpcMethod: "CreatePool", + Use: "create-pool [coin-a] [coin-b]", + Short: "Send a create-pool tx", + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "coinA"}, {ProtoField: "coinB"}}, + }, // this line is used by ignite scaffolding # autocli/tx }, }, diff --git a/x/market/module/simulation.go b/x/market/module/simulation.go index a1fd79a..2df33b3 100644 --- a/x/market/module/simulation.go +++ b/x/market/module/simulation.go @@ -23,7 +23,11 @@ var ( ) const ( -// this line is used by starport scaffolding # simapp/module/const + opWeightMsgCreatePool = "op_weight_msg_create_pool" + // TODO: Determine the simulation weight value + defaultWeightMsgCreatePool int = 100 + + // this line is used by starport scaffolding # simapp/module/const ) // GenerateGenesisState creates a randomized GenState of the module. @@ -46,6 +50,17 @@ func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {} func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { operations := make([]simtypes.WeightedOperation, 0) + var weightMsgCreatePool int + simState.AppParams.GetOrGenerate(opWeightMsgCreatePool, &weightMsgCreatePool, nil, + func(_ *rand.Rand) { + weightMsgCreatePool = defaultWeightMsgCreatePool + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgCreatePool, + marketsimulation.SimulateMsgCreatePool(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -54,6 +69,14 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp // ProposalMsgs returns msgs used for governance proposals for simulations. func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ + simulation.NewWeightedProposalMsg( + opWeightMsgCreatePool, + defaultWeightMsgCreatePool, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + marketsimulation.SimulateMsgCreatePool(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/market/simulation/create_pool.go b/x/market/simulation/create_pool.go new file mode 100644 index 0000000..96c5c46 --- /dev/null +++ b/x/market/simulation/create_pool.go @@ -0,0 +1,30 @@ +package simulation + +import ( + "math/rand" + + "onex/x/market/keeper" + "onex/x/market/types" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +func SimulateMsgCreatePool( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgCreatePool{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the CreatePool simulation + + return simtypes.NoOpMsg(types.ModuleName, sdk.MsgTypeURL(msg), "CreatePool simulation not implemented"), nil, nil + } +} diff --git a/x/market/types/codec.go b/x/market/types/codec.go index ac55263..5ac4660 100644 --- a/x/market/types/codec.go +++ b/x/market/types/codec.go @@ -8,6 +8,9 @@ import ( ) func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreatePool{}, + ) // this line is used by starport scaffolding # 3 registry.RegisterImplementations((*sdk.Msg)(nil), diff --git a/x/market/types/message_create_pool.go b/x/market/types/message_create_pool.go new file mode 100644 index 0000000..ab0f00a --- /dev/null +++ b/x/market/types/message_create_pool.go @@ -0,0 +1,25 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ sdk.Msg = &MsgCreatePool{} + +func NewMsgCreatePool(creator string, coinA string, coinB string) *MsgCreatePool { + return &MsgCreatePool{ + Creator: creator, + CoinA: coinA, + CoinB: coinB, + } +} + +func (msg *MsgCreatePool) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/market/types/message_create_pool_test.go b/x/market/types/message_create_pool_test.go new file mode 100644 index 0000000..5850982 --- /dev/null +++ b/x/market/types/message_create_pool_test.go @@ -0,0 +1,41 @@ +package types + +import ( + "testing" + + "onex/testutil/sample" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" +) + +func TestMsgCreatePool_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgCreatePool + err error + }{ + { + name: "invalid address", + msg: MsgCreatePool{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgCreatePool{ + Creator: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/market/types/tx.pb.go b/x/market/types/tx.pb.go index 093e0d8..2e08e53 100644 --- a/x/market/types/tx.pb.go +++ b/x/market/types/tx.pb.go @@ -35,8 +35,6 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgUpdateParams struct { // authority is the address that controls the module (defaults to x/gov unless overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the module parameters to update. - // // NOTE: All parameters must be supplied. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } @@ -126,15 +124,113 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +type MsgCreatePool struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + CoinA string `protobuf:"bytes,2,opt,name=coinA,proto3" json:"coinA,omitempty"` + CoinB string `protobuf:"bytes,3,opt,name=coinB,proto3" json:"coinB,omitempty"` +} + +func (m *MsgCreatePool) Reset() { *m = MsgCreatePool{} } +func (m *MsgCreatePool) String() string { return proto.CompactTextString(m) } +func (*MsgCreatePool) ProtoMessage() {} +func (*MsgCreatePool) Descriptor() ([]byte, []int) { + return fileDescriptor_84e43325217bbf94, []int{2} +} +func (m *MsgCreatePool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreatePool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreatePool.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 *MsgCreatePool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreatePool.Merge(m, src) +} +func (m *MsgCreatePool) XXX_Size() int { + return m.Size() +} +func (m *MsgCreatePool) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreatePool.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreatePool proto.InternalMessageInfo + +func (m *MsgCreatePool) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgCreatePool) GetCoinA() string { + if m != nil { + return m.CoinA + } + return "" +} + +func (m *MsgCreatePool) GetCoinB() string { + if m != nil { + return m.CoinB + } + return "" +} + +type MsgCreatePoolResponse struct { +} + +func (m *MsgCreatePoolResponse) Reset() { *m = MsgCreatePoolResponse{} } +func (m *MsgCreatePoolResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreatePoolResponse) ProtoMessage() {} +func (*MsgCreatePoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_84e43325217bbf94, []int{3} +} +func (m *MsgCreatePoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreatePoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreatePoolResponse.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 *MsgCreatePoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreatePoolResponse.Merge(m, src) +} +func (m *MsgCreatePoolResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreatePoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreatePoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreatePoolResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdateParams)(nil), "onex.market.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "onex.market.MsgUpdateParamsResponse") + proto.RegisterType((*MsgCreatePool)(nil), "onex.market.MsgCreatePool") + proto.RegisterType((*MsgCreatePoolResponse)(nil), "onex.market.MsgCreatePoolResponse") } func init() { proto.RegisterFile("onex/market/tx.proto", fileDescriptor_84e43325217bbf94) } var fileDescriptor_84e43325217bbf94 = []byte{ - // 317 bytes of a gzipped FileDescriptorProto + // 402 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc9, 0xcf, 0x4b, 0xad, 0xd0, 0xcf, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x06, 0x89, 0xea, 0x41, 0x44, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, @@ -149,12 +245,18 @@ var fileDescriptor_84e43325217bbf94 = []byte{ 0xc9, 0x83, 0x7a, 0x10, 0xc3, 0x9d, 0x38, 0x4f, 0xdc, 0x93, 0x67, 0x58, 0xf1, 0x7c, 0x83, 0x16, 0x63, 0x10, 0x54, 0xb5, 0x95, 0x41, 0xd3, 0xf3, 0x0d, 0x5a, 0x08, 0x73, 0xba, 0x9e, 0x6f, 0xd0, 0x92, 0x05, 0x3b, 0x18, 0xee, 0x64, 0x34, 0x17, 0x2a, 0x49, 0x72, 0x89, 0xa3, 0x09, 0x05, 0xa5, - 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x1a, 0x25, 0x70, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0x05, 0x71, - 0xf1, 0xa0, 0xf8, 0x49, 0x06, 0xc5, 0x2d, 0x68, 0x9a, 0xa5, 0x54, 0xf0, 0xc9, 0xc2, 0x8c, 0x96, - 0x62, 0x6d, 0x00, 0x39, 0xdb, 0x49, 0xf7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, - 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, - 0xa2, 0x84, 0x51, 0x5d, 0x5d, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x68, 0x63, 0x40, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x59, 0xd9, 0x6f, 0x04, 0x02, 0x00, 0x00, + 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x2a, 0x25, 0x73, 0xf1, 0xfa, 0x16, 0xa7, 0x3b, 0x17, 0xa5, + 0x82, 0xa4, 0xf2, 0xf3, 0x73, 0x84, 0x24, 0xb8, 0xd8, 0x93, 0x41, 0xbc, 0xfc, 0x22, 0x88, 0x5f, + 0x82, 0x60, 0x5c, 0x21, 0x11, 0x2e, 0xd6, 0xe4, 0xfc, 0xcc, 0x3c, 0x47, 0xb0, 0x73, 0x39, 0x83, + 0x20, 0x1c, 0x98, 0xa8, 0x93, 0x04, 0x33, 0x42, 0xd4, 0xc9, 0x8a, 0x07, 0xe4, 0x46, 0x98, 0x4e, + 0x25, 0x71, 0x2e, 0x51, 0x14, 0x4b, 0x60, 0xb6, 0x1b, 0xad, 0x63, 0xe4, 0x62, 0xf6, 0x2d, 0x4e, + 0x17, 0x0a, 0xe2, 0xe2, 0x41, 0x09, 0x52, 0x19, 0x94, 0xa0, 0x40, 0x73, 0xbb, 0x94, 0x0a, 0x3e, + 0x59, 0x98, 0xd9, 0x42, 0x3e, 0x5c, 0x5c, 0x48, 0xde, 0x92, 0x42, 0xd7, 0x83, 0x90, 0x93, 0x52, + 0xc2, 0x2d, 0x07, 0x33, 0x4d, 0x8a, 0xb5, 0x01, 0x14, 0x07, 0x4e, 0xba, 0x27, 0x1e, 0xc9, 0x31, + 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, + 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x25, 0x8c, 0x1a, 0x05, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, + 0x6c, 0xe0, 0x54, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xee, 0xab, 0x81, 0x04, 0xd1, 0x02, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -172,6 +274,7 @@ type MsgClient interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + CreatePool(ctx context.Context, in *MsgCreatePool, opts ...grpc.CallOption) (*MsgCreatePoolResponse, error) } type msgClient struct { @@ -191,11 +294,21 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) CreatePool(ctx context.Context, in *MsgCreatePool, opts ...grpc.CallOption) (*MsgCreatePoolResponse, error) { + out := new(MsgCreatePoolResponse) + err := c.cc.Invoke(ctx, "/onex.market.Msg/CreatePool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // UpdateParams defines a (governance) operation for updating the module // parameters. The authority defaults to the x/gov module account. UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + CreatePool(context.Context, *MsgCreatePool) (*MsgCreatePoolResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -205,6 +318,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) CreatePool(ctx context.Context, req *MsgCreatePool) (*MsgCreatePoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePool not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -228,6 +344,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_CreatePool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreatePool) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreatePool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/onex.market.Msg/CreatePool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreatePool(ctx, req.(*MsgCreatePool)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "onex.market.Msg", HandlerType: (*MsgServer)(nil), @@ -236,6 +370,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "CreatePool", + Handler: _Msg_CreatePool_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "onex/market/tx.proto", @@ -304,6 +442,73 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgCreatePool) 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 *MsgCreatePool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.CoinB) > 0 { + i -= len(m.CoinB) + copy(dAtA[i:], m.CoinB) + i = encodeVarintTx(dAtA, i, uint64(len(m.CoinB))) + i-- + dAtA[i] = 0x1a + } + if len(m.CoinA) > 0 { + i -= len(m.CoinA) + copy(dAtA[i:], m.CoinA) + i = encodeVarintTx(dAtA, i, uint64(len(m.CoinA))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreatePoolResponse) 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 *MsgCreatePoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreatePoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -339,6 +544,36 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgCreatePool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.CoinA) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.CoinB) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreatePoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -510,6 +745,202 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreatePool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreatePool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CoinA", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CoinA = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CoinB", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CoinB = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreatePoolResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreatePoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreatePoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0